[cairo] Direct manipulation and write to PNG

Behdad Esfahbod behdad at behdad.org
Mon Jul 9 12:23:59 PDT 2012


On 07/09/2012 03:16 PM, Carlos López González wrote:
> Can anyone help me to let me know what I'm doing wrong?

The ARGB32 format docs say:

 * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
 *   alpha in the upper 8 bits, then red, then green, then blue.
 *   The 32-bit quantities are stored native-endian. Pre-multiplied
 *   alpha is used. (That is, 50% transparent red is 0x80800000,
 *   not 0x80ff0000.) (Since 1.0)

Which means, on a little-endian system, the in-memory layout is BGRA.  But you
are assuming that it is ARGB in memory.

behdad


More information about the cairo mailing list