- public final static void writePhylogenyToGraphicsFileNonInteractive( final File outfile,
- final int width,
- final int height,
- final TreePanel tree_panel,
- final ControlPanel ac,
- final GraphicsExportType type,
- final Options options ) throws IOException {
- tree_panel.setParametersForPainting( width, height, true );
- tree_panel.resetPreferredSize();
- tree_panel.repaint();
- final RenderingHints rendering_hints = new RenderingHints( RenderingHints.KEY_RENDERING,
- RenderingHints.VALUE_RENDER_QUALITY );
- rendering_hints.put( RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY );
- if ( options.isAntialiasPrint() ) {
- rendering_hints.put( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
- rendering_hints.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
- }
- else {
- rendering_hints.put( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF );
- rendering_hints.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF );
- }
- final Phylogeny phylogeny = tree_panel.getPhylogeny();
- if ( ( phylogeny == null ) || phylogeny.isEmpty() ) {
- return;
- }
- if ( outfile.isDirectory() ) {
- throw new IOException( "\"" + outfile + "\" is a directory" );
- }
- final BufferedImage buffered_img = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB );
- final Graphics2D g2d = buffered_img.createGraphics();
- g2d.setRenderingHints( rendering_hints );
- tree_panel.paintPhylogeny( g2d, false, true, width, height, 0, 0 );
- if ( type == GraphicsExportType.TIFF ) {
- writeToTiff( outfile, buffered_img );
- }
- else {
- ImageIO.write( buffered_img, type.toString(), outfile );
- }
- g2d.dispose();
- }
-
- final static String writePhylogenyToGraphicsByteArrayOutputStream( final ByteArrayOutputStream baos,
- int width,
- int height,
- final TreePanel tree_panel,
- final ControlPanel ac,
- final GraphicsExportType type,
- final Options options ) throws IOException {