Re: Convert GWorldPtr into a NSImage
Re: Convert GWorldPtr into a NSImage
- Subject: Re: Convert GWorldPtr into a NSImage
- From: Graham Cox <email@hidden>
- Date: Wed, 7 Jan 2009 10:42:31 +1100
On 7 Jan 2009, at 10:03 am, Eric Gorr wrote:
I have something that comes close, but the problem I believe is that
the pixelFormat for the GWorldPtr is BGRA.
Why do you believe that? My recollection* is that a 32-bit RGB GWorld
uses URGB (where U means 'unused' - GWorlds do not have an alpha
channel). It's been a while but I used to work extensively with
GWorlds. There may be a byte ordering issue on PPC vs. Intel though,
since GWorlds were very much part of the 68k/PPC universe. Where has
your GWorld come from?
*I looked it up in Inside Macintosh Volume 6, it's on page 17-6.
When I tried to setup a NSBitmapImageRep, I tried
NSDeviceRGBColorSpace for the colorSpaceName which I believe expects
the pixelFormat for the GWorldPtr to be either RGBA or ARGB.
It should be straightforward to wrap an NSBitmapImageRep around some
of the GWorld formats. Not all of them are supported but ARGB 32-bit
is. While GWorlds do not have an alpha channel QuickDraw does preserve
the bits in the unused byte, but you will need to address the issue of
setting those bits yourself somehow.
You don't say what you're trying to do or what you've tried, so I'm
not sure what other advice I can give.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden