Package com.kitfox.svg

Examples of com.kitfox.svg.SVGUniverse


    if (_points == null) {
      String key = makeRessourceKey();
      _points = (List<Point>) RessourceManager.getRessource(key);
      if (_points == null) {
        try {
          SVGUniverse svgUniverse = new SVGUniverse();
          StringReader reader = new StringReader(svg);
          SVGDiagram diagram = svgUniverse.getDiagram(svgUniverse.loadSVG(reader, "svgImage"));

          int imgWidth = Tools.FTOI(diagram.getWidth() * resolution_multiplier);
          int imgHeight = Tools.FTOI(diagram.getHeight() * resolution_multiplier);

          //          SVGRoot root = diagram.getRoot();
View Full Code Here


      return;
    }
    try {
      if (currFile.exists()) {

        SVGUniverse svgUniverse = new SVGUniverse();
        String svg = Tools.readUTF8Textfile(currFile.getAbsolutePath());
        StringReader reader = new StringReader(svg);
        SVGDiagram diagram = svgUniverse.getDiagram(svgUniverse.loadSVG(reader, "svgImage"));

        int imgWidth = this.getPreferredSize().width;
        int imgHeight = this.getPreferredSize().height - BUTTON_HEIGHT;

        SimpleImage imgMap = new SimpleImage(imgWidth, imgHeight);
View Full Code Here

    private void loadURL(URL url)
    {
        boolean verbose = cmCheck_verbose.isSelected();
       
//                SVGUniverse universe = new SVGUniverse();
        SVGUniverse universe = SVGCache.getSVGUniverse();
        SVGDiagram diagram = null;
        URI uri;

        if (!CheckBoxMenuItem_anonInputStream.isSelected())
        {
            //Load from a disk with a valid URL
            uri = universe.loadSVG(url);

            if (verbose) System.err.println("Loading document " + uri.toString());

            diagram = universe.getDiagram(uri);
        }
        else
        {
            //Load from a stream with no particular valid URL
            try
            {
                InputStream is = url.openStream();
                uri = universe.loadSVG(is, "defaultName");

                if (verbose) System.err.println("Loading document " + uri.toString());
            }
            catch (Exception e)
            {
                e.printStackTrace();
                return;
            }
        }
/*
ByteArrayOutputStream bs = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bs);
os.writeObject(universe);
os.close();

ByteArrayInputStream bin = new ByteArrayInputStream(bs.toByteArray());
ObjectInputStream is = new ObjectInputStream(bin);
universe = (SVGUniverse)is.readObject();
is.close();
*/

        diagram = universe.getDiagram(uri);

        svgDisplayPanel.setDiagram(diagram);
        repaint();
    }
View Full Code Here

    private void loadURL(URL url)
    {
        boolean verbose = cmCheck_verbose.isSelected();

        universe = new SVGUniverse();
        universe.setVerbose(verbose);
        SVGDiagram diagram = null;

        if (!CheckBoxMenuItem_anonInputStream.isSelected())
        {
View Full Code Here

    private static final String NAME_PREFIX = "svgimage_";

    @Override
    public SVGDiagram readObject(InputStream inputStream) throws IOException {
        SVGUniverse universe = SVGCache.getSVGUniverse();
        URI location = universe.loadSVG(inputStream, NAME_PREFIX + (index++));
        return universe.getDiagram(location, true);
    }
View Full Code Here

    g2d.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR );
    g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );

    // 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();  
View Full Code Here

  {
    try {
      if ( playState == PlayerThread.PS_STOP )
        return;
     
      SVGUniverse universe = diagram.getUniverse();
      if ( universe != null ) {
        universe.setCurTime( curTime );
        universe.updateTime();
        component.repaint();
      }
    }
    catch ( Exception e )
    {
View Full Code Here

   * image has changed
   */
  public void setImage( URL imageURL, boolean clear )
  {
    try {     
      SVGUniverse universe = new SVGUniverse();
      if ( clear )
        universe.clear();

      if ( BuildProperties.DEBUG )
        DebugLogger.logWarning( "Loading: " + imageURL.toExternalForm());
     
      diagram = universe.getDiagram( new URI( imageURL.toExternalForm()));
    }
    catch ( URISyntaxException ex )
    {
      ex.printStackTrace();
    }
View Full Code Here

        return img;
    }

    private static SVGUniverse getSvgUniverse() {
        if (svgUniverse == null) {
            svgUniverse = new SVGUniverse();
        }
        return svgUniverse;
    }
View Full Code Here

    SVGDiagram svgDiagram; //obrazek
    Interface refInterface;
    public PanelWithAnimation(Interface in) throws Exception{
      // konstruktor przyjmujacy referencje
      refInterface=in;
        SVGUniverse svgUniverse = new SVGUniverse();
        URI uri = svgUniverse.loadSVG(getClass().getResourceAsStream("Picture1.svg"), "Rysunek");
        svgDiagram = svgUniverse.getDiagram(uri);
        //przygotowanie obrazka
       
    }
View Full Code Here

TOP

Related Classes of com.kitfox.svg.SVGUniverse

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.