1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| /* buffered image destination */
public BufferedImage biDest;
/* tableau des buffered image sources créés à partir d'images png */
private BufferedImage[] biSrc;
public void composeImage(HttpServletRequest request) {
int heightInt = (new Integer(this.height)).intValue();
int widthInt = (new Integer(this.width)).intValue();
this.biDest = new BufferedImage(widthInt, heightInt, BufferedImage.TYPE_INT_ARGB);
int[] rgbs = new int[widthInt*heightInt];
for(int i=0;i<this.biSrc.length;i++) {
this.biSrc[i].getRGB(0, 0, widthInt, heightInt, rgbs, 0, widthInt);
this.biDest.setRGB(0, 0, widthInt, heightInt, rgbs, 0, widthInt);
}
try {
File destFile = new File(request.getRealPath("/temp/image.png"));
ImageIO.write(this.biDest, "png", destFile);
}
catch (Exception e) {
e.printStackTrace();
}
} |
Partager