1 import java.awt.image.BufferedImage ; 2 import java.io.File ; 3 import java.io.IOException ; 4 5 import javax.imageio.ImageIO ; 6 7 import jcckit.Graphics2DPlotCanvas; 8 import jcckit.data.DataPlot; 9 import jcckit.util.ConfigParameters; 10 import jcckit.util.PropertiesBasedConfigData; 11 12 15 public class ImagePlotter 16 { 17 public static void main(String [] args) throws IOException  18 { 19 System.getProperties().setProperty("java.awt.headless", "true"); 20 21 if (args.length < 3) 23 { 24 System.out.println("Usage: java -cp classycle.jar ImagePlotter " 25 + "<properties file> <width> <height>"); 26 System.exit(0); 27 } 28 String propertiesFile = args[0]; 29 int width = Integer.parseInt(args[1]); 30 int height = Integer.parseInt(args[2]); 31 32 ConfigParameters config 34 = new ConfigParameters(new PropertiesBasedConfigData(propertiesFile)); 35 Graphics2DPlotCanvas plotCanvas = new Graphics2DPlotCanvas(config); 36 plotCanvas.connect(DataPlot.create(config)); 37 plotCanvas.setDoubleBuffering(false); 38 39 System.getProperties().setProperty("java.awt.headless", "true"); 41 BufferedImage image 42 = new BufferedImage (width, height, BufferedImage.TYPE_INT_RGB); 43 plotCanvas.draw2DInto(image); 44 45 ImageIO.write(image, "png", new File (propertiesFile + ".png")); 47 } 48 } 49 | Popular Tags |