use of org.freehep.graphicsio.ps.PSGraphics2D 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;
}
use of org.freehep.graphicsio.ps.PSGraphics2D in project cytoscape-impl by cytoscape.
the class PSWriter method run.
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
taskMonitor.setProgress(0.0);
taskMonitor.setStatusMessage("PS image rendering start...");
logger.debug("PS image rendering start.");
// TODO should be accomplished with presentation properties
// view.setPrintingTextAsShape(!exportTextAsFont);
final Properties p = new Properties();
p.setProperty(PSGraphics2D.PAGE_SIZE, "Letter");
p.setProperty("org.freehep.graphicsio.AbstractVectorGraphicsIO.TEXT_AS_SHAPES", Boolean.toString(!exportTextAsFont));
taskMonitor.setProgress(0.1);
PSGraphics2D g = new PSGraphics2D(stream, new Dimension(width.intValue(), height.intValue()));
// true for PS file
g.setMultiPage(false);
g.setProperties(p);
taskMonitor.setProgress(0.2);
g.startExport();
engine.printCanvas(g);
g.endExport();
logger.debug("PS image created.");
taskMonitor.setStatusMessage("PS image created.");
taskMonitor.setProgress(1.0);
}
use of org.freehep.graphicsio.ps.PSGraphics2D in project clusterMaker2 by RBVI.
the class GraphicsExportPanel method epsSave.
private void epsSave(String format) {
com.itextpdf.text.Rectangle pageSize = PageSize.LETTER;
Properties p = new Properties();
p.setProperty(PSGraphics2D.PAGE_SIZE, "Letter");
p.setProperty("org.freehep.graphicsio.AbstractVectorGraphicsIO.TEXT_AS_SHAPES", Boolean.toString(false));
try {
OutputStream output = new BufferedOutputStream(new FileOutputStream(getFile()));
PSGraphics2D g = new PSGraphics2D(output, view);
double imageScale = Math.min(pageSize.getWidth() / ((double) estimateWidth() + getBorderPixels()), pageSize.getHeight() / ((double) estimateHeight() + getBorderPixels()));
g.setMultiPage(false);
g.setProperties(p);
g.startExport();
g.scale(imageScale, imageScale);
drawAll(g, 1.0);
g.endExport();
output.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(this, new JTextArea("Dendrogram export had problem " + e));
// logger.error("Exception " + e);
// e.printStackTrace();
}
}
Aggregations