You'd add an NSBitmapImageRep to an NSImage with -[NSImage addRepresentation:].
However, an NSImage is not going to be any easier to draw rotated than an NSBitmapImageRep. You can draw rotated by changing the coordinate system right before you draw your image, drawing, and putting it back. See NSAffineTransform<http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSAffineTransform_Class/Reference/Reference.html>and the Cocoa Drawing Guide<http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/Introduction.html> . -Ken On Tue, Mar 16, 2010 at 11:39 PM, Martin Beroiz <martinber...@gmail.com>wrote: > Hello everybody, > > I have a question relating NSImage and NSBitmapImageRep. I have a stream of > data that I want to display in a view and it's not in any standard image > format. So I created an NSBitmapImageRep, then I filled the bitmapdata with > the data and drew it in the view with drawInRect: method of > NSBitmapImageRep. All that works perfect. > Now I want to rotate the image 90 degrees before I draw it but without > changing the view's coordinate system because i need to draw other things on > it. So I thought of making my bitmap rep into an NSImage. > > Question is how. I read the docs but they I cannot understand exactly what > is the relation between an NSImage and NSBitmapImageRep. > From the docs: > > "Image representations are used by an NSImage object to manage image data." > > "If you are creating images dynamically, you are responsible for creating > the image representation objects you need for your image." > > I don't see how you'd "hook" an image with a bitmap rep or vice-versa. > The only relevant method of NSImage I found is drawRepresentation:inRect: > but the docs say that I shouldn't call this method directly. > > So how would you guys do this? > > Thanks > Martin. > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com > > This email sent to kenfe...@gmail.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com