Re: Copying raw RGBA image data to NSBitmapImageRep coming
Re: Copying raw RGBA image data to NSBitmapImageRep coming
- Subject: Re: Copying raw RGBA image data to NSBitmapImageRep coming
- From: Heinrich Giesen <email@hidden>
- Date: Thu, 11 Jan 2007 12:23:04 +0100
On 11.01.2007, at 02:00, E. Wing wrote:
So I was using GL_UNSIGNED_BYTE because I thought it would always be
in big endian (endian-independent) format. Does NSBitmapImageRep not
want this, but a platform native endian order?
Bytes are endian-independent and NSBitmapImageRep wants the color
components
almost always (as default RGBA case) first the red, then the green
then the blue
color component. So your decision to use GL_UNSIGNED_BYTE was absolutly
correct. It is platform independent.
About the alpha channel you wrote:
But this did get me thinking about trying just RGB instead of RGBA.
Using the following code instead:
... code deleted ...
This fixed all my funny color problems. But now I'm really curious,
what is it about the alpha and my settings that was causing the
problem? (And what is the fix so I can use alpha?)
My guess is that your data are not premultiplied but NSBitmapImageRep
assumes premultiplied data, i.e. no color component must have a value
greater than alpha. Otherwise this could lead to "over-saturated"
images.
Changing "bitmapFormat:0" into:
"bitmapFormat: NSAlphaNonpremultipliedBitmapFormat" could do it.
Good luck
Heinrich
--
Heinrich Giesen
email@hidden
_______________________________________________
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