public void export(CyNetworkView view, FileOutputStream stream) throws IOException { InternalFrameComponent ifc = Cytoscape.getDesktop().getNetworkViewManager().getInternalFrameComponent(view); int width = (int) (ifc.getWidth() * scale); int height = (int) (ifc.getHeight() * scale); // CyLogger.getLogger().info("Exporting "+width+"X"+height+" image"); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g = (Graphics2D) image.getGraphics(); g.scale(scale, scale); ifc.print(g); g.dispose(); ImageIO.write(image, extension, stream); } }
/** * Constructor. * * @param layeredPane JLayedPane * @param dGraphView dGraphView */ public InternalFrameComponent(JLayeredPane layeredPane, DGraphView dGraphView) { // init members this.layeredPane = layeredPane; this.backgroundCanvas = dGraphView.getCanvas(DGraphView.Canvas.BACKGROUND_CANVAS); this.networkCanvas = dGraphView.getCanvas(DGraphView.Canvas.NETWORK_CANVAS); this.foregroundCanvas = dGraphView.getCanvas(DGraphView.Canvas.FOREGROUND_CANVAS); // set default ordering initLayeredPane(); }
public void export(final CyNetworkView view, final FileOutputStream stream) { final InternalFrameComponent ifc = Cytoscape.getDesktop() .getNetworkViewManager().getInternalFrameComponent(view); final ExportBitmapOptionsDialog dialog = new ExportBitmapOptionsDialog(ifc.getWidth(), ifc.getHeight()); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { BitmapExporter exporter = new BitmapExporter(extension, dialog.getZoom()); dialog.dispose(); ExportTask.run("Exporting to " + extension, exporter, view, stream); } }; dialog.addActionListener(listener); dialog.setVisible(true); } }
public void export(CyNetworkView view, FileOutputStream stream) throws IOException { DingNetworkView theView = (DingNetworkView) view; theView.setPrintingTextAsShape(!exportTextAsFont); InternalFrameComponent ifc = Cytoscape.getDesktop().getNetworkViewManager().getInternalFrameComponent(view); Properties p = new Properties(); p.setProperty(PSGraphics2D.PAGE_SIZE,"Letter"); p.setProperty("org.freehep.graphicsio.AbstractVectorGraphicsIO.TEXT_AS_SHAPES", Boolean.toString(!exportTextAsFont)); PSGraphics2D g = new PSGraphics2D(stream,ifc); g.setMultiPage(false); g.setProperties(p); g.startExport(); ifc.printWithoutForeground(g); g.endExport(); }
public void export(CyNetworkView view, FileOutputStream stream) throws IOException { DingNetworkView theView = (DingNetworkView) view; theView.setPrintingTextAsShape(!exportTextAsFont); InternalFrameComponent ifc = Cytoscape.getDesktop().getNetworkViewManager().getInternalFrameComponent(view); SVGGraphics2D g = new SVGGraphics2D(stream, ifc); // this sets text as shape java.util.Properties p = new java.util.Properties(); p.setProperty("org.freehep.graphicsio.AbstractVectorGraphicsIO.TEXT_AS_SHAPES", Boolean.toString(!exportTextAsFont)); g.setProperties(p); g.startExport(); ifc.print(g); g.endExport(); }
new InternalFrameComponent(iframe.getLayeredPane(), (DGraphView) view);