[cairo] cairo reset
mike.emmel at gmail.com
Tue Sep 26 20:37:49 PDT 2006
On 9/26/06, Vladimir Vukicevic <vladimir at pobox.com> wrote:
> On 9/22/06, Mike Emmel <mike.emmel at gmail.com> wrote:
> > Maybe for me the biggest grip is when the path is not valid.
> > I think the answer is that CAIRO_STATUS_NO_CURRENT_POINT
> > should not be fatal but the return value for the functions that cause it.
> > Since they can always catch it and set a current point.
> > Or fix the current point bug I mentioned to return this
> > and the user can ensure the path is valid.
> > The real world case is generally you can have a lot of different code
> > adding to the
> > current path without knowing what the current path is.
> > I think its simpler to always have the moveto 0 0 in the base state.
> > And the only place where you get a NO_CURRENT_POINT is in
> > the get_current_point call if the user has never set path data.
> > Then we never have this error. Note initializing the path to 0 0
> > simply leads to
> > problems IMHO.
> moveto 0 0 actually causes problems; we tried this with <canvas>, and
> it caused a whole bunch of problems. See
> https://bugzilla.mozilla.org/show_bug.cgi?id=296763#c10 -- if an
> initial move_to(0,0) was added, then cairo_arc would have to change,
> and that's way too much for no real benefit.
> The methods that return CAIRO_STATUS_NO_CURRENT_POINT are all relative
> moveto/lineto/etc. methods. If you are calling one of those methods,
> it's an error if there is no current point. The real world use case
> you suggest is bogus; if you are using relative methods without
> knowing whether there is a current point, then the logic of your
> program is broken. Otherwise, there is no problem --
> get_current_point by itself will just return 0,0 if there is no
> current point, right?
Except the cairo api right now has no way to determine it if there is
a current point or not.
I don't agree with you about it being broken. Read the SVG spec.
There is no mention of errors on starting with a relative version on
nor the concept of no path. They start at 0,0
Now it makes sense to decide were the start condition is in some other cases.
In the case of lineto it was chosen to do a moveto if no current point.
Move to 00 might not be the best solution for all cases a circle is a
where you would I assume place it in the top left corner. I'd argue
that its a polygon and
falls under the intial lineto case which in the case of a circle
results in a non 00 moveto.
This actually suppports the decision to make a lineto with no point a moveto.
The general case would be to consider the flattened operation and
determine the sensible
There is no error condition.
> - Vlad
More information about the cairo