JavaでPNG画像を描く
ちょいとテスト.黄色い線が一本引かれるだけ.→な感じ.
import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; import javax.imageio.ImageIO; public class PNGWriter { public static void main(String[] args) { PNGWriter write = new PNGWriter(); write.process(); } private void process() { BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); Graphics2D g = img.createGraphics(); drawFigs(g); try { ImageIO.write(img, "png", new File("test.png")); } catch (IOException e) { e.printStackTrace(); System.err.print("File Output Error"); } } private void drawFigs(Graphics2D g) { g.setPaint(Color.yellow); g.drawLine(10, 10, 90, 80); } }