I need to create a rectangular BufferedImage with specified color as a background, draw some pattern on the background and save it to file. My problem comes from how to create the background,I am using nexted loop:
BufferedImage b_img = ...
for every row
for every column
Get the graphics object for the image, set the current paint to the desired colour, then call
BufferedImage b_img = ... Graphics2D graphics = b_img.createGraphics(); graphics.setPaint ( new Color ( r, g, b ) ); graphics.fillRect ( 0, 0, b_img.getWidth(), b_img.getHeight() );