Hi Nick.

Nick Hebner:
> I am a noob batik user and I am probably missing something simple. What I am
> trying to do is to calculate the total composite path length of all paths
> having a stroke-width 0.01 or less within a given document. So far, I have
> been successful in loading the document, building a GVT tree, iterating
> through it to create a composite path, and using the PathLength class to
> calculate the length. What I cannot figure out is how to check the
> stroke-width of a given path in the GVT tree. How can I accomplish this?

>From the ShapeNode, you can get its ShapePainter.  If it is a
StrokeShapePainter, then you can get its java.awt.Stroke (which should
be a java.awt.BasicStroke; on which you can call getLineWidth()).
Otherwise, if it is CompositeShapePainter, then it could have a
StrokePainter in it.  Otherwise, the shape isn’t stroked.

Or, if you wanted to work on the SVG DOM instead, you could traverse the
document tree and call window.getComputedStyle() on each <path>/whatever
element to determine the value of its ‘stroke-width’ property.

-- 
Cameron McCormack ≝ http://mcc.id.au/

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org

Reply via email to