Hello,

I have a huge graph of Java2D objects (java.awt.Shape) which have an
colored outline (BasicStroke) as well as an fillColor. My rendering
process normally looks like that

    Graphics2D.setPaint(fillColor);
    Graphics2D.fill(shape);
    Graphics2D.setPaint(outlineColor);
    Graphics2D.setStroke(shape.getStroke());
    Graphics2D.draw(shape);

When I draw my complete graph in the SVGGraphics2D, I always get the
complete path for every single object twice once for the filling and
once for the outline, which is quite logic as this are 2 different
rendering operations. Therefore the generated XML looks something like that:

      <path id="3" d="M645 687 L645 1649.9999 L2465 1649.9999 L2465 687
Z" style="fill:red;" />
      <path id="3" d="M645 687 L645 1649.9999 L2465 1649.9999 L2465 687
Z" style="fill:none; stroke:black;" />
      <path id="4" d="M645 687 L645 1649.9999 L2465 1649.9999 L2465 687
Z" style="fill:red;" />
      <path id="4" d="M645 687 L645 1649.9999 L2465 1649.9999 L2465 687
Z" style="fill:none; stroke:black;" />

In my case this is quite unnecessary, because I would only need one
entry with the combined style of both entries, like:

      <path id="3" d="M645 687 L645 1649.9999 L2465 1649.9999 L2465 687
Z" style="fill:yellow; stroke:black;" />
      <path id="4" d="M645 687 L645 1649.9999 L2465 1649.9999 L2465 687
Z" style="fill:yellow; stroke:black;" />

Is there a way in Batik to solve this:
The only possibility I see until now, is to define a custom
"org.apache.batik.svggen.StyleHandler" and to check for duplicate id
entries (which are also set in the custom StyleHandler) and to
add all stroke styles of the style attribute of the second element into
the first one, and to remove the second element afterwards (which can
not be done on the fly, because at creation time the parentNode of the
second element is null).
Does anyone have a better solution for my problem?

Thanks
Daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to