Package org.w3c.dom.svg

Examples of org.w3c.dom.svg.SVGSVGElement


            // transform so that the coordinates (0,0) is from the top left
            // and positive is down and to the right. (0,0) is where the
            // viewBox puts it.
            gen.concatMatrix(sx, 0, 0, sy, xOffset / 1000f, yOffset / 1000f);

            SVGSVGElement svg = ((SVGDocument)doc).getRootElement();
            AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg,
                    psInfo.getWidth() / 1000f, psInfo.getHeight() / 1000f);
            /*
            if (!at.isIdentity()) {
                double[] vals = new double[6];
View Full Code Here


        if (getNamespace().equals(ns)) {
            if (!(doc instanceof SVGDocument)) {
                DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
                doc = DOMUtilities.deepCloneDocument(doc, impl);
            }
            SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
            SVGDocument targetDoc = (SVGDocument)context.getProperty(SVG_DOCUMENT);
            SVGElement currentPageG = (SVGElement)context.getProperty(SVG_PAGE_G);
            Element view = targetDoc.createElementNS(getNamespace(), "svg");
            Node newsvg = targetDoc.importNode(svg, true);
            //view.setAttributeNS(null, "viewBox", "0 0 ");
View Full Code Here

      FopImage img = FopImageFactory.Make(href);
      if(img != null)
      {
        if ( img instanceof SVGImage )
        {
          SVGSVGElement svg = ((SVGImage)img).getSVGDocument().getRootElement();
          renderSVG(fontState, svg, (int)x * 1000, (int)y * 1000);
        }
        else
        {
          printBMP(img, (int)x, (int)y, (int)width, (int)height);
View Full Code Here

  {
if ( debug )
System.out.println("TXTRenderer.renderSVGArea(" + area + ")");
    int x = this.currentAreaContainerXPosition;
    int y = this.currentYPosition;
    SVGSVGElement svg = area.getSVGDocument().getRootElement();
    int w = (int)(svg.getWidth().getBaseVal().getValue() * 1000);
    int h = (int)(svg.getHeight().getBaseVal().getValue() * 1000);

    //currentStream.add("ET\n");
    /*
     * Clip to the svg area.
     * Note: To have the svg overlay (under) a text area then use
View Full Code Here

  {
if ( debug )
System.out.println("PCLRenderer.renderSVGArea(" + area + ")");
        int x = this.currentXPosition;
        int y = this.currentYPosition;
        SVGSVGElement svg = area.getSVGDocument().getRootElement();
        int w = (int)(svg.getWidth().getBaseVal().getValue() * 1000);
        int h = (int)(svg.getHeight().getBaseVal().getValue() * 1000);

        /*
         * Clip to the svg area.
         * Note: To have the svg overlay (under) a text area then use
         * an fo:block-container
View Full Code Here

      driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
      driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
    XMLReader parser = SVGImage.createParser();
      driver.buildSVGTree(parser, new InputSource(this.imageStream));
      SVGDocument doc = driver.getSVGDocument();
      SVGSVGElement svg = doc.getRootElement();
    this.width = (int)svg.getWidth().getBaseVal().getValue() * 1000;
    this.height = (int)svg.getHeight().getBaseVal().getValue() * 1000;
    return true;
  } catch (Exception e) {
      //MessageHandler.errorln("ERROR LOADING EXTERNAL SVG: " + e.getMessage());
      // assuming any exception means this document is not svg
      // or could not be loaded for some reason
View Full Code Here

      addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
        @Override
        public void gvtRenderingStarted(final GVTTreeRendererEvent e) {
          super.gvtRenderingStarted(e);
          final SVGDocument document = getSVGDocument();
          final SVGSVGElement rootElement = document.getRootElement();
          final SVGLength width = rootElement.getWidth().getBaseVal();
          final SVGLength height = rootElement.getHeight().getBaseVal();
          float defaultWidth = (float) Math.ceil(width.getValue());
          float defaultHeigth = (float) Math.ceil(height.getValue());
          if (defaultWidth == 1f && defaultHeigth == 1f) {
            defaultWidth = ResourceController.getResourceController().getIntProperty(
                "default_external_component_width", 200);
            defaultHeigth = ResourceController.getResourceController().getIntProperty(
                "default_external_component_height", 200);
          }
          originalSize = new Dimension((int) defaultWidth, (int) defaultHeigth);
          if ("".equals(rootElement.getAttributeNS(null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE))) {
            rootElement.setAttributeNS(null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE, "0 0 " + defaultWidth
                    + " " + defaultHeigth);
          }
          removeGVTTreeRendererListener(this);
        }
      });
View Full Code Here

        if (getNamespace().equals(ns)) {
            if (!(doc instanceof SVGDocument)) {
                DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
                doc = DOMUtilities.deepCloneDocument(doc, impl);
            }
            SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
            SVGDocument targetDoc = (SVGDocument)context.getProperty(SVG_DOCUMENT);
            SVGElement currentPageG = (SVGElement)context.getProperty(SVG_PAGE_G);
            Element view = targetDoc.createElementNS(getNamespace(), "svg");
            Node newsvg = targetDoc.importNode(svg, true);
            //view.setAttributeNS(null, "viewBox", "0 0 ");
View Full Code Here

     * Computes the transform used for rendering.
     */
    protected void computeRenderingTransform() {
        try {
            if (svgDocument != null) {
                SVGSVGElement elt = svgDocument.getRootElement();
                Dimension d = getSize();
                setRenderingTransform(ViewBox.getViewTransform
                                      (fragmentIdentifier, elt, d.width, d.height));
                initialTransform = renderingTransform;
            }
View Full Code Here

            // <!> TO BE FIXED WHEN WE DO ERROR HANDLING PROPERLY
            throw new TranscoderException("");
        }

        SVGDocument svgDoc = (SVGDocument)document;
        SVGSVGElement root = svgDoc.getRootElement();

        //
        // Initialize the SVG document with the appropriate context
        //
        String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME);
        DefaultSVGContext svgCtx = new DefaultSVGContext();
        svgCtx.setPixelToMM(userAgent.getPixelToMM());
        ((SVGOMDocument)document).setSVGContext(svgCtx);

        //
        // Get the 'width' and 'height' attributes of the SVG document
        //
        float docWidth = (int)root.getWidth().getBaseVal().getValue();
        float docHeight = (int)root.getHeight().getBaseVal().getValue();

        //
        // Compute the image's width and height according the hints
        //
        float imgWidth = -1;
View Full Code Here

TOP

Related Classes of org.w3c.dom.svg.SVGSVGElement

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.