Package org.apache.batik.css

Examples of org.apache.batik.css.CSSOMReadOnlyStyleDeclaration


     * @param ctx the bridge context
     */
    public static Paint convertFillPaint(Element filledElement,
                                         GraphicsNode filledNode,
                                         BridgeContext ctx) {
        CSSOMReadOnlyStyleDeclaration decl =
            CSSUtilities.getComputedStyle(filledElement);
        // 'fill-opacity'
        float opacity = convertOpacity
            (decl.getPropertyCSSValueInternal(CSS_FILL_OPACITY_PROPERTY));
        // 'fill'
        CSSValue paintDef = decl.getPropertyCSSValueInternal(CSS_FILL_PROPERTY);

        return convertPaint(filledElement,
                            filledNode,
                            paintDef,
                            opacity,
View Full Code Here


                                              paintedNode,
                                              (SVGPaint)paintDef,
                                              opacity,
                                              ctx);
                if (paint == null) { // no paint found
                    CSSOMReadOnlyStyleDeclaration decl =
                        CSSUtilities.getComputedStyle(paintedElement);
                    CSSValue v
                        = decl.getPropertyCSSValueInternal(CSS_COLOR_PROPERTY);
                    paint =  convertColor
                        (((CSSPrimitiveValue)v).getRGBColorValue(), opacity);
                }
                return paint;
            case SVGPaint.SVG_PAINTTYPE_URI_RGBCOLOR:
View Full Code Here

                                       BridgeContext ctx) {

        // percentages and units are relative to the strokedElement's viewport
        UnitProcessor.Context uctx
            = UnitProcessor.createContext(ctx, strokedElement);
        CSSOMReadOnlyStyleDeclaration decl
            = CSSUtilities.getComputedStyle(strokedElement);
        CSSValue v;

        v = decl.getPropertyCSSValueInternal(CSS_STROKE_WIDTH_PROPERTY);
        float width = UnitProcessor.cssOtherLengthToUserSpace
            (v, CSS_STROKE_WIDTH_PROPERTY, uctx);

        v = decl.getPropertyCSSValueInternal(CSS_STROKE_LINECAP_PROPERTY);
        int linecap = convertStrokeLinecap((CSSPrimitiveValue)v);

        v = decl.getPropertyCSSValueInternal(CSS_STROKE_LINEJOIN_PROPERTY);
        int linejoin = convertStrokeLinejoin((CSSPrimitiveValue)v);

        v = decl.getPropertyCSSValueInternal(CSS_STROKE_MITERLIMIT_PROPERTY);
        float miterlimit = convertStrokeMiterlimit((CSSPrimitiveValue)v);

        v = decl.getPropertyCSSValueInternal(CSS_STROKE_DASHARRAY_PROPERTY);
        float [] dasharray = convertStrokeDasharray(v, uctx);

        float dashoffset = 0;
        if (dasharray != null) {
            v = decl.getPropertyCSSValueInternal
                (CSS_STROKE_DASHOFFSET_PROPERTY);
            dashoffset = UnitProcessor.cssOtherLengthToUserSpace
                (v, CSS_STROKE_DASHOFFSET_PROPERTY, uctx);
        }
        return new BasicStroke(width,
View Full Code Here

     */
    public static
        Rectangle2D convertEnableBackground(Element e,
                                            UnitProcessor.Context uctx) {

        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSValue v
            = decl.getPropertyCSSValueInternal(CSS_ENABLE_BACKGROUND_PROPERTY);
        if (v.getCssValueType() != v.CSS_VALUE_LIST) {
            return null; // accumulate
        }
        CSSValueList l = (CSSValueList)v;
        int length = l.getLength();
View Full Code Here

     * @param e the element
     */
    public static MultipleGradientPaint.ColorSpaceEnum
        convertColorInterpolation(Element e) {

        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSPrimitiveValue v
            = (CSSPrimitiveValue) decl.getPropertyCSSValueInternal
            (CSS_COLOR_INTERPOLATION_PROPERTY);

        return CSS_LINEARRGB_VALUE.equals(v.getStringValue())
            ? MultipleGradientPaint.LINEAR_RGB
            : MultipleGradientPaint.SRGB;
View Full Code Here

     * none has been specified. Checks the 'shape-rendering' property.
     *
     * @param e the element
     */
    public static Map convertShapeRendering(Element e) {
        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSPrimitiveValue v = (CSSPrimitiveValue)
            decl.getPropertyCSSValueInternal(CSS_SHAPE_RENDERING_PROPERTY);
        String s = v.getStringValue();
        if (s.charAt(0) == 'a') { // auto
            return null;
        }
        Map hints = new HashMap();
View Full Code Here

     * none has been specified. Checks the 'text-rendering' property.
     *
     * @param e the element
     */
    public static Map convertTextRendering(Element e) {
        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSPrimitiveValue v = (CSSPrimitiveValue)
            decl.getPropertyCSSValueInternal(CSS_TEXT_RENDERING_PROPERTY);
        String s = v.getStringValue();
        if (s.charAt(0) == 'a') { // auto
            return null;
        }
        Map hints = new HashMap();
View Full Code Here

     * none has been specified. Checks the 'image-rendering' property.
     *
     * @param e the element
     */
    public static Map convertImageRendering(Element e) {
        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSPrimitiveValue v = (CSSPrimitiveValue)
            decl.getPropertyCSSValueInternal(CSS_IMAGE_RENDERING_PROPERTY);
        String s = v.getStringValue();
        if (s.charAt(0) == 'a') { // auto
            return null;
        }
        Map hints = new HashMap();
View Full Code Here

     * none has been specified. Checks the 'color-rendering' property.
     *
     * @param e the element
     */
    public static Map convertColorRendering(Element e) {
        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSPrimitiveValue v = (CSSPrimitiveValue)
            decl.getPropertyCSSValueInternal(CSS_COLOR_RENDERING_PROPERTY);
        String s = v.getStringValue();
        if (s.charAt(0) == 'a') { // auto
            return null;
        }
        Map hints = new HashMap();
View Full Code Here

     * otherwise. Checks the 'display' property.
     *
     * @param e the element
     */
    public static boolean convertDisplay(Element e) {
        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSValue v = decl.getPropertyCSSValueInternal(CSS_DISPLAY_PROPERTY);
        return (((CSSPrimitiveValue)v).getStringValue().charAt(0) != 'n');
    }
View Full Code Here

TOP

Related Classes of org.apache.batik.css.CSSOMReadOnlyStyleDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.