I am having trouble creating NSImage from raw RGB data (565 mode). To
my understanding that NSBitmapImageRep initWithBitmapDataPlanes only
supports aligned bps.
How can I create a bitmap image from RGB data 585 mode?
Any sample code or suggestion will be greatly appreciated.
Thanks,
Mike
NSBitmapImageRep doesn't intrinsically support RGB 565-format pixel
data; you'll need to first promote the data to RGB 888.
A useful trick is to replicate the high bits of each original sample
value in the low bits of the new value. For the 5-bit 'R' and 'B'
samples, for example, you'd shift the original value left 3 bits, and
OR that with its top 3 bits, shifted down into the low 3 bit-positions:
new = (old << 3) | (old >> 2)
--
Troy Stephens
Cocoa Frameworks
Apple Computer, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden