Examples of VectorGraphics2D


Examples of de.erichseifert.vectorgraphics2d.VectorGraphics2D

    EPS, PDF, SVG;
  }

  public static void saveVectorGraphic(Chart chart, String fileName, VectorGraphicsFormat vectorGraphicsFormat) throws IOException {

    VectorGraphics2D g = null;

    switch (vectorGraphicsFormat) {
    case EPS:
      g = new EPSGraphics2D(0.0, 0.0, chart.getWidth(), chart.getHeight());
      break;
    case PDF:
      g = new PDFGraphics2D(0.0, 0.0, chart.getWidth(), chart.getHeight());
      break;
    case SVG:
      g = new SVGGraphics2D(0.0, 0.0, chart.getWidth(), chart.getHeight());
      break;

    default:
      break;
    }

    chart.paint(g, chart.getWidth(), chart.getHeight());

    // Write the vector graphic output to a file
    FileOutputStream file = new FileOutputStream(fileName + "." + vectorGraphicsFormat.toString().toLowerCase());

    try {
      file.write(g.getBytes());
    } finally {
      file.close();
    }
  }
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.