[cairo] Fix for CAIRO_FORMAT_RGB24 pngs

Owen Taylor otaylor at redhat.com
Thu Jun 23 13:00:46 PDT 2005


On Thu, 2005-05-19 at 11:57 -0700, Carl Worth wrote:
> 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. ?

That doesn't really help us establish a convention for cairo_format_t .

> > +    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.

To be better, it would need to be something like

 transform_argb32_premult_a8r8g8b8
 transform_a8r8g8b8_argb32_premult

Which are a little too ugly for me. I think I'll just leave things the
way they are in advance of a standard.

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/20050623/43b1e60b/attachment.pgp


More information about the cairo mailing list