[cairo] How to load a BMP/JPG/TGA to a Surface?

Adrian Lopez adrianlopezroche at gmail.com
Tue Jun 1 14:11:12 PDT 2010


On Tue, Jun 1, 2010 at 4:29 PM, Bill Spitzak <spitzak at gmail.com> wrote:

> Actually Cairo's image format is ARGB32, meaning each 32-bit word has the
> bits arranged so that A is the high-order 8 bits and B in the lowest 8 bits.
> On a little-endian machine the bytes are then arranged in BGRA order, but on
> a big-endian machine they would be ARGB.
>

Isn't that what I said? On x86, Cairo's format looks like (B, G, R, A) when
addressed as individual bytes, where A is the most significant byte of the
32-bit number. DevIL's IL_RGBA format looks like (R, G, B, A) on my Intel
PC, so I'm assuming its format is not affected by endianness (it would be
silly to call it RGBA if stored as ABGR on big-endian systems).


>
> I think DevIL will need to be changed. ARGB32 is used extensively and is
> often the only or most-accelerated option on graphics hardware, due to it
> being the format used by the Windows API.
>
>
On x86 systems you can get the same ordering as Cairo by loading images as
IL_BGRA, but I think that makes the labeling differences even more
confusing. In any case, so long as it's properly documented I'm not sure how
much it matters, as dealing with the order of components isn't the only
transformation that you need to apply when converting from DevIL to Cairo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100601/70bc264b/attachment-0001.htm>


More information about the cairo mailing list