I have code that combines two BufferedImage objects, each one representing a separate color channel (red and blue). Currently I am doing:
int p, q, g, b;
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
p = img0.getRGB(x, y) & 0xff00;
q = img1开发者_如何学Python.getRGB(x, y) & 0xff;
fused.setRGB(x, y, p | q);
}
}
However, this is rather slow for a 2000x2000 image. Is there a faster way to do this via the Java2D or JAI API's? I've read up on the AlphaComposite class, but that seems to combine images based on transparency, rather than actually merge channels.
Any pointers would be appreciated.
精彩评论