Re: How to convert 32bit to 24 bit NSBitmapImageRep
Re: How to convert 32bit to 24 bit NSBitmapImageRep
- Subject: Re: How to convert 32bit to 24 bit NSBitmapImageRep
- From: "Michael Ash" <email@hidden>
- Date: Wed, 26 Jul 2006 21:05:39 -0400
On 7/26/06, Vinay Prabhu <email@hidden> wrote:
Hi,
Is there any direct API to convert from 32 bit to 24 bit NSBitmapImageRep?
I couldn't find any direct way, I have tried 2 methods,
1) Obtained the data pointer from 32 bit NSBitmapImageRep, and created new
image rep
using the initWithBitmapDataPlanes API.
This resulted in junk output.
2) Created a new image rep using the initWithBitmapDataPlanes API by passing
"nil" for data pointer.
Then obtained the data pointer using "bitmapData" API and copied the data
from 32 bit to 24 bit, without passing alpha information.
This also resulted in junk output
Any better method to do this?
If you can require Tiger, create a 24-bit NSBitmapImageRep, then
create a new NSGraphicsContext from it, and draw your 32-bit rep into
it. This will make the graphics system handle all the annoying
conversions automatically.
If that is not an option, attempt #2 should have worked. If you got
junk output, that just means your conversion was written wrong.
Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden