Search in sources :

Example 1 with EMFGraphics2D

use of org.freehep.graphicsio.emf.EMFGraphics2D in project abstools by abstools.

the class ExporterImpl method getGraphics.

private VectorGraphics getGraphics() {
    VectorGraphics vectorGraphics;
    if (orientation == null) {
        orientation = dim.getWidth() <= dim.getHeight() ? "Portrait" : "Landscape";
    }
    if (type.equals("gif")) {
        vectorGraphics = new GIFGraphics2D(stream, dim);
    } else if (type.equals("png")) {
        vectorGraphics = new ImageGraphics2D(stream, dim, "png");
    } else if (type.equals("bmp")) {
        vectorGraphics = new ImageGraphics2D(stream, dim, "bmp");
    } else if (type.equals("jpg")) {
        vectorGraphics = new ImageGraphics2D(stream, dim, "jpg");
    } else if (type.equals("pdf")) {
        PDFGraphics2D pdf = new PDFGraphics2D(stream, dim);
        Properties properties = new Properties();
        properties.setProperty(PDFGraphics2D.ORIENTATION, orientation);
        properties.setProperty(PDFGraphics2D.PAGE_SIZE, format);
        pdf.setProperties(properties);
        vectorGraphics = pdf;
    } else if (type.equals("ps")) {
        PSGraphics2D ps = new PSGraphics2D(stream, dim);
        Properties properties = new Properties();
        properties.setProperty(PSGraphics2D.ORIENTATION, orientation);
        properties.setProperty(PSGraphics2D.PAGE_SIZE, format);
        ps.setProperties(properties);
        ps.setMultiPage(true);
        vectorGraphics = ps;
    } else if (type.equals("emf")) {
        vectorGraphics = new EMFGraphics2D(stream, dim);
    } else if (type.equals("svg")) {
        vectorGraphics = new SVGGraphics2D(stream, dim);
    } else if (type.equals("swf")) {
        vectorGraphics = new SWFGraphics2D(stream, dim);
    } else {
        throw new IllegalArgumentException("Unknown type: " + type);
    }
    return vectorGraphics;
}
Also used : EMFGraphics2D(org.freehep.graphicsio.emf.EMFGraphics2D) ImageGraphics2D(org.freehep.graphicsio.ImageGraphics2D) PDFGraphics2D(org.freehep.graphicsio.pdf.PDFGraphics2D) GIFGraphics2D(org.freehep.graphicsio.gif.GIFGraphics2D) SVGGraphics2D(org.freehep.graphicsio.svg.SVGGraphics2D) SWFGraphics2D(org.freehep.graphicsio.swf.SWFGraphics2D) PSGraphics2D(org.freehep.graphicsio.ps.PSGraphics2D) Properties(java.util.Properties) VectorGraphics(org.freehep.graphics2d.VectorGraphics)

Aggregations

Properties (java.util.Properties)1 VectorGraphics (org.freehep.graphics2d.VectorGraphics)1 ImageGraphics2D (org.freehep.graphicsio.ImageGraphics2D)1 EMFGraphics2D (org.freehep.graphicsio.emf.EMFGraphics2D)1 GIFGraphics2D (org.freehep.graphicsio.gif.GIFGraphics2D)1 PDFGraphics2D (org.freehep.graphicsio.pdf.PDFGraphics2D)1 PSGraphics2D (org.freehep.graphicsio.ps.PSGraphics2D)1 SVGGraphics2D (org.freehep.graphicsio.svg.SVGGraphics2D)1 SWFGraphics2D (org.freehep.graphicsio.swf.SWFGraphics2D)1