Greetings,

I've tried to find information in the archives regarding this issue but didn't find anything.

I'm currently working with some SVG files that have "fill: transparent" css attributes.


These files render correctly on the web-browsers I've tested so far (Chrome, Firefox, MS Edge and Safari), with the respective areas being transparent/blank.

On the other hand, Batik is rendering this image ignoring this attribute, and the same areas are rendered as black. After debugging I've realized that since there isn't a recognized value for this, Batik uses default, which is black.

In order to have the same behavior on Batik, I need to use "fill: none" instead of "fill: transparent".


My current solution for now is to add this constant to CSSConstants.java:

StringCSS_TRANSPARENT_VALUE ="transparent";

In SVGPaintManager.createValue method I just add to the CSS_NONE_VALUE check, the constant I've created, and if it validates, it's treated the same way as a NONE_VALUE.

if (lu.getStringValue().equalsIgnoreCase
    (CSSConstants.CSS_NONE_VALUE) || lu.getStringValue().equalsIgnoreCase
        (CSSConstants.CSS_TRANSPARENT_VALUE)) {
    return SVGValueConstants.NONE_VALUE; }


Would this be a viable solution to support this value on Batik, or is there a better approach? Should we handle "transparent" differently from "none"?

Would it make sense to add this to other AbstractValueManager implementations that use the CSS_NONE_VALUE?


Thank you for your time,

Miguel


Reply via email to