Creating a bitmap of a scaled-down NSImage
Creating a bitmap of a scaled-down NSImage
- Subject: Creating a bitmap of a scaled-down NSImage
- From: John Stiles <email@hidden>
- Date: Mon, 26 Mar 2007 18:39:52 -0700
I have an NSImage that has arrived from an external source that I
don't directly control. I need to scale it down and rasterize it to
an NSBitmapImageRep—the ultimate goal is to get it into an OpenGL
texture, and we have maximum texture-size limits that I need to respect.
The documentation has some very useful code here: http://
developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/
Images/chapter_7_section_5.html#//apple_ref/doc/uid/TP40003290-CH208-
BCICHFGA
The first technique, using initWithFocusedViewRect, works like a
charm if I don't need to change the image's size. However, according
to the docs, when using this technique, "you cannot scale the content
you capture." And unfortunately, I need to support 10.3.9, so the
NSView techniques listed don't apply to me.
What is the best approach? There must be a way to scale down the
image using the frameworks. I think I could figure out a way to do it
by rasterizing the image and then scaling that bitmap down as a
separate operation, but I'm thinking there must be a better way.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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