Roman Kennke wrote:
Hi Gary,


The setComposite method of anything that extends java.awt.
Graphics2D is supposed to do a permisson check if "...this
Graphics2D context is drawing to a Component on the display
screen and the Composite is a custom object rather than an
instance of the AlphaComposite class."  The latter is easy
to check, but how do I tell whether the context is drawing
to a Component on the display screen?

Only one subclass of CairoGraphics2D draws on the screen, I
think this is ComponentGraphics.

Ok.  Do you know about its subclass, VolatileImageGraphics?


VolatileImage doesn't draw on the screen. It draws on a backbuffer (an
XImage really). I don't know if that counts as drawing on screen though.
Because the backbuffer should be synced with the screen sooner or later.
But maybe you try against the JDK (Component.createVolatileImage() gives
you a VolatileImage instance).


The check is for "readDisplayPixels", so something that is not visible would seem to be exempt.

David Daney.

Reply via email to