[cairo] Fix for CAIRO_FORMAT_RGB24 pngs

Carl Worth cworth at redhat.com
Thu May 19 11:57:12 PDT 2005


On Wed, 18 May 2005 14:18:43 -0400, Owen Taylor wrote:
> Here's a version that cleans up the rgb => bgr => rgb swapping while
> trying to keep everything conceptually simple. 

Thanks. This looks just fine.

A couple of minor comments, (at most, documentation cleanups), below.

> +/* Unpremultiplies data and converts native endian ARGB => RGBA bytes */

At one point, we had discussed a naming convention for making these
formats more clear. What would you think of the following?

   /* Unpremultiplies data and converts native endian ARGB32 => R8G8B8A8 bytes */

And later:

   /* Converts native endian xRGB32 => R8G8B8x8 bytes */
   /* Premultiplies data and converts R8G8B8A8 bytes => native endian ARGB32 */

Hmm.... a name like R8G8B8A8 is really hard to head. It's just a
jumble of little circle-like shapes. Maybe it would be better to
change the case and go with r8g8b8a8, argb32, etc. ?

> +    if (image->format == CAIRO_FORMAT_ARGB32)
> +	png_set_write_user_transform_fn (png, unpremultiply_data);
> +    else if (image->format == CAIRO_FORMAT_RGB24)
> +	png_set_write_user_transform_fn (png, convert_data_to_bytes);

How about a rename here along the lines of:

	unpremultiply data 	-> transform_argb32
	convert_data_to_bytes	-> transform_rgb24

But feel free to commit the code whenever you'd like.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050519/98932413/attachment.pgp


More information about the cairo mailing list