private UGraphic2 createUGraphic( FileFormatOption fileFormatOption, final Dimension2D dim, Animation affineTransforms, double dx, double dy) { final FileFormat fileFormat = fileFormatOption.getFileFormat(); switch (fileFormat) { case PNG: return createUGraphicPNG( colorMapper, dpiFactor, dim, mybackcolor, affineTransforms, dx, dy); case SVG: return createUGraphicSVG( colorMapper, dpiFactor, dim, mybackcolor, fileFormatOption.getSvgLinkTarget()); case EPS: return new UGraphicEps(colorMapper, EpsStrategy.getDefault2()); case EPS_TEXT: return new UGraphicEps(colorMapper, EpsStrategy.WITH_MACRO_AND_TEXT); case HTML5: return new UGraphicHtml5(colorMapper); case VDX: return new UGraphicVdx(colorMapper); case LATEX: return new UGraphicTikz(colorMapper); default: throw new UnsupportedOperationException(fileFormat.toString()); } }
public ImageData writeImageTOBEMOVED(FileFormatOption fileFormatOption, OutputStream os) throws IOException { final FileFormat fileFormat = fileFormatOption.getFileFormat(); if (fileFormat == FileFormat.MJPEG) { return writeImageMjpeg(os); } else if (fileFormat == FileFormat.ANIMATED_GIF) { return writeImageAnimatedGif(os); } return writeImageTOBEMOVED(fileFormatOption, os, affineTransformations); }
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { if (fileFormat.getFileFormat() == FileFormat.ATXT) { os.write(getSource().getPlainString().getBytes()); return new ImageDataSimple(); } // ditaa can only export png so file format is mostly ignored final ConversionOptions options = new ConversionOptions(); options.setDropShadows(dropShadows); final TextGrid grid = new TextGrid(); grid.initialiseWithText(data, null); final Diagram diagram = new Diagram(grid, options, processingOptions); final BufferedImage image = (BufferedImage) new BitmapRenderer().renderToImage(diagram, options.renderingOptions); ImageIO.write(image, "png", os); return new ImageDataSimple(image.getWidth(), image.getHeight()); }