public interface AWTPrintLifecycle
GLAutoDrawable
s.
Implementing GLAutoDrawable
classes based on AWT
supporting Component.print(Graphics)
shall implement this interface.
Users attempting to print an AWT Container
containing AWTPrintLifecycle
elements
shall consider decorating the Component.printAll(Graphics)
call with
setupPrint(..)
and releasePrint()
on all AWTPrintLifecycle
elements in the Container
.
To minimize this burden, a user can use Context.setupPrint(..)
:
Graphics2D g2d; Frame frame; double scaleGLMatXY = 72.0/glDPI; ... final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(frame, g2d, scaleGLMatXY, scaleGLMatXY); try { AWTEDTExecutor.singleton.invoke(true, new Runnable() { public void run() { frame.printAll(g2d); } }); } finally { ctx.releasePrint(); }
Modifier and Type | Interface and Description |
---|---|
static class |
AWTPrintLifecycle.Context
Convenient
AWTPrintLifecycle context simplifying calling setupPrint(..)
and releasePrint() on all AWTPrintLifecycle elements of a Container . |
Modifier and Type | Method and Description |
---|---|
void |
releasePrint()
Shall be called after very last
Component.print(Graphics) . |
void |
setupPrint(Graphics2D g2d,
double scaleMatX,
double scaleMatY)
Shall be called before
Component.print(Graphics) . |
void setupPrint(Graphics2D g2d, double scaleMatX, double scaleMatY)
Component.print(Graphics)
.
See Usage.
g2d
- the Graphics2D
instance, which will be used for printing.scaleMatX
- Graphics2D
scaling factor
, i.e. rendering 1/scaleMatX * width pixelsscaleMatY
- Graphics2D
scaling factor
, i.e. rendering 1/scaleMatY * height pixelsvoid releasePrint()
Component.print(Graphics)
.
See Usage.
Copyright 2010 JogAmp Community.