[cairo] cairo_new_sub_path: Making cairo_arc easier to use and
spitzak at d2.com
Tue Jan 24 12:27:14 PST 2006
Carl Worth wrote:
>>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.
I'm thinking an implicit move_to is a bad idea. The reason is that you
may want to draw "dots" for any move_to that is not followed by another
move_to (or it already does this?). If this is true you don't want to
talk about internal move_to's as they may have to be different than
external ones. Also if the point is at the *start* of the closepath
segment, rather than at the join, this just sounds like a useless bug.
So just to make it clear, I think close_path should be equivalent to:
1. line_to the original point
2. secret stuff to make them mitre together into a loop
>>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.
Yes you are right. There is no need for a "new_sub_path" operator in the
path enumeration. Just change the line_to calls to move_to before
More information about the cairo