• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSImage and NSBitmapImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage and NSBitmapImageRep


  • Subject: Re: NSImage and NSBitmapImageRep
  • From: Ken Ferry <email@hidden>
  • Date: Tue, 16 Mar 2010 23:52:37 -0700

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 <email@hidden>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 (email@hidden)
>
> 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:
>
> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >NSImage and NSBitmapImageRep (From: Martin Beroiz <email@hidden>)

  • Prev by Date: Re: NSImage and NSBitmapImageRep
  • Next by Date: Re: Cocoa Newbie Thread/Memory Problems
  • Previous by thread: Re: NSImage and NSBitmapImageRep
  • Next by thread: Directory to save file in NSSavePanel
  • Index(es):
    • Date
    • Thread