[cairo] API Shakeup: cairo_begin_group, cairo_end_group, cairo_get_group

Bill Spitzak spitzak at d2.com
Thu Jun 23 10:19:38 PDT 2005



Carl Worth wrote:
> On Thu, 16 Jun 2005 14:35:09 -0700, Bill Spitzak wrote:
>>>	void
>>>	cairo_begin_pattern_with_format (cairo_t *cr, cairo_format_t format);
>>
>>Is the purpose of the format so that you can choose whether alpha is 
>>stored or not? From a user's point of view it would help a lot if 
>>drawing an opaque rectangular image in the default format resulted in 
>>equal speed and efficiency as doing this.
> 
> 
> Here, the format is intended to specify one of three different modes
> for what the pattern will store:
> 
> 	Color only
> 	Alpha only
> 	Color and alpha

That's what I thought. What I was asking is that the API figure this out 
automatically from what is drawn. If the resulting image is opaque 
everywhere, it should be equally efficient to use this result as to use 
one that is specified ahead of time (alpha-only is indicated by the 
resulting image being black everywhere). If this is not true it is a 
real pain for some cases where other code is drawing the pattern. In my 
example I want to draw images from files, and whether they have alpha is 
not determined until after the file is opened and drawn.

But furthermore, it may be that there is no need for the with-format 
call. I would expect that making the drawing check to see if the 
destination has less than 4 channels may be less efficient that using 
those 4 channels and throwing away the unnecessary ones later. So the 
implementation would probably not do anything with the format until the 
pattern is done. In this case it would be much more useful for that API 
if this decision was done after the drawing. But rather than add another 
call, using cairo_paint to clear the color to black or the alpha to 
white could be used to indicate this.

This would remove one API from Cairo, which you seem to be interested in 
doing, and would remove the need to add this new type to indicate the 
necessary channels. It would also mean that users would not worry about 
whether they have to use this call to get the most efficient result.



More information about the cairo mailing list