[cairo] API Shakeup: cairo_fill_preserve, cairo_stroke_preserve, cairo_clip_preserve

Owen Taylor otaylor at redhat.com
Tue Apr 19 05:17:17 PDT 2005


On Tue, 2005-04-19 at 08:07 -0400, Owen Taylor wrote:
> On Tue, 2005-04-19 at 15:28 +1000, Carl Worth wrote:
> 

> Or you could do:
> 
> 	create_the_path (cr);
> 
> 	set_paint_for_fill (cr);
>         cairo_fill_preserve (cr);
> 
> 	if (stroking) {
> 	    set_paint_for_stroke (cr);
> 	    cairo_stroke_preserve (cr);
> 	}
> 
>         cairo_new_path ();
> 
> right?

Ignore that mail :-) I thought you were talking about
the (somewhat ugly) conditionalization of stroke() vs.
stroke_preserve() in your example.
  
I agree that save()/set_target_surface()/restore()
is something we don't have to worry about ... but what
about the group API? Aren't we going to have the same
problem there?

What you could do is:

 cairo_begin_group (cr);
 <draw the fill pattern>
 fill_pattern = cairo_end_group (cr);

 cairo_begin_group (cr);
 <draw the stroke pattern>
 stroke_pattern = cairo_end_group (cr);

 <draw the path> 

 cairo_set_source (cr, fill_pattern);
 cairo_fill_preserve (cr);
 
 cairo_set_source (cr, stroke_pattern);
 cairo_stroke (cr);
 
 cairo_pattern_destroy (fill_pattern);
 cairo_pattern_destroy (stroke_pattern);

Which is probably fine for an unusual operation. (Since
the group API is only useful for non-repeating masking of
a source, not repeating fills)

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/20050419/5bdfc2b6/attachment.pgp


More information about the cairo mailing list