[cairo] ARGB, BGRA, RGBA mess

Owen Taylor otaylor at redhat.com
Thu Jan 13 11:06:27 PST 2005


On Thu, 2005-01-13 at 10:41 -0800, Bill Spitzak wrote:
> 
> Chris wrote:
> 
> > I don't think it's a bug in Cairo, it is just unexpected from my view.
> > In my world I'm used to having an particular format that always has the
> > same byte ordering no matter what platform it is used on.  So if it says
> > "ARGB" then I expect the bytes in memory to be A, R, G, B on all the
> > platforms.  This is just my view from working with bitmaps, targa's,
> > jpeg's, etc.
> 
> I would agree that, from looking at many image library specifications, 
> the term "ABCD" means that A is at a lower memory address than B in the 
> virtually every single one of them. Only X has the idea that ABCD means 
> A is in the high-order byte of a word. I recommend Cairo and all new 
> software follow the more common conventions. It is extremely confusing 
> to do otherwise. It also makes it impossible to describe formats where 
> the distance between pixels is 3 in any sensible way.

The conventions that X and Cairo use match that of the hardware and
that of Windows (no real surprise that both X and Windows match
the hardware). OpenGL is extremely flexible ... it basically can
do anything in the known universe.

> Other problem is that in all my work I have *never* seen "ARGB" or 
> "BGRA".  By far the most common layout is "RGBA". The second-most common 
> is "ABGR". I think it would be perfectly acceptable if Cairo only 
> accepted RGBA and ABGR.

For GTK+ it would be really convenient if libpixman (and thus cairo)
could handle byte-oriented non-premultiplied RGBA, so if nobody gets to
it first (please do!) I might eventually get to doing the work to add
that format.

But I would consider the premutiplied native-endian ARGB format that
Cairo supports now to be the most common format out there for in-memory
images.

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050113/f6c0f644/attachment.pgp


More information about the cairo mailing list