I have a problem with ColourGradient, whereby gradients are not rendering correctly when the Graphics context points at an Image.
My Component draws a graph background, and ordinarily looks like this:
Because it uses some gradients and fonts to draw the grid/scale, I want to cache the background to an Image. However, calling setBufferedToImage(true) on the Component results in it looking like this:
There are four linear gradients, one at each edge of the graph area, which are supposed to fade between the background colour with high alpha at the outer edge, and the same colour with zero alpha at the inner edge.
On the buffered version, the gradients seem to be both drawing a darker colour than the background, and
are also darker in the middle of the shaded rectangle.
I get exactly the same problem if I disable setBufferedToImage, but create an Image and render to it using a new Graphics context, then copy that image to the screen in paint().
This is on Mac, by the way. I’ve not had a chance to test to see if this happens on PC yet.