Examples of GVTBuilder


Examples of org.apache.batik.bridge.GVTBuilder

        //
        // Now that the SVG file has been loaded, build
        // a GVT Tree from it
        //
        UserAgent userAgent = buildUserAgent();
        GVTBuilder builder = new GVTBuilder();
        BridgeContext ctx = new BridgeContext(userAgent);
        ctx.setDynamic(true);

        try {
            builder.build(ctx, doc);
            BaseScriptingEnvironment scriptEnvironment
                = new BaseScriptingEnvironment(ctx);
            scriptEnvironment.loadScripts();
            scriptEnvironment.dispatchSVGLoadEvent();
        } catch (BridgeException e){
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

   
    ImageRendererFactory rendererFactory;
    rendererFactory = new ConcreteImageRendererFactory();
    ImageRenderer renderer = rendererFactory.createStaticImageRenderer();

    GVTBuilder builder = new GVTBuilder();
    BridgeContext ctx = new BridgeContext(new UserAgentAdapter());
    ctx.setDynamicState(BridgeContext.STATIC);
    GraphicsNode rootNode = builder.build(ctx, document);

    renderer.setTree(rootNode);
   
    float docWidth  = (float) ctx.getDocumentSize().getWidth();
    float docHeight = (float) ctx.getDocumentSize().getHeight();
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

        url = new File(".").toURI().toURL();
      }
      final SVGDocument document = (SVGDocument) loader.loadDocument
          (url.toURI().toASCIIString(), data.getResourceAsStream(caller));
      final BridgeContext ctx = new BridgeContext(userAgent, loader);
      final GVTBuilder builder = new GVTBuilder();
      final GraphicsNode node = builder.build(ctx, document);
      return new SimpleResource(data.getKey(), new SVGDrawable(node), DrawableWrapper.class, version);
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Failed to process SVG file", e);
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

        url = new File(".").toURI().toURL();
      }
      final SVGDocument document = (SVGDocument) loader.loadDocument
          (url.toURI().toASCIIString(), data.getResourceAsStream(caller));
      final BridgeContext ctx = new BridgeContext(userAgent, loader);
      final GVTBuilder builder = new GVTBuilder();
      final GraphicsNode node = builder.build(ctx, document);
      final Rectangle2D bounds = node.getBounds();

      final SVGDrawable drawable = new SVGDrawable(node);
      final BufferedImage bi = new BufferedImage((int) bounds.getWidth(), (int) bounds.getHeight(), BufferedImage.TYPE_INT_ARGB);
      final Graphics2D graphics = (Graphics2D) bi.getGraphics();
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

            pxToMillimeter = (float)(UnitConv.IN2MM / ptm.doubleValue());
        }
        SVGUserAgent ua = new SVGUserAgent(
                pxToMillimeter,
                new AffineTransform());
        GVTBuilder builder = new GVTBuilder();
        final BridgeContext ctx = new BridgeContext(ua);

        //Build the GVT tree
        final GraphicsNode root;
        try {
            root = builder.build(ctx, svg.getDocument());
        } catch (Exception e) {
            throw new ImageException("GVT tree could not be built for SVG graphic", e);
        }

        //Create the painter
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

        //
        // Now that the SVG file has been loaded, build
        // a GVT Tree from it
        //
        TestUserAgent userAgent = buildUserAgent();
        GVTBuilder builder = new GVTBuilder();
        BridgeContext ctx = new BridgeContext(userAgent);
        ctx.setDynamic(true);
        Exception e = null;
        try {
            builder.build(ctx, doc);
            BaseScriptingEnvironment scriptEnvironment
                = new BaseScriptingEnvironment(ctx);
            scriptEnvironment.loadScripts();
            scriptEnvironment.dispatchSVGLoadEvent();
        } catch (Exception ex){
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

        //
        // Now that the SVG file has been loaded, build
        // a GVT Tree from it
        //
        UserAgent userAgent = buildUserAgent();
        GVTBuilder builder = new GVTBuilder();
        BridgeContext ctx = new BridgeContext(userAgent);
        ctx.setDynamic(true);

        try {
            builder.build(ctx, doc);
            BaseScriptingEnvironment scriptEnvironment
                = new BaseScriptingEnvironment(ctx);
            scriptEnvironment.loadScripts();
            scriptEnvironment.dispatchSVGLoadEvent();
        } catch (BridgeException e){
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

        root.setAttribute("onload", "System.out.println('hello')");

        // Now that the SVG file has been loaded, build
        // a GVT Tree from it
        TestUserAgent userAgent = new TestUserAgent();
        GVTBuilder builder = new GVTBuilder();
        BridgeContext ctx = new BridgeContext(userAgent);
        ctx.setDynamic(true);

        builder.build(ctx, doc);
        BaseScriptingEnvironment scriptEnvironment
            = new BaseScriptingEnvironment(ctx);
        scriptEnvironment.loadScripts();
        scriptEnvironment.dispatchSVGLoadEvent();
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

        ctx = createBridgeContext();
        SVGOMDocument svgDoc = (SVGOMDocument)document;
        SVGSVGElement root = svgDoc.getRootElement();

        // build the GVT tree
        builder = new GVTBuilder();
        // flag that indicates if the document is dynamic
        boolean isDynamic =
            (hints.containsKey(KEY_EXECUTE_ONLOAD) &&
             ((Boolean)hints.get(KEY_EXECUTE_ONLOAD)).booleanValue() &&
             ctx.isDynamicDocument(svgDoc));
View Full Code Here

Examples of org.apache.batik.bridge.GVTBuilder

    }
   
    protected void gatherRegionInfo(BridgeContext ctx, Element rgn,
                                    float verticalAlign, List regions) {

        GVTBuilder builder = ctx.getGVTBuilder();
        for (Node n = rgn.getFirstChild();
             n != null; n = n.getNextSibling()) {

            if (n.getNodeType()     != Node.ELEMENT_NODE) continue;
            if (!getNamespaceURI().equals(n.getNamespaceURI())) continue;
            Element e = (Element)n;

            GraphicsNode gn = builder.build(ctx, e) ;
            if (gn == null) continue;

            Shape s = gn.getOutline();
            if (s == null) continue;
            AffineTransform at = gn.getTransform();
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.