[cairo] cairo_new_sub_path: Making cairo_arc easier to use and more

Bill Spitzak spitzak at d2.com
Mon Jan 23 14:37:01 PST 2006



Carl Worth wrote:

> 	cairo_public void
> 	cairo_new_sub_path (cairo_t *cr);

Sounds like a great idea. I really like this because it makes it a lot 
easier to emulate other graphics API's on Cairo, ones that work like 
this. It is a lot easier to emulate a PostScript style on top of this 
than the other way around!

Only question I have is the same as another poster: what does close_path 
do? I'm thinking it *should* do a new_sub_path because otherwise you 
would have three lines joining at a point, which you may want to avoid 
having to define the exact results of.

> 	if (has_current_point)
> 	    cairo_line_to (cr, x, y);
> 	else
> 	    cairo_move_to (cr, x, y);
> 
> can become:
> 
> 	cairo_move_to (cr, x, y);

The second example probably should say line_to, not move_to.

I would suggest that move_to be removed entirely from the cairo 
interface, by removing the code from the path-enumeration api and 
replacing it with the new_sub_path code. move_to can be emulated by 
calling new_sub_path and line_to.


More information about the cairo mailing list