Hi,

On Thu, 2006-02-02 at 15:26 -0500, James Balnaves wrote:
> When I try this, the CSSStyleDeclaration ends up containing an
> "element" member of type SVGOMPathElement that has attributes "fill"
> and "d", but the CSSStyleDeclaration "values" member HashMap is empty.
> When I call style.getPropertyCSSValue("stroke") I get a null pointer
> exception, even though this value exists up in the main svg element.

How about something like this
ViewCSS viewCSS =
(ViewCSS)element.getOwnerDocument().getDocumentElement();
CSSStyleDeclaration computedStyle =
viewCSS.getComputedStyle(element,null);
SVGPaint svgPaint =
(SVGPaint)computedStyle.getPropertyCSSValue(SVGConstants.SVG_STROKE_ATTRIBUTE);
Color color = null;
if (svgPaint.getPaintType() == SVGPaint.SVG_PAINTTYPE_RGBCOLOR) {
RGBColor rgbColor = svgPaint.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);                            
} else if (svgPaint.getPaintType() ==
SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) {
        // this is the color keyword eg: black, blue, green, aliceblue,etc
        // please check with the SVG / CSS Dom for the exact RGB value for this
color keyword
                            } else if (svgPaint.getPaintType() ==
SVGPaint....) {

 
Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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

Reply via email to