1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
Screenshots of unit tests:
<http://jogamp.org/files/screenshots/printing/test01-awt/>
Unit test producing the results:
Base Test Class:
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java;hb=HEAD>
AWT:
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java;hb=HEAD>
Swing:
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java;hb=HEAD>
Print code:
AWTPrintLifecycle:
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/javax/media/opengl/awt/AWTPrintLifecycle.java;hb=HEAD>
GLCanvas:
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/javax/media/opengl/awt/GLCanvas.java;hb=HEAD#l731>
...
AWTTilePainter (common code):
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java;hb=HEAD>
+++
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'
|