cworth at cworth.org
Wed Nov 14 09:59:11 PST 2007
On Wed, 14 Nov 2007 15:06:45 +0100 (CET), Kai-Uwe Behrmann wrote:
> > ARGB32 = current scheme
> > ARGB32_8_8_8_8 = same, but with the channels fully specified.
> Seems pretty clear what is inside.
> unsigned char pixel
> pixel == A
> pixel == R ...
No, that's not correct. It will accidentally get the correct result on
a little-endian machine, but will be wrong on a big-endian machine.
> > BGRA_8_8_8_8 = same as ARGB32 on big-endian machine
> So, it's better to use bit operators to access the channels platform
> independend in CAIRO_FORMAT_ARGB32 ?
Yes. Each pixel is really a 32-bit quantity. And that's part the point
of the "32" in the name, as Bill explained.
But you are correct that "32" doesn't say much about the details of
the format. But I also wouldn't like just a single number showing just
the number of bits per channel. If nothing else, this wouldn't help at
all with a 16-bit-per-pixel format with 5, 6, and 5 bits for the red,
green, and blue channels.
So the ARGB32_8_8_8_8 name seems fairly reasonable. It's not that
different than the RGB16_565 scheme that cairo does have already, (but
without underscores that scheme breaks down as soon as there are 10 or
more bits for any given channel).
> > xRGB32 = proper description of RGB24 with an 8-bit 'x' pad field
> After reading the comment to cairo_format_t I can see RGB24 is indeed a
> 32-bit quantity. So by using CAIRO_FORMAT_RGB24 as a
> 3 * sizeof(char) array a application could crash.
> The term CAIRO_FORMAT_RGB24 is demanding some knowledge.
Yeah. I was surprised to see a rant about cairo_format_t that didn't
pick this one apart. CAIRO_FORMAT_RGB24 is definitely the worst name
in there. CAIRO_FORMAT_xRGB32 would be much more consistent with the
As should be fairly obvious, not a huge amount of thought went into
this naming for cairo. Sorry about that!
> > RGB_8_8_8 = most likely layout, in memory-address order, of data that really
> > is 24 bits per pixel and not 32.
> ... but not exposed at all in Cairo.
Right. Cairo doesn't have that format right now. It's not very useful
for a lot of graphics hardware, for example.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071114/fea2eb1e/attachment.pgp
More information about the cairo