Re: NSImage -- getting raw bitmap data
Re: NSImage -- getting raw bitmap data
- Subject: Re: NSImage -- getting raw bitmap data
- From: Marcel Weiher <email@hidden>
- Date: Sat, 2 Aug 2003 21:39:07 +0100
I'm using NSBitmapImageRep's initWithBitmapDataPlanes: to get some
raw bitmap data into an NSImageView. Now, I've set this view to be
editable, and users can drag image files onto it to replace the data.
But how do I get the raw image data from whatever image the user
dragged onto my NSImageView? Basically, I'd need the reverse operation
of initWithBitmapDataPlanes:, but I need to force the image to be a
particular depth, number of planes etc.
Apple's "Drawing Images" docs are pretty terse on that topic, and
Mamasam only brought up a sample by Marco Binder that was close but no
cookie, even less on cocoadevcentral. I also tried to lockFocus on the
NSBitmapImageRep
lockFocus on the NSImage, then get an NSBitmapImageRep from that using
-initWithFocusedViewRect:. You will get whatever depth / pixel-format
the system has decided it wants for that particular image, however.
and just draw the image in there, but that didn't change the data I
passed in.
You can't lockFocus on an NSBitmapImageRep.
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.