Hi,
okay, that solves the problem. Thank you.
Ludwig Reiter
Bishop, Michael W. CONTR J9C880 wrote:
>
> Here's what I use. It's very similar. I think this came from the list
> as well:
>
> /**
> * Returns the color of the given attribute in the given element.
> *
> * @param element An element with color attributes.
> * @param attribute The name of the attribute (fill, stroke, etc.)
> *
> * @return An instance of Color.
> */
> public static Color getColor(Element element, String attribute) {
> Color returnColor = null;
> final Document document = element.getOwnerDocument();
> final ViewCSS viewCSS = (ViewCSS) document.getDocumentElement();
> final CSSStyleDeclaration computedStyle =
> viewCSS.getComputedStyle(element, null);
> final SVGPaint svgPaint =
> (SVGPaint) computedStyle.getPropertyCSSValue(attribute);
>
> if (svgPaint.getPaintType() == SVGPaint.SVG_PAINTTYPE_RGBCOLOR)
> {
> final RGBColor rgb = svgPaint.getRGBColor();
> final float red =
>
> rgb.getRed().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE);
> final float green =
>
> rgb.getGreen().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE);
> final float blue =
>
> rgb.getBlue().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE);
> returnColor = new Color(red / 255, green / 255, blue / 255);
> }
>
> return returnColor;
> }
>
> Michael Bishop
>
--
View this message in context:
http://www.nabble.com/Parsing-svg-color-to-java-Color-tf3161121.html#a8823243
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]