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

Carl Worth cworth at cworth.org
Mon Jan 23 18:08:52 PST 2006


On Mon, 23 Jan 2006 14:37:01 -0800, Bill Spitzak wrote:
> 
> 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!

Thanks. The concept seems fairly well accepted so far.

Already there have been a couple of complaints (on and off list) about
the name, but I don't have a good substitute yet.

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

Oh, in that sense, yes, it does need to start a new sub path.

I suppose it could still preserve the current point after the
close_path, (in which case we could define it as doing an implicit
move_to at the end).

Or we could just decide that preserving the current point after close
path was a bug and we could make it to the new_sub_path.

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

Yes, my mistake.

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

Aside from compatibility problems, this would actually be "harder" for
the user to deal with. With move_to and line_to, (and the documented
rule that all line_to calls after a new_sub_path will be turned into a
move_to), there is an unambiguous meaning for each operation. With an
exposed new_sub_path the user would be required to maintain more state
in order to handle two different actions for line_to.

-Carl


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060123/50ae19a9/attachment.pgp


More information about the cairo mailing list