Package com.kitfox.svg

Examples of com.kitfox.svg.SVGRoot


    public void setSize(int width, int height) {
        int previousWidth = getWidth();
        int previousHeight = getHeight();

        SVGRoot root = diagram.getRoot();
        try {
            root.setAttribute("width", AnimationElement.AT_XML, Integer.toString(width));
            root.setAttribute("height", AnimationElement.AT_XML, Integer.toString(height));
        } catch (SVGElementException exception) {
            throw new RuntimeException(exception);
        }

        try {
View Full Code Here


    // Draw graphics
    try {
      SVGUniverse universe = SVGCache.getSVGUniverse();
      SVGDiagram diagram = universe.getDiagram( universe.loadSVG( is, name ));
      if ( diagram != null ) {
        SVGRoot root = diagram.getRoot();
        root.setAttribute( "width", AnimationElement.AT_XML, Double.toString( width ));
        root.setAttribute( "height", AnimationElement.AT_XML, Double.toString( height ));
        root.build();  
        diagram.setIgnoringClipHeuristic( true );
        root.render( g2d );
      }
    }
    catch ( Exception ex )
    {
      ex.printStackTrace();
View Full Code Here

        g.fillRect( 0, 0, width, height );
      }
     
      //setImage( theImage, width, height );
      if ( diagram != null ) {
        SVGRoot root = diagram.getRoot();
        if (( oldWidth != width ) || ( oldHeight != height )) {
          if ( root != null ) {
            root.setAttribute( "width", AnimationElement.AT_XML, Double.toString( width ));
            root.setAttribute( "height", AnimationElement.AT_XML, Double.toString( height ));
            root.build();  
          //diagram.setDeviceViewport( new Rectangle( 0,0,width, height));
            oldWidth = width;
            oldHeight = height;
          }

          try {
            double bbox[] = root.getPresAbsolute( "viewBox" ).getDoubleList();
            scaleX = bbox[ 2 ] / width;//root.getPresAbsolute( "width" ).getDoubleValue();   
            scaleY = bbox[ 3 ] / height;//root.getPresAbsolute( "height" ).getDoubleValue();       
          } catch ( Exception e ) {}
        }
       
View Full Code Here

TOP

Related Classes of com.kitfox.svg.SVGRoot

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.