Hi,

You could use the following sample

public static final Color getColor(SVGColor svgColor) {
        Color color = null;
        RGBColor rgbColor = svgColor.getRGBColor();
        CSSPrimitiveValue redValue = rgbColor.getRed();
        CSSPrimitiveValue blueValue = rgbColor.getBlue();
        CSSPrimitiveValue greenValue = rgbColor.getGreen();
        float r = redValue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
        float g =
greenValue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
        float b = blueValue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
        color = new Color((int)r,(int)g,(int)b);
        
        return color;
    }

that looks good to me, but I don't know where to get the SVGColor object.
I've got an AbstractElement and can get it's attributes as String.
(It's a SVGRectElement - I suppose).
So where can I get the SVGColor from?

Thx,

   Ludwig Reiter

-- 
View this message in context: 
http://www.nabble.com/Parsing-svg-color-to-java-Color-tf3161121.html#a8804006
Sent from the Batik - Users mailing list archive at Nabble.com.


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

Reply via email to