I'd like to draw a shape on a Graphics2D and colour a part of it different if it intersects a certain range. I managed to do this by drawing 2 shapes into a BufferedImage (the original shape and the area that will cause a change of colour) by using AlphaComposite and AlphaComposite.SRC_IN. The problem is that if the canvas is scrolled, the screen becomes laggy as every time the paint method is called, a buffered image is created.
Is there any way of achieving the same effect (2 shapes overlapping, only 2nd shape's overlap area is coloured) without using a buffered image object?
Cheers, Max