I have two JPanels on a JLayeredpane. One of them displays a pdf and the overlapping one has a transparent background (I have used setOpaque(false)). Now I can add drawings to t
Note that an instance of AlphaComposite.CLEAR
, equivalent to AlphaComposite.Clear
, is a composite mode that clears both the color and the alpha of the destination. "Neither the source nor the destination is used as input." In effect, you can't draw with CLEAR
. This example illustrates a common usage. To get the effect you want, keep a copy of the unaltered image and draw()
an eraser-sized sub-image over the destination BufferedImage
as the mouse moves.