Examples of SVGLength


Examples of org.w3c.dom.svg.SVGLength

        this.name = "svg:svg";
    }

    public SVGElement createGraphic() {
        SVGSVGElementImpl svgArea = null;
        SVGLength w = ((SVGLengthProperty) this.properties.get("width")).
                      getSVGLength();
        SVGLength h = ((SVGLengthProperty) this.properties.get("height")).
                      getSVGLength();
        svgArea = new SVGSVGElementImpl();
        SVGAnimatedLengthImpl sal;
        if (w == null)
            w = new SVGLengthImpl();
        sal = new SVGAnimatedLengthImpl(w);
        sal.setBaseVal(w);
        svgArea.setWidth(sal);
        if (h == null)
            h = new SVGLengthImpl();
        sal = new SVGAnimatedLengthImpl(h);
        sal.setBaseVal(h);
        svgArea.setHeight(sal);
        SVGLength lengthProp =
          ((SVGLengthProperty) this.properties.get("x")).
          getSVGLength();
        SVGLength x = lengthProp == null ? new SVGLengthImpl() : lengthProp;
        sal = new SVGAnimatedLengthImpl(x);
        sal.setBaseVal(x);
        svgArea.setX(sal);
        lengthProp = ((SVGLengthProperty) this.properties.get("y")).
                     getSVGLength();
        SVGLength y = lengthProp == null ? new SVGLengthImpl() : lengthProp;
        sal = new SVGAnimatedLengthImpl(y);
        sal.setBaseVal(y);
        svgArea.setY(sal);

        svgArea.setStyle(
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

            int fontSize =
              this.properties.get("font-size").getLength().mvalue();

            this.fs = new FontState(area.getFontInfo(), fontFamily,
                                    fontStyle, fontWeight, fontSize);
            SVGLength length;
            length = ((SVGLengthProperty) this.properties.get("width")).
                     getSVGLength();
            if (length == null)
                length = new SVGLengthImpl();
            this.width = length.getValue();
            length = ((SVGLengthProperty) this.properties.get("height")).
                     getSVGLength();
            if (length == null)
                length = new SVGLengthImpl();
            this.height = length.getValue();

            this.marker = 0;
        }

        /* create an SVG area */
 
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

                textGraph.appendChild(cd);
            }
            //      System.out.println(child);
        }
        /* retrieve properties */
        SVGLength prop;
        prop = ((SVGLengthProperty) this.properties.get("x")).getSVGLength();
        textGraph.x = prop == null ? 0 : prop.getValue();
        prop = ((SVGLengthProperty) this.properties.get("y")).getSVGLength();
        textGraph.y = prop == null ? 0 : prop.getValue();
        //    textGraph.textList = textList;
        textGraph.setStyle(
          ((SVGStyle) this.properties.get("style")).getStyle());
        textGraph.setTransform(
          ((SVGTransform) this.properties.get("transform")).
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

        this.name = "svg:image";
    }

    public SVGElement createGraphic() {
        String link = this.properties.get("xlink:href").getString();
        SVGLength length;
        length = ((SVGLengthProperty) this.properties.get("x")).
                 getSVGLength();
        if (length == null)
            length = new SVGLengthImpl();
        float x = length.getValue();
        length = ((SVGLengthProperty) this.properties.get("y")).
                 getSVGLength();
        if (length == null)
            length = new SVGLengthImpl();
        float y = length.getValue();
        length = ((SVGLengthProperty) this.properties.get("width")).
                 getSVGLength();
        if (length == null)
            length = new SVGLengthImpl();
        float width = length.getValue();
        length = ((SVGLengthProperty) this.properties.get("height")).
                 getSVGLength();
        if (length == null)
            length = new SVGLengthImpl();
        float height = length.getValue();
        SVGImageElementImpl graph =
          new SVGImageElementImpl(link, x, y, width, height);
        graph.setStyle(
          ((SVGStyle) this.properties.get("style")).getStyle());
        graph.setId(this.properties.get("id").getString());
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

            }
            ref = (SVGPatternElement) locateDef(
                    ref.getHref().getBaseVal(), ref);
        }
        if (x == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0);
            x = new SVGAnimatedLengthImpl(length);
        }
        if (y == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0);
            y = new SVGAnimatedLengthImpl(length);
        }
        if (width == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1);
            width = new SVGAnimatedLengthImpl(length);
        }
        if (height == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1);
            height = new SVGAnimatedLengthImpl(length);
        }

        StringWriter realStream = currentStream;
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

            }
            ref = (SVGLinearGradientElement) locateDef(
                    ref.getHref().getBaseVal(), ref);
        }
        if (ax1 == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0);
            ax1 = new SVGAnimatedLengthImpl(length);
        }
        if (ax2 == null) {
            // if x2 is not specified then it should be 100%
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1);
            ax2 = new SVGAnimatedLengthImpl(length);
        }
        if (ay1 == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0);
            ay1 = new SVGAnimatedLengthImpl(length);
        }
        if (ay2 == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0);
            ay2 = new SVGAnimatedLengthImpl(length);
        }
        SVGAnimatedTransformList an = linear.getGradientTransform();
        SVGMatrix transform = null;
        if(an != null)
            transform = an.getBaseVal().consolidate().getMatrix();
        Vector theCoords = null;
        if (gradUnits == SVGUnitTypes.SVG_UNIT_TYPE_UNKNOWN)
            gradUnits = linear.getGradientUnits().getBaseVal();
        // spread: pad (normal), reflect, repeat
        spread = linear.getSpreadMethod().getBaseVal();
        if (gradUnits == SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE) {
            if (area instanceof SVGTransformable) {
                SVGTransformable tf = (SVGTransformable) area;
                double x1, y1, x2, y2;
                x1 = ax1.getBaseVal().getValue();
                y1 = -ay1.getBaseVal().getValue();
                x2 = ax2.getBaseVal().getValue();
                y2 = -ay2.getBaseVal().getValue();
                SVGMatrix matrix = tf.getScreenCTM();
                if(transform != null)
                    matrix = matrix.multiply(transform);
                double oldx = x1;
                x1 = matrix.getA() * x1 + matrix.getC() * y1 +
                     matrix.getE();
                y1 = matrix.getB() * oldx + matrix.getD() * y1 -
                     matrix.getF();
                oldx = x2;
                x2 = matrix.getA() * x2 + matrix.getC() * y2 +
                     matrix.getE();
                y2 = matrix.getB() * oldx + matrix.getD() * y2 -
                     matrix.getF();
                theCoords = new Vector();
                if (spread == SVGGradientElement.SVG_SPREADMETHOD_REFLECT) {
                } else if (spread ==
                    SVGGradientElement.SVG_SPREADMETHOD_REFLECT) {
                } else {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f + x1));
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f + y1));
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f + x2));
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f + y2));
                }
            }
        } else if (area instanceof GraphicElement) {
            SVGRect rect = ((GraphicElement) area).getBBox();
            if (rect != null) {
                theCoords = new Vector();
                SVGLength val;
                val = ax1.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f +
                                 rect.getX() +
                                 val.getValue() * rect.getWidth()));
                } else {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f +
                                 val.getValue()));
                }
                val = ay1.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f -
                                 rect.getY() -
                                 val.getValue() * rect.getHeight()));
                } else {
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f -
                                 val.getValue()));
                }
                val = ax2.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f +
                                 rect.getX() +
                                 val.getValue() * rect.getWidth()));
                } else {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f +
                                 val.getValue()));
                }
                val = ay2.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f -
                                 rect.getY() -
                                 val.getValue() * rect.getHeight()));
                } else {
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f -
                                 val.getValue()));
                }
            }
        }
        if (theCoords == null) {
            theCoords = new Vector();
            theCoords.addElement( new Double(currentXPosition / 1000f +
                                             ax1.getBaseVal().getValue()));
            theCoords.addElement( new Double(currentYPosition / 1000f -
                                             ay1.getBaseVal().getValue()));
            theCoords.addElement( new Double(currentXPosition / 1000f +
                                             ax2.getBaseVal().getValue()));
            theCoords.addElement( new Double(currentYPosition / 1000f -
                                             ay2.getBaseVal().getValue()));
        }

        Vector theExtend = new Vector();
        theExtend.addElement(new Boolean(true));
        theExtend.addElement(new Boolean(true));

        Vector theDomain = new Vector();
        theDomain.addElement(new Double(0));
        theDomain.addElement(new Double(1));

        Vector theEncode = new Vector();
        theEncode.addElement(new Double(0));
        theEncode.addElement(new Double(1));
        theEncode.addElement(new Double(0));
        theEncode.addElement(new Double(1));

        Vector theBounds = new Vector();
        theBounds.addElement(new Double(0));
        theBounds.addElement(new Double(1));

        Vector theFunctions = new Vector();

        NodeList nl = stops;
        Vector someColors = new Vector();
        float lastoffset = 0;
        Vector lastVector = null;
        SVGStopElementImpl stop;
        if (nl.getLength() == 0) {
            // the color should be "none"
            if (fill)
                di.fill = false;
            else
                di.stroke = false;
            return;
        } else if (nl.getLength() == 1) {
            stop = (SVGStopElementImpl) nl.item(0);
            CSSValue cv = stop.getPresentationAttribute("stop-color");
            if (cv == null) {
                // maybe using color
                cv = stop.getPresentationAttribute("color");
            }
            if (cv == null) {
                // problems
                MessageHandler.errorln("no stop-color or color in stop element");
                return;
            }
            PDFColor color = new PDFColor(0, 0, 0);
            if (cv != null &&
                    cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                if (((CSSPrimitiveValue) cv).getPrimitiveType() ==
                        CSSPrimitiveValue.CSS_RGBCOLOR) {
                    RGBColor col =
                      ((CSSPrimitiveValue) cv).getRGBColorValue();
                    CSSPrimitiveValue val;
                    val = col.getRed();
                    float red = val.getFloatValue(
                                  CSSPrimitiveValue.CSS_NUMBER);
                    val = col.getGreen();
                    float green = val.getFloatValue(
                                    CSSPrimitiveValue.CSS_NUMBER);
                    val = col.getBlue();
                    float blue = val.getFloatValue(
                                   CSSPrimitiveValue.CSS_NUMBER);
                    color = new PDFColor(red, green, blue);
                }
            }
            currentStream.write(color.getColorSpaceOut(fill));
            if (fill)
                di.fill = true;
            else
                di.stroke = true;
            return;
        }
        for (int count = 0; count < nl.getLength(); count++) {
            stop = (SVGStopElementImpl) nl.item(count);
            CSSValue cv = stop.getPresentationAttribute("stop-color");
            if (cv == null) {
                // maybe using color
                cv = stop.getPresentationAttribute("color");
            }
            if (cv == null) {
                // problems
                MessageHandler.errorln("no stop-color or color in stop element");
                continue;
            }
            PDFColor color = new PDFColor(0, 0, 0);
            if (cv != null &&
                    cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                if (((CSSPrimitiveValue) cv).getPrimitiveType() ==
                        CSSPrimitiveValue.CSS_RGBCOLOR) {
                    RGBColor col =
                      ((CSSPrimitiveValue) cv).getRGBColorValue();
                    CSSPrimitiveValue val;
                    val = col.getRed();
                    float red = val.getFloatValue(
                                  CSSPrimitiveValue.CSS_NUMBER);
                    val = col.getGreen();
                    float green = val.getFloatValue(
                                    CSSPrimitiveValue.CSS_NUMBER);
                    val = col.getBlue();
                    float blue = val.getFloatValue(
                                   CSSPrimitiveValue.CSS_NUMBER);
                    color = new PDFColor(red, green, blue);
                    currentColour = color;
                }
            }
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

            }
            ref = (SVGRadialGradientElement) locateDef(
                    ref.getHref().getBaseVal(), ref);
        }
        if (acx == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f);
            acx = new SVGAnimatedLengthImpl(length);
        }
        if (acy == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f);
            acy = new SVGAnimatedLengthImpl(length);
        }
        if (ar == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1);
            ar = new SVGAnimatedLengthImpl(length);
        }
        if (afx == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f);
            afx = new SVGAnimatedLengthImpl(length);
        }
        if (afy == null) {
            SVGLength length = new SVGLengthImpl();
            length.newValueSpecifiedUnits(
              SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f);
            afy = new SVGAnimatedLengthImpl(length);
        }
        ColorSpace aColorSpace = new ColorSpace(ColorSpace.DEVICE_RGB);
        org.w3c.dom.NodeList nl = stops;
        SVGStopElementImpl stop;
        if (nl.getLength() == 0) {
            // the color should be "none"
            if (fill)
                di.fill = false;
            else
                di.stroke = false;
            return;
        } else if (nl.getLength() == 1) {
            stop = (SVGStopElementImpl) nl.item(0);
            CSSValue cv = stop.getPresentationAttribute("stop-color");
            if (cv == null) {
                // maybe using color
                cv = stop.getPresentationAttribute("color");
            }
            if (cv == null) {
                // problems
                MessageHandler.errorln("no stop-color or color in stop element");
                return;
            }
            PDFColor color = new PDFColor(0, 0, 0);
            if (cv != null &&
                    cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                if (((CSSPrimitiveValue) cv).getPrimitiveType() ==
                        CSSPrimitiveValue.CSS_RGBCOLOR) {
                    RGBColor col =
                      ((CSSPrimitiveValue) cv).getRGBColorValue();
                    CSSPrimitiveValue val;
                    val = col.getRed();
                    float red = val.getFloatValue(
                                  CSSPrimitiveValue.CSS_NUMBER);
                    val = col.getGreen();
                    float green = val.getFloatValue(
                                    CSSPrimitiveValue.CSS_NUMBER);
                    val = col.getBlue();
                    float blue = val.getFloatValue(
                                   CSSPrimitiveValue.CSS_NUMBER);
                    color = new PDFColor(red, green, blue);
                }
            }
            currentStream.write(color.getColorSpaceOut(fill));
            if (fill)
                di.fill = true;
            else
                di.stroke = true;
            return;
        }
        Hashtable table = null;
        Vector someColors = new Vector();
        Vector theCoords = null;
        Vector theBounds = new Vector();
        // the coords should be relative to the current object
        // check value types, eg. %
        if (gradUnits == SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE) {
            if (area instanceof SVGTransformable) {
                SVGTransformable tf = (SVGTransformable) area;
                double x1, y1, x2, y2;
                x1 = acx.getBaseVal().getValue();
                y1 = -acy.getBaseVal().getValue();
                x2 = afx.getBaseVal().getValue();
                y2 = -afy.getBaseVal().getValue();
                SVGMatrix matrix = tf.getScreenCTM();
                double oldx = x1;
                x1 = matrix.getA() * x1 + matrix.getB() * y1 +
                     matrix.getE();
                y1 = matrix.getC() * oldx + matrix.getD() * y1 +
                     matrix.getF();
                oldx = x2;
                x2 = matrix.getA() * x2 + matrix.getB() * y2 +
                     matrix.getE();
                y2 = matrix.getC() * oldx + matrix.getD() * y2 +
                     matrix.getF();
                theCoords = new Vector();
                //        if(spread == SVGGradientElement.SVG_SPREADMETHOD_REFLECT) {
                //        } else if(spread== SVGGradientElement.SVG_SPREADMETHOD_REFLECT) {
                //        } else {
                theCoords.addElement(
                  new Double(currentXPosition / 1000f + x1));
                // the y val needs to be adjust by 2 * R * rotation
                // depending on if this value is from an x or y coord
                // before transformation
                theCoords.addElement(
                  new Double(currentYPosition / 1000f - y1 +
                             (matrix.getC() - matrix.getD()) * 2 *
                             ar.getBaseVal().getValue()));
                theCoords.addElement(new Double(0));
                theCoords.addElement(
                  new Double(currentXPosition / 1000f + x2));
                theCoords.addElement(
                  new Double(currentYPosition / 1000f - y2 +
                             (matrix.getC() - matrix.getD()) * 2 *
                             ar.getBaseVal().getValue()));
                theCoords.addElement(
                  new Double(ar.getBaseVal().getValue()));
                //        }
            }
        } else if (gradUnits ==
            SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX &&
            area instanceof GraphicElement) {
            SVGRect rect = ((GraphicElement) area).getBBox();
            if (rect != null) {
                theCoords = new Vector();
                SVGLength val;
                val = acx.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f +
                                 rect.getX() +
                                 val.getValue() * rect.getWidth()));
                } else {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f +
                                 val.getValue()));
                }
                val = acy.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f -
                                 rect.getY() -
                                 val.getValue() * rect.getHeight()));
                } else {
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f -
                                 val.getValue()));
                }
                theCoords.addElement(new Double(0));
                val = afx.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f +
                                 rect.getX() +
                                 val.getValue() * rect.getWidth()));
                } else {
                    theCoords.addElement(
                      new Double(currentXPosition / 1000f +
                                 val.getValue()));
                }
                val = afy.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f -
                                 rect.getY() -
                                 val.getValue() * rect.getHeight()));
                } else {
                    theCoords.addElement(
                      new Double(currentYPosition / 1000f -
                                 val.getValue()));
                }
                val = ar.getBaseVal();
                if (val.getUnitType() ==
                        SVGLength.SVG_LENGTHTYPE_PERCENTAGE || gradUnits ==
                        SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                    theCoords.addElement(
                      new Double(val.getValue() * rect.getHeight()));
                } else {
                    theCoords.addElement(new Double(val.getValue()));
                }
            }
        }
        if (theCoords == null) {
            // percentage values are expressed according to the viewport.
            SVGElement vp =
              ((GraphicElement) area).getNearestViewportElement();
            if (area instanceof GraphicElement) {
                SVGRect rect = ((GraphicElement) area).getBBox();
                if (rect != null) {
                    theCoords = new Vector();
                    SVGLength val = acx.getBaseVal();
                    if (val.getUnitType() ==
                            SVGLength.SVG_LENGTHTYPE_PERCENTAGE ||
                            gradUnits ==
                            SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                        theCoords.addElement(
                          new Double(currentXPosition / 1000f +
                                     rect.getX() +
                                     val.getValue() * rect.getWidth()));
                    } else {
                        theCoords.addElement(
                          new Double(currentXPosition / 1000f +
                                     val.getValue()));
                    }
                    val = acy.getBaseVal();
                    if (val.getUnitType() ==
                            SVGLength.SVG_LENGTHTYPE_PERCENTAGE ||
                            gradUnits ==
                            SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                        theCoords.addElement(
                          new Double(currentYPosition / 1000f -
                                     rect.getY() -
                                     val.getValue() * rect.getHeight()));
                    } else {
                        theCoords.addElement(
                          new Double(currentYPosition / 1000f -
                                     val.getValue()));
                    }
                    theCoords.addElement(new Double(0));
                    val = afx.getBaseVal();
                    if (val.getUnitType() ==
                            SVGLength.SVG_LENGTHTYPE_PERCENTAGE ||
                            gradUnits ==
                            SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                        theCoords.addElement(
                          new Double(currentXPosition / 1000f +
                                     rect.getX() +
                                     val.getValue() * rect.getWidth()));
                    } else {
                        theCoords.addElement(
                          new Double(currentXPosition / 1000f +
                                     val.getValue()));
                    }
                    val = afy.getBaseVal();
                    if (val.getUnitType() ==
                            SVGLength.SVG_LENGTHTYPE_PERCENTAGE ||
                            gradUnits ==
                            SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                        theCoords.addElement(
                          new Double(currentYPosition / 1000f -
                                     rect.getY() -
                                     val.getValue() * rect.getHeight()));
                    } else {
                        theCoords.addElement(
                          new Double(currentYPosition / 1000f -
                                     val.getValue()));
                    }
                    val = ar.getBaseVal();
                    if (val.getUnitType() ==
                            SVGLength.SVG_LENGTHTYPE_PERCENTAGE ||
                            gradUnits ==
                            SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
                        theCoords.addElement( new Double(val.getValue() *
                                                         rect.getHeight()));
                    } else {
                        theCoords.addElement(new Double(val.getValue()));
                    }
                }
            }
        }
        if (theCoords == null) {
            theCoords = new Vector();
            theCoords.addElement( new Double(currentXPosition / 1000f +
                                             acx.getBaseVal().getValue()));
            theCoords.addElement( new Double(currentYPosition / 1000f -
                                             acy.getBaseVal().getValue()));
            theCoords.addElement(new Double(0));
            theCoords.addElement( new Double(currentXPosition / 1000f +
                                             afx.getBaseVal().getValue())); // Fx
            theCoords.addElement(
              new Double(currentYPosition / 1000f -
                         afy.getBaseVal().getValue())); // Fy
            theCoords.addElement(
              new Double(ar.getBaseVal().getValue()));
        }
        float lastoffset = 0;
        for (int count = 0; count < nl.getLength(); count++) {
            stop = (SVGStopElementImpl) nl.item(count);
            CSSValue cv = stop.getPresentationAttribute("stop-color");
            if (cv == null) {
                // maybe using color
                cv = stop.getPresentationAttribute("color");
            }
            if (cv == null) {
                // problems
                MessageHandler.errorln("no stop-color or color in stop element");
                continue;
            }
            PDFColor color = new PDFColor(0, 0, 0);
            if (cv != null &&
                    cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                if (((CSSPrimitiveValue) cv).getPrimitiveType() ==
                        CSSPrimitiveValue.CSS_RGBCOLOR) {
                    RGBColor col =
                      ((CSSPrimitiveValue) cv).getRGBColorValue();
                    CSSPrimitiveValue val;
                    val = col.getRed();
                    float red = val.getFloatValue(
                                  CSSPrimitiveValue.CSS_NUMBER);
                    val = col.getGreen();
                    float green = val.getFloatValue(
                                    CSSPrimitiveValue.CSS_NUMBER);
                    val = col.getBlue();
                    float blue = val.getFloatValue(
                                   CSSPrimitiveValue.CSS_NUMBER);
                    color = new PDFColor(red, green, blue);
                }
            }
            float offset = stop.getOffset().getBaseVal();
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

        SVGLengthList ll = getBaseVal();
        int n = ll.getNumberOfItems();
        short[] types = new short[n];
        float[] values = new float[n];
        for (int i = 0; i < n; i++) {
            SVGLength l = ll.getItem(i);
            types[i] = l.getUnitType();
            values[i] = l.getValueInSpecifiedUnits();
        }
        return new AnimatableLengthListValue
            (target, types, values,
             target.getPercentageInterpretation
                 (getNamespaceURI(), getLocalName(), false));
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

    /**
     * Creates a new {@link SVGItem} object from the given {@link SVGLength}.
     */
    protected SVGItem createSVGItem(Object newItem) {
        SVGLength l = (SVGLength) newItem;
        return new SVGLengthItem(l.getUnitType(), l.getValueInSpecifiedUnits(),
                                 direction);
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGLength

    /**
     * Returns the base value of the attribute as an {@link AnimatableValue}.
     */
    public AnimatableValue getUnderlyingValue(AnimationTarget target) {
        SVGLength base = getBaseVal();
        return new AnimatableLengthValue
            (target, base.getUnitType(), base.getValueInSpecifiedUnits(),
             target.getPercentageInterpretation
                 (getNamespaceURI(), getLocalName(), false));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.