Mulitple clip regions
I have created an application that will blur an image and display it in a JPanel. I have also created something I call a Spotlight. Basically, it tracks the mouse, and displays a circular region on the blurred image that actually draws the image unblured. I implemented this effect by overriding the paintComponent method thusly:
protected void paintSpotlight(Graphics g)
Area clipRegion = new Area( getSpotlight().getArea() );
Graphics2D g2 = ( Graphics2D ) g;
int width = getWidth();
int height = getHeight();
if( getBlurredImage() != null )
width = getBlurredImage().getWidth()
height = getBlurredImage().getHeight();
g2.drawImage( getBlurredImage(), 0, 0, width, height, null );
g2.setClip( clipRegion );
g2.drawImage( getUnblurredImage(), 0, 0, width, height, null );
This all works well.
What I'd like to do now is have multiple Spotlights. In other words, I'd like to have kind of a "swiss cheese" effect, where I have the blurred image with little sections of unblurred image showing in various places.
I've tried looping through the Spotlights and setting the adding to the clip region for each time, but that didn't work. It drew the entire image unblurred.
Any suggestions or pointers would be appreciated.