public static void main(String[] args) throws IOException {
BufferedImage img = new BufferedImage(200, 200,
BufferedImage.TYPE_INT_BGR);
int w = img.getWidth(null); // Imageの幅
int h = img.getHeight(null);
Graphics g = img.getGraphics();
g.setColor(Color.WHITE); // 白
g.fillRect(0, 0, w, h);
g.setColor(Color.BLACK); // 黒
g.drawLine(10, 10, 100, 100);
g.dispose();
ImageIO.write(img, "png", new File("test.png"));
int[] px = img.getRGB(0, 0, w, h, null, 0, w);
}
0 件のコメント:
コメントを投稿