Package org.w3c.dom.svg

Examples of org.w3c.dom.svg.SVGSVGElement


            target = (EventTarget)element;
        } catch (ClassCastException e) {
            // will not work on this one!
            return;
        }
        SVGSVGElement svgElement = (SVGSVGElement)element.getOwnerSVGElement();
        if (svgElement == null) {
            if (element.getLocalName().equals(SVG_SVG_TAG)) {
                svgElement = (SVGSVGElement)element;
            } else {
                // something goes wrong => disable scripting
                return;
            }
        }
        String language = svgElement.getContentScriptType();
        Interpreter interpret = null;
        String script = null;
        if (element.getLocalName().equals(SVG_SVG_TAG)) {
            for (int i = 0; i < EVENT_ATTRIBUTES_SVG.length; i++) {
                if (!(script = element.getAttribute(EVENT_ATTRIBUTES_SVG[i])).
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

        if (!(document instanceof SVGOMDocument)) {
            throw new TranscoderException(Messages.formatMessage("notsvg",
                    null));
        }
        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);

        boolean stroke = true;
        if (hints.containsKey(KEY_STROKE_TEXT)) {
View Full Code Here

        // get the 'width' and 'height' attributes of the SVG document
        float w = (float)ctx.getDocumentSize().getWidth() * 1000f;
        float h = (float)ctx.getDocumentSize().getHeight() * 1000f;

        //log.debug("drawing SVG image: "+x+"/"+y+" "+w+"/"+h);
        SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
        AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg,
                w/1000f , h/1000f );

        ctx = null;
        builder = null;
View Full Code Here

            if (href.indexOf(":") == -1)
                href = "file:" + href;
            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

    public void renderSVGArea(SVGArea area) {
        if (debug)
            System.out.println("TXTRenderer.renderSVGArea(" + area + ")");
        int x = this.currentAreaContainerXPosition;
        int y = this.currentYPosition;
        SVGSVGElement svg =
            ((SVGDocument)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

        renderSVGDocument(doc, x, y);
        this.currentXPosition += area.getContentWidth();
    }

    protected void renderSVGDocument(Document doc, float x, float y) {
        SVGSVGElement svg = ((SVGDocument)doc).getRootElement();
        Element view = svgDocument.createElementNS(svgNS, "svg");
        Node newsvg = svgDocument.importNode(svg, true);
        //view.setAttributeNS(null, "viewBox", "0 0 ");
        view.setAttributeNS(null, "x", "" + x);
        view.setAttributeNS(null, "y", "" + y);
View Full Code Here

    public void renderSVGArea(SVGArea area) {
        if (debug)
            System.out.println("PCLRenderer.renderSVGArea(" + area + ")");
        int x = this.currentXPosition;
        int y = this.currentYPosition;
        SVGSVGElement svg =
            ((SVGDocument)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


    protected Rectangle2D getViewBoxRect() {
        SVGDocument doc = canvas.getSVGDocument();
        if (doc == null) return null;
        SVGSVGElement el = doc.getRootElement();
        if (el == null) return null;

        String viewBoxStr = el.getAttributeNS
            (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE);
        if (viewBoxStr.length() != 0) {
            float[] rect = ViewBox.parseViewBoxAttribute(el, viewBoxStr, null);
            return new Rectangle2D.Float(rect[0], rect[1],
                                         rect[2], rect[3]);
View Full Code Here

                     public void handleEvent(Event evt) {
                         if (!(evt.getTarget() instanceof SVGSVGElement))
                             return;
                         // assert(evt.getType() ==
                         //        SVGConstants.SVG_SVGZOOM_EVENT_TYPE);
                         SVGSVGElement svg = (SVGSVGElement) evt.getTarget();
                         scaleChange(svg.getCurrentScale());
                     } // handleEvent()
                 }, false, null);
        }// documentLoadingCompleted()
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.