1 34 35 package org.krysalis.jcharts.encoders; 36 37 38 import org.krysalis.jcharts.Chart; 39 import org.krysalis.jcharts.chartData.ChartDataException; 40 import org.krysalis.jcharts.properties.PropertyException; 41 42 import java.awt.image.BufferedImage ; 43 44 45 50 public class BinaryEncoderUtil 51 { 52 53 57 private BinaryEncoderUtil() throws Exception 58 { 59 throw new Exception ( "No need to create an instance of this class!" ); 60 } 61 62 63 70 static BufferedImage render( Chart chart ) throws ChartDataException, PropertyException 71 { 72 BufferedImage bufferedImage = null; 73 74 if( chart.getGenerateImageMapFlag() ) 77 { 78 bufferedImage = chart.getBufferedImage(); 79 } 80 else 82 { 83 bufferedImage = new BufferedImage ( chart.getImageWidth(), chart.getImageHeight(), BufferedImage.TYPE_INT_RGB ); 84 chart.setGraphics2D( bufferedImage.createGraphics() ); 85 chart.render(); 86 } 87 88 return bufferedImage; 89 } 90 } 91 92 93 | Popular Tags |