Posted by mkae
on May 25, 2010 at 1:48 PM PDT
Good evening all,
I'm new at posting here (though not at reading :p)... I am currently facing an issue, that may have to do with hardware acceleration under Windows/Java 1.6 (u19) VS. non-accelerated BufferedImages. I googled for this issue, searched these forums, and read further about VolatileImages as well... hopefully you can point me in the right direction or give suggestions. Here is some context :
In order to draw components with rounded corners (cropped), I am splitting the paint job into 3 areas, the center area being painted directly to the current graphic context, the left and right areas being painted to BufferedImages, so that I can use an AlphaComposite to create the rounded corners "mask". See issue 1 in the following screenshot http://sl8er.free.fr/java/bufferedimage-volatileimage.png .
As you can see, I have a color difference between areas using accelerated rendering (outlined in green), and areas using BufferedImages (outlined in orange).
If my diagnosis is right, one trick could be to use VolatileImages instead, so indeed in that case, the color difference goes away, but I have now problems with drawing VolatileImage to another VolatileImage's graphic context (see issue 2 in the screenshot). Compositing of my rounded corners "mask" is broken over the intersection of the two areas using VolatileImage. Question: is this considered as a contentsLoss or is it something else?
I would be very grateful if somebody could point me to the right direction to fix one of these two issues.