How to set the background of binary image?
Hi All, I met a problem that can't set the background of the binary image which type is TYPE_BYTE_BINARY. It seem that the default color of image is black. I am try to set the background color as white. And I try to use the Graphics2D's setBackGround method, but it doesn't work. Can any body help?
// bi is a TYPE_BYTE_BINARY type BufferedImage
BufferedImage rbi = new BufferedImage(w, h, bi.getType());
Graphics2D g = rbi.createGraphics();
// The java api indicated that the setBackground method is for RGB color model
// after rotation the magrin is filled by black color.
g.rotate(Math.toRadians(angle), w / 2, h / 2);
g.drawImage(bi, null, 0, 0);