// undefined color, seems to be all black in practice // This is without alpha? static BufferedImage newBufferedImage(int w, int h) { ret new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); } ifclass RGB static BufferedImage newBufferedImage(int w, int h, RGB rgb) { ret newBufferedImage(w, h, rgb.getColor()); } endif static BufferedImage newBufferedImage(int w, int h, Color color) { BufferedImage img = newBufferedImage(w, h); Graphics2D g = img.createGraphics(); g.setColor(or(color, Color.white)); g.fillRect(0, 0, w, h); ret img; } ifclass Pt static BufferedImage newBufferedImage(Pt p, Color color) { ret newBufferedImage(p.x, p.y, color); } endif ifclass WidthAndHeight static BufferedImage newBufferedImage(WidthAndHeight size, Color color) { ret newBufferedImage(size.w(), size.h(), color); } endif // This one is with alpha... static BufferedImage newBufferedImage(int w, int h, int[] pixels) { ret intArrayToBufferedImage(pixels, w, h); }