Re: Painting Negative
- From: Flo 'Irian' Schaetz <iryan@xxxxxx>
- Date: Sun, 18 May 2008 12:38:38 +0200
And thus spoke Knute Johnson...
So the big question is: How can I fill everything EXCEPT the polygons?
Flo
There are a couple of ways to do this. The important thing to note is
that it is not possible to draw on a component and clear the alpha. You
can draw on a BufferedImage and do that however. In the example below,
I create a mask image that is black with an alpha hole in the middle.
Then in the paintComponent() method, I draw my subject image and then
draw the mask over the top of that image. In the portion where I have
the alpha hole, the image underneath shows through. You could put the
mask in a separate JPanel as long as you made sure that the JPanel was
set to transparent (setOpaque(false)).
Works like a charm, thanks.
Flo
.
- References:
- Painting Negative
- From: Flo 'Irian' Schaetz
- Re: Painting Negative
- From: Knute Johnson
- Painting Negative
- Prev by Date: Re: Painting Negative
- Next by Date: JButton with Multiple ImageIcons
- Previous by thread: Re: Painting Negative
- Next by thread: Re: Painting Negative
- Index(es):