/** * */ public static BufferedImage createBufferedImage(mxGraph graph, Object[] cells, double scale, Color background, boolean antiAlias, mxRectangle clip) { return createBufferedImage(graph, cells, scale, background, antiAlias, clip, new mxGraphics2DCanvas()); }
/** * */ public static BufferedImage createBufferedImage(mxGraph graph, Object[] cells, double scale, Color background, boolean antiAlias, mxRectangle clip) { return createBufferedImage(graph, cells, scale, background, antiAlias, clip, new mxGraphics2DCanvas()); }
@Override public void generatePng(@Nonnull FlowDefinition<?> definition, @Nullable ExecutionHistoryForRendering history, @Nonnull OutputStream out) throws IOException { mxGraph graph = renderGraph(definition); RenderedImage img = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, false, null); ImageIO.write(img, "png", out); }
@Override public void generatePng(@Nonnull FlowDefinition<?> definition, @Nullable ExecutionHistoryForRendering history, @Nonnull OutputStream out) throws IOException { mxGraph graph = renderGraph(definition); RenderedImage img = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, false, null); ImageIO.write(img, "png", out); }
@Override public void generatePng(@Nonnull FlowDefinition<?> definition, @Nullable ExecutionHistoryForRendering history, @Nonnull OutputStream out) throws IOException { mxGraph graph = renderGraph(definition); RenderedImage img = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, false, null); ImageIO.write(img, "png", out); }
private static byte[] renderGraphImpl(ProcessDefinition<?> definicao) { final mxGraph graph = renderGraph(definicao); final RenderedImage img = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, false, null); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try { ImageIO.write(img, "png", out); } catch (final IOException e) { throw Throwables.propagate(e); } return out.toByteArray(); }
private FileEntry createScreenshotEntry(File imageFile, mxGraph graph, ReporterConfiguration reporterConfiguration) throws IOException { final BufferedImage bufferedImage = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, true, null); ImageIO.write(bufferedImage, "PNG", imageFile); final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory()); final Path relativize = rootDir.relativize(imageFile.toPath()); return new FileEntry(relativize); }
@Override public BufferedImage generateBufferedImage() { mxGraph graph = getGraph(); return mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, true, null, createGraphComponent(graph).getCanvas()); }
public void captureUndecorated() { final BufferedImage image = mxCellRenderer.createBufferedImage( graph, null, 1, Color.WHITE, true, null, gui.graphComponent.getCanvas() ); final ImagePlus imp = new ImagePlus( "TrackScheme capture", image ); imp.show(); }
public void captureUndecorated() { final BufferedImage image = mxCellRenderer.createBufferedImage( graph, null, 1, Color.WHITE, true, null, gui.graphComponent.getCanvas() ); final ImagePlus imp = new ImagePlus( "TrackScheme capture", image ); imp.show(); }
/** * */ public ImageIcon createTransferableImage(mxGraphComponent graphComponent, Object[] cells) { ImageIcon icon = null; Color bg = (transferImageBackground != null) ? transferImageBackground : graphComponent.getBackground(); Image img = mxCellRenderer.createBufferedImage( graphComponent.getGraph(), cells, 1, bg, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); if (img != null) { icon = new ImageIcon(img); } return icon; }
/** * */ public ImageIcon createTransferableImage(mxGraphComponent graphComponent, Object[] cells) { ImageIcon icon = null; Color bg = (transferImageBackground != null) ? transferImageBackground : graphComponent.getBackground(); Image img = mxCellRenderer.createBufferedImage( graphComponent.getGraph(), cells, 1, bg, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); if (img != null) { icon = new ImageIcon(img); } return icon; }
BufferedImage image = mxCellRenderer.createBufferedImage(adapter, null, 1, Color.WHITE, true, null); mxPngEncodeParam param = mxPngEncodeParam.getDefaultEncodeParam(image);
/** * Saves XML+PNG format. * @param frame */ protected void saveXmlPng(TrackSchemeFrame frame, String filename, Color bg) throws IOException { final mxGraphComponent graphComponent = trackScheme.getGUI().graphComponent; final mxGraph graph = trackScheme.getGraph(); // Creates the image for the PNG file BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, bg, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); // Creates the URL-encoded XML data mxCodec codec = new mxCodec(); String xml = URLEncoder.encode(mxXmlUtils.getXml(codec.encode(graph.getModel())), "UTF-8"); mxPngEncodeParam param = mxPngEncodeParam.getDefaultEncodeParam(image); param.setCompressedText(new String[] { "mxGraphModel", xml }); // Saves as a PNG file try (FileOutputStream outputStream = new FileOutputStream( new File( filename ) )) { mxPngImageEncoder encoder = new mxPngImageEncoder( outputStream, param ); if ( image != null ) encoder.encode( image ); else JOptionPane.showMessageDialog( graphComponent, "No Image Data" ); } }
saveXmlPng(trackScheme.getGUI(), filename, bg); } else { BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, bg, graphComponent.isAntiAlias(), null, graphComponent.getCanvas());
/** * Saves XML+PNG format. * @param frame */ protected void saveXmlPng(TrackSchemeFrame frame, String filename, Color bg) throws IOException { final mxGraphComponent graphComponent = trackScheme.getGUI().graphComponent; final mxGraph graph = trackScheme.getGraph(); // Creates the image for the PNG file BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, bg, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); // Creates the URL-encoded XML data mxCodec codec = new mxCodec(); String xml = URLEncoder.encode(mxXmlUtils.getXml(codec.encode(graph.getModel())), "UTF-8"); mxPngEncodeParam param = mxPngEncodeParam.getDefaultEncodeParam(image); param.setCompressedText(new String[] { "mxGraphModel", xml }); // Saves as a PNG file try (FileOutputStream outputStream = new FileOutputStream( new File( filename ) )) { mxPngImageEncoder encoder = new mxPngImageEncoder( outputStream, param ); if ( image != null ) encoder.encode( image ); else JOptionPane.showMessageDialog( graphComponent, "No Image Data" ); } }
saveXmlPng(trackScheme.getGUI(), filename, bg); } else { BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, bg, graphComponent.isAntiAlias(), null, graphComponent.getCanvas());
/** * */ public void updateDragImage(Object[] cells) { dragImage = null; if (cells != null && cells.length > 0) { Image img = mxCellRenderer.createBufferedImage( graphComponent.getGraph(), cells, graphComponent.getGraph() .getView().getScale(), null, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); if (img != null) { dragImage = new ImageIcon(img); previewBounds.setSize(dragImage.getIconWidth(), dragImage.getIconHeight()); } } }
/** * */ public void updateDragImage(Object[] cells) { dragImage = null; if (cells != null && cells.length > 0) { Image img = mxCellRenderer.createBufferedImage( graphComponent.getGraph(), cells, graphComponent.getGraph() .getView().getScale(), null, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); if (img != null) { dragImage = new ImageIcon(img); previewBounds.setSize(dragImage.getIconWidth(), dragImage.getIconHeight()); } } }
BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, true, null); mxPngEncodeParam param = mxPngEncodeParam.getDefaultEncodeParam(image);