Package org.w3c.dom.svg

Examples of org.w3c.dom.svg.SVGDocument


            }
            String uriStr = XLinkSupport.getXLinkHref(e);
            if (uriStr.length() == 0) { // exit if no more xlink:href
                return "";
            }
            SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument();
            URL baseURL = ((SVGOMDocument)svgDoc).getURLObject();
            try {
                URL url = new URL(baseURL, uriStr);
                Iterator iter = refs.iterator();
                while (iter.hasNext()) {
View Full Code Here


        if (!(document instanceof SVGOMDocument)) {
            throw new TranscoderException(
                Messages.formatMessage("notsvg", null));
        }
 
        SVGDocument svgDoc = (SVGDocument)document;
  // set the alternate stylesheet if any
        if (hints.containsKey(KEY_ALTERNATE_STYLESHEET)) {
            String stylesheetName = (String)hints.get(KEY_ALTERNATE_STYLESHEET);
      ((SVGOMDocument)svgDoc).enableAlternateStyleSheet(stylesheetName);
        }

        SVGSVGElement root = svgDoc.getRootElement();
        // initialize the SVG document with the appropriate context
        DefaultSVGContext svgCtx = new DefaultSVGContext();
        svgCtx.setPixelToMM(userAgent.getPixelToMM());
        ((SVGOMDocument)document).setSVGContext(svgCtx);
View Full Code Here

    /**
     * Updates the thumbnail component rendering transform.
     */
    protected void updateThumbnailRenderingTransform() {
        SVGDocument svgDocument = svgCanvas.getSVGDocument();
        if (svgDocument != null) {
            SVGSVGElement elt = svgDocument.getRootElement();
            Dimension dim = svgThumbnailCanvas.getSize();

            AffineTransform Tx
                = ViewBox.getViewTransform(null, elt, dim.width, dim.height);
            if (Tx.isIdentity()) {
View Full Code Here

                                                        filterRegion,
                                                        ctx);

        Filter filter = null;
        // try to load the image as an svg document
        SVGDocument svgDoc = (SVGDocument)filterElement.getOwnerDocument();
        ParsedURL purl;
        URL baseURL = ((SVGOMDocument)svgDoc).getURLObject();
        if (baseURL != null)
            purl = new ParsedURL(baseURL.toString(), uriStr);
        else
View Full Code Here

     * Runs this loader.
     */
    public void run() {
        try {
            fireStartedEvent();
            SVGDocument svgDocument = (SVGDocument)loader.loadDocument(url);
            fireCompletedEvent(svgDocument);
        } catch (InterruptedIOException e) {
            fireCancelledEvent();
        } catch (Exception e) {
            exception = e;
View Full Code Here

     * of the test's internal operation fails.
     */
    public TestReport runImpl() throws Exception {
        DefaultTestReport report = new DefaultTestReport(this);

        SVGDocument  svgDoc;
        GraphicsNode gvtRoot;
        BridgeContext  ctx;
        try {
            UserAgent      userAgent = new UserAgentAdapter();
            DocumentLoader loader    = new DocumentLoader(userAgent);
            GVTBuilder     builder   = new GVTBuilder();

            ctx     = new BridgeContext(userAgent, loader);
            svgDoc  = (SVGDocument)loader.loadDocument(svg.toString());
            gvtRoot = builder.build(ctx, svgDoc);
        } catch(Exception e) {
            StringWriter trace = new StringWriter();
            e.printStackTrace(new PrintWriter(trace));
            report.setErrorCode(ERROR_READING_SVG);
            report.setDescription(new TestReport.Entry[] {
                new TestReport.Entry
                    (Messages.formatMessage(ENTRY_KEY_ERROR_DESCRIPTION, null),
                     Messages.formatMessage
                     (ERROR_READING_SVG,
                      new String[]{svg.toString(), trace.toString()}))
                    });
            report.setPassed(false);
            return report;
        }

        Shape highlight = null;
        try {
            Element e = svgDoc.getElementById(id);
            // System.out.println("Element: " + e + " CTX: " + ctx );
            GraphicsNode gn = ctx.getGraphicsNode(e);
            if (gn == null) {
                report.setErrorCode(ERROR_BAD_ID);
                report.setDescription(new TestReport.Entry[] {
View Full Code Here

            addRect(x, y, w, h, true);    // use helper function

        } else {
            if (img instanceof SVGImage) {
                try {
                    SVGDocument svg = ((SVGImage)img).getSVGDocument();
                    renderSVGDocument(svg, x / 1000f, pageHeight - y / 1000f);
                } catch (FopImageException e) {}

            } else {
View Full Code Here

    protected boolean loadImage(String uri) {
        // parse document and get the size attributes of the svg element
        try {
            SAXSVGDocumentFactory factory =
              new SAXSVGDocumentFactory(SVGImage.getParserName());
            SVGDocument doc = (SVGDocument)factory.createDocument(uri, imageStream);

            UserAgent userAgent = new MUserAgent(new AffineTransform());
            BridgeContext ctx = new BridgeContext(userAgent);

            Element e = ((SVGDocument)doc).getRootElement();
View Full Code Here

                    canvas.addSVGDocumentLoaderListener(loadListener);
                    state = doTweak(setURI, loadListener);
                    canvas.removeSVGDocumentLoaderListener(loadListener);
                    System.err.println("Finished Load Tweak: " + state);

                    final SVGDocument doc = canvas.getSVGDocument();
                    Runnable setDoc = new Runnable() {
                            public void run() {
                                canvas.setSVGDocument(doc);
                            }
                        };
View Full Code Here

            String script = elt.getAttributeNS(null, attribute);
            if (script.length() == 0)
                return;

            DocumentLoader dl = bridgeContext.getDocumentLoader();
            SVGDocument d = (SVGDocument)elt.getOwnerDocument();
            int line = dl.getLineNumber(elt);
            final String desc = Messages.formatMessage
                (EVENT_SCRIPT_DESCRIPTION,
                 new Object [] {d.getURL(), attribute, new Integer(line)});

            // Find the scripting language
            Element e = elt;
            while (e != null &&
                   (!SVGConstants.SVG_NAMESPACE_URI.equals
View Full Code Here

TOP

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

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.