Screenshots of unit tests:
Unit test producing the results:
Base Test Class:
AWT:
Swing:
Print code:
AWTPrintLifecycle:
GLCanvas:
...
AWTTilePainter (common code):
+++
Enhance lifecycle for AWT printing via AWTPrintLifecycle:
We fit the frame into the imageable area with for 72 dpi,
assuming that is the default AWT painting density.
The frame borders are considered.
The frame's scale factor 'scaleComp72' is used for the graphics print matrix
of the overall print-job, hence no frame resize is required.
The GL scale factor 'scaleGLMatXY', 72dpi/glDPI, is passed to the GL object
which locally scales the print matrix and renders the scene with 1/scaleGLMatXY pixels.
Before printing, we setup the GLCanvas, ..:
- move GLContext and GLEventListener -> offscreen
- offscreen is of tile-size
this is performed w/ AWTPrintLifecycle.setupPrint(..).
Impl. in GLCanvas, etc.
After printing, AWTPrintLifecycle.releasePrint() shall be called. Impl. in GLCanvas .. etc.
To perform AWTPrintLifecycle on all component in one container,
one may use:
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();
}
+++
Tiled rendering is used, i.e. at print(Graphics g),
the clip bounds is used to setup the TiledRenderer's
image size and the impl. renders all tiles.
For the tiled reshape, a user component,
i.e. GLEventListener reshape(x, y, width, height),
needs to know about the current tile's position and image size.
The tile size itself is passed as width and height
as this is being used to set the current viewport.
Hence the GLEventListener shall implement the
TileRendererBase.TileRendererNotify interface!
+++
Bugs:
- None in results
- GLCanvas: Workaround bug where onscreen MSAA cannot switch to offscreen FBO,
i.e. stay 'onscreen'