CGBitmapContextCreate fails for RGB

Member
Posts: 157
Joined: 2002.12
Post: #1
Why would CGBitmapContextCreate() fail when I pass an RGB buffer format?
it works when I pass RGBA.
Any idea?

thanks



Code:
//-----------------------------------------------------------------
RGBA call
size_t rowBytes  = 128 * 4;
contextRef = CGBitmapContextCreate( imageRef->buffer,
128,
128,
8,
rowBytes,
colorSpecInfo,
kCGImageAlphaNoneSkipLast );

//-----------------------------------------------------------------
RGB call

size_t rowBytes  = 128 * 3;
contextRef = CGBitmapContextCreate( imageRef->buffer,
128,
128,
8,
rowBytes,
colorSpecInfo,
kCGImageAlphaNone );
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #2
According to http://developer.apple.com/qa/qa2001/qa1037.html
you can't have 24 bit pixels. Only 8, 16 & 32 bits per pixel. (btw, kCGImageAlphaNone & kCGImageAlphaNoneSkipLast are equivalent)
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #3
That's critical info, I wonder why is not part of CG documentation?
thanks PowerMacX.

by the way I donloaded your game entry from 2004 Okugai, good job!.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #4
It is part of the CG documentation. Look at the Supported Pixel Formats table in the discussion of CGBitmapContextCreate.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Trouble with CGBitmapContextCreate TomorrowPlusX 3 4,728 Apr 10, 2006 02:23 PM
Last Post: TomorrowPlusX
  SDL on Tiger fails to update display Dan Compton 2 2,744 Jan 9, 2006 08:18 AM
Last Post: DanLab
  glGenProgramsARB fails... TomorrowPlusX 6 5,898 Feb 15, 2005 12:25 AM
Last Post: PowerMacX