AlphaComposite.CLEAR not working

后端 未结 1 760
攒了一身酷
攒了一身酷 2021-01-28 17:37

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

相关标签:
1条回答
  • 2021-01-28 18:18

    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.

    0 讨论(0)
提交回复
热议问题