What is the relationship between a BufferedImage and a RenderOP?
At present I am working on an app, and the purpose is to compare two pictures, make their difference a new image, then encode it to a JPEG stream.
Before, I used the BufferedImage to do this, but it seems to take a long time to grab the pixels information from the image(1024*768 about 60ms). Though processing the pixels just took 10ms, seeming very fast, trying to create a new BufferedImge was another hard job, taking about 100ms.
Because the time is very important in this project, I was suggested to use the JAI. It seems wonderful, for example, I can compare the two image through the xor method, and it is so fast. But another problem came out, it uses a different image type--RenderOP. And I am just wondering the relationship between it and the former BufferedImage. It seems as if I must at first change the BufferedImage to RenderOP. And using create method, it takes terribly 600ms, which is intolerable. Is there any better method? Because at first i must capture the desktop picture, the method in robot seems the only way to archieve it, and it return us a BufferedImage. So I must transform it into RenderOP to go on with the processing.
And another problem is about making the JPEG stream. Before, I used the method in com.sun.image.codec.jpeg which can process a BufferedImage, and just take 90ms. When I used the JAI's com.sun.media.jai.codec.ImageCodec, which processes a RenderOP, it took 300ms, terrible. Are the two method same? How could their efficiency differ so much? And I think the JAI should have a better effiiciency.
OK. Above is my problem, I was puzzled. I am wondering do we have a good method in the transforming between a BufferedImage and a RenderOP? And can I find a efficient way to achieve my goal in the project?And also do we have any other methods to capture a desktop?
Thanks so much.
(Above ms means millisecond)

