[cairo] Fix for CAIRO_FORMAT_RGB24 pngs

Bill Spitzak spitzak at d2.com
Thu May 19 13:54:29 PDT 2005


I would have *no* suffix indicate that the bytes are in the given order 
in memory. So RGB means R is in the first byte, G in the second, B in 
the third.

A number suffix indicates that it is this many bits, and the bytes are 
in endianess-order. So RGB24 is the same as BGR on a little-endian 
machine, and RGB on a big-endian one. RGB32 is the same as BGR_ on a 
little-endian machine and _RGB on a big-endian one.

A one-channel image would be "A8" to avoid calling it just "A".

The channel letters can be R,G,B,A. It may be useful to substitue 'M' 
(matte) for 'A' to indicate non-premultiplied data. Also '_' indicates 
an unused byte.

Though not necessary now, suffixes could also indicate the type of all 
previous data, if it is not bytes:

s = The data is 16-bit unsigned
l = The data is 32-bit unsigned
h = The data is 16-bit ILM floating-point "half" format
f = The data is 32-bit floating-point
d = The data is 64-bit floating-point

Mixed types could be indicated by imbedding suffixes. For instance RGBfA 
may indicate floating-point RGB and 8-bit alpha.

Only a tiny subset needs to be supported. The following are all the 
layouts I have seen in common use:

A8
RGB
BGR
RGB24
RGB_
BGR_
RGB32
RGBA
BGRA
ARGB32
RGBA32
ARGB
ABGR
RGBM
BGRM
MRGB32
RGBM32
MRGB
MBGR



More information about the cairo mailing list