Re: [LIBART] Working on new canvas item...



Hello!

> >    Hmmm.  Should I explicitly start the path with an ART_MOVETO_OPEN
> > instead of an ART_MOVETO, given that it is an unclosed path?  Or will
> > it make any difference?

It should make a difference, although I am not 100¨† ¨†@ure, how libart
handles stroking closed paths whose start != end. Anyway, ART_MOVETO_OPEN
is certainly the right thing.

>    Yes, actually, it helped quite a bit.  I'm getting things that look
> more or less like a pricebar now, but still getting the occasional one
> that has a large block attached to it.  I suspect this is related to
> the debugging output I'm getting along with it, where I'm getting a
> bunch of messages of the form:
> 
> colinear!
> colinear!
<snip>

Try inserting:

perturbed_vpath = art_vpath_perturb (vpath);

Before stroking your vpath. Libart (at least the one distributed with
gnome-libs) is not always happy with straight
horizontal/vertical lines - perturb make these slanted, adding
microscopic disturbances to points.

>    And so on.  These appear to be coming from subroutines contained
> in the file art_svp_wind.c, but I can't clearly tell what those two
> routines (x_order and x_order_2) are doing.  Now, the problem may
> be due to the values I'm passing to art_svp_vpath_stroke(), also.
> I'm using:
> 
> art_svp_vpath_stroke( vpath2,
>             ART_PATH_STROKE_JOIN_MITER,
>             ART_PATH_STROKE_CAP_SQUARE,
>             pbar->width, 1.0, 1.0 );
> 
>    I simply dropped in 1.0 for the miter_limit and flatness values,
> not knowing what would be rational numbers.  Given that the object
> I'm drawing is just a set of straight lines, which will always be
> rectilinear, what would be the cleanest and most efficient values
> to pass, here?

Those shouldn't make any difference.
Miter-limit is minimum angle between segments, with results mitered
join. Usual is 11.0 or similar - that gives visually pleasant picture,
without long triangles stretching out from picture.
Flatness should determine, how well rounded corners and endpoints
are generated. Usual value is 0.25 - but is you have miter/bevel/square/
butt it does not make difference.

Lauris






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]