On Nov 10, 2008, at 4:53 AM, Felix Ulber wrote:
I am working on an Cocoa Application whose main purpose is to display some stuff in OpenGL. In conjunction with that I need to be able to read in floating point images (most likely from an exr file) and resize them. Unfortunately, with NSImage and NSBitmapImage it seems I can get only 32 bpp/8bit per channel bitmap data (as the example in the cocoa drawing guide).
I'm not familiar with exr, but NSBitmapImageRep does support floating point images; I use it to read 32-bit float GeoTIFF files. See NSFloatingPointSamplesBitmapFormat from the NSBitmapFormat enum, or the Quartz docs for bitmap contexts (Table 2-1):
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/chapter_3_section_4.html
So I did some research and stumbled upon things like Image I/O, Core Image and vImage. But I have tom admit have absolutely no clue what to use when and how.
The easiest way to scale your image is probably to create a new bitmap context of the desired size and pixel format, draw the original image into it, then use the pixel data from your new context. You can either use NSImage/NSBitmapImageRep or Quartz 2D for that.
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_texturedata/chapter_10_section_5.htmlCore Image would work as well, but I think getting the pixel data is more roundabout. I wouldn't recommend vImage if you're not familiar with the higher level frameworks.
-- Adam
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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 [EMAIL PROTECTED]