本文整理汇总了Java中de.erichseifert.vectorgraphics2d.SVGGraphics2D类的典型用法代码示例。如果您正苦于以下问题:Java SVGGraphics2D类的具体用法?Java SVGGraphics2D怎么用?Java SVGGraphics2D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SVGGraphics2D类属于de.erichseifert.vectorgraphics2d包,在下文中一共展示了SVGGraphics2D类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportAsSVG
import de.erichseifert.vectorgraphics2d.SVGGraphics2D; //导入依赖的package包/类
private void exportAsSVG(File file, MainWindow mainWindow, HiC hic, final JPanel hiCPanel,
final int w, final int h) {
try {
SVGGraphics2D g = new SVGGraphics2D(0, 0, w, h);
plotDataOnGraphics(g, mainWindow, w, h, hic, hiCPanel);
writeGraphicsToFile(g, file);
} catch (Exception e) {
System.err.println("Export SVG failed " + e);
}
}
示例2: toSvg
import de.erichseifert.vectorgraphics2d.SVGGraphics2D; //导入依赖的package包/类
String toSvg(double width, double height, double margin) {
Graphics2D g2 = new SVGGraphics2D(0, 0,
margin + width + margin,
margin + height + margin);
draw(AWTDrawVisitor.forVectorGraphics(g2),
new Rectangle2D.Double(margin, margin, width, height));
g2.dispose();
return g2.toString();
}
示例3: serialize
import de.erichseifert.vectorgraphics2d.SVGGraphics2D; //导入依赖的package包/类
@Override
public void serialize(File f, ProcessModel m) throws Exception {
Graphics2D g2;
// Create new ProcessEditor
ProcessEditor editor = new ProcessEditor(m);
editor.setEditable(false);
// Set preferred size
editor.setSize(editor.getPreferredSize().width,
editor.getPreferredSize().height);
/** SOURCE CODE FOR VECTORGRAPHICS2D FOLLOWS */
SVGGraphics2D pdfOutput = new SVGGraphics2D(
editor.getBounds().x,
editor.getBounds().y,
editor.getBounds().width,
editor.getBounds().height);
pdfOutput.setFontRendering(VectorGraphics2D.FontRendering.VECTORS);
editor.paint(pdfOutput);
byte[] output = pdfOutput.getBytes();
FileOutputStream fo = new FileOutputStream(f);
fo.write(output);
fo.close();
}