[cairo] [PATCH] add cairo_image_surface_create_with_masks to API

Carl Worth cworth at east.isi.edu
Tue Feb 17 18:19:16 PST 2004


On Feb 9, John K Luebs wrote:
 > Attached is a patch that makes cairo_image_surface_create_with_masks
 > part of the externally visible API. This allows one to render
 > directly to almost any pixman supported image format.
 > 
 > This function seems like a clean way to access the general RGB API of
 > pixman and thus has utility to application developers using cairo.

Hi John,

Thanks for your contribution.

The intent of the patch is good, and it might be just the thing we
need.

At first glance there is one thing I don't like: the patch introduces
two separate means for describing an image format, (the cairo_format_t
enum and the cairo_format_masks_t structure). In one sense, it would
be cleaner to have a single way to describe an image format, (which
could then be accepted anywhere a format is expected).

But, the downside of adding a fully generic image format everywhere
would be that it is "hard" for some backends to support some
formats. So some backends would probably defer to using the image
surface backend along with image transport (think, slow). Having a
backend with some slow formats and some fast formats is not
lovely. Adding query functions to find preferred formats doesn't help
much, (if past experience is any indication), as these functions are
usually ignored, so they just add clutter.

The current patch avoids all that mess by forcing the user to
explicitly use the image surface backend in order to get access to the
fully generic image format.

Then, we could still add new formats to the cairo_format_t if a
particular backend wants to accelerate something that's not there yet.

Does that sound reasonable?

-Carl




More information about the cairo mailing list