Bug 829 - Add AWT Printing Support
Summary: Add AWT Printing Support
Alias: None
Product: Jogl
Classification: JogAmp
Component: awt (show other bugs)
Version: 2
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
Depends on: 828
  Show dependency treegraph
Reported: 2013-09-08 20:14 CEST by Sven Gothel
Modified: 2015-09-27 03:14 CEST (History)
1 user (show)

See Also:
SCM Refs:
cd2b491d593b7dc4deecf023c359a0385d9bf242 6ef3c22ac6d633f8c0b903b34d5e3d7736f3a040 de538efc92346cada023a6045d8aec3cbdd47e08 c527f824d7769dac07ff3e064f216fb664742494 4840117d274f9042fc6528722c1af157ad36384e 95d49687f5b9b783f3d8008df86df58cc0f9bfab b780eff49b626bd8429e1e87609f7a917f7b094e 27c4a837580c7a68582e852d5ff64f733e669509 4b5e77961d1c660f3537f4041fc1a3ce47ef105c 9b5cee85c299e72735bebbfea5c23d3c71bc704e 76048cd784ea6df32f19e97bb228e4ead880ea07 c654bf3605ff4dca6d8231c2fe8b4db8e6b22b4c 78b65d52385f4a15e4357d0444ea9daec54fb173 c9935d087350630f25046b5b757941fbef3a6044 541701f5803c5005864efcb09a0c4aacecb470f9 fb6440fb6e4fac31d03799d5cf804d02c78f2c38 badc13213bcf952830afe606ba71683540aba5a3 597ca0edc8ba536e82494b56bd1bbd6f8290efa6 d2be196ba129ff5b690189a95ba21137523c3352 569c538b439275222ed40c249f4ecd7516c2945b 8d212bec7f6968a3d7e7af6bbbe9c394820f2a65 cc27031a8199cdd9d9702d936af6e5d23c12e7d8 5e3ee6c19a4291b309deb572d434f1c5df975024 52f348c1a58e12c16bea87cf6951be344b8663ed 5a946df8fd812570826f267d4123b59d79c97cf7 c2ce31e11eefcf1b900c0e9b41264f5d5566dc46 efa8a7927eb8c69e45787d15306e172e440c6150 06b47d1f738c94ca28c0959a12b05d880bc8a78b 8afc1091532b0f18f30325aa3a504e7a7e975ce9 4e1d3170667d6692c484b8366d578ab830408175 988da6f30322176b8301d17709f5461c35a01e19 5ee2fa951894ee3fdaab7b002e475c173ab5cf17 8a4a64e1a3e9beb09580ba95fe85026abf2ff106 939d6304d464e69b1d1d2a104c3da5536d3bf326 2f09d266f75dfb4ab0d4504dd0a7699757bc40b3 7ec812589190c0fbc6916cc22d9b74f009244f5c 4ef53cf2ae509a625795bfa3a8982ce75e24e83a 469311764a1cb3c3af8439c1638160926741c1e5 c943c8cfc39df64ec6682722e86a54c538d3497b c8abb9d2c9a8c92f0c5c42aba13e3e80c69739dc fe284b515d984198fdbe702837809f181625a457 67200852b972f244ecc19d0c54b2f8d8080b0824
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2013-09-08 20:14:47 CEST
JOGL's GLAutoDrawable's attached to AWT (GLCanvas, GLJPanel and NewtCanvasAWT)
should support AWT printing.

Tiled rendering shall be used, i.e. at print(Graphics g),
the clip bounds shall 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!


It should be possible to pass a custom scale factor 
to the JOGL GL component, allowing to print itself at high DPI!


Allowing to move on- and offscreen, 
the AWT print(Graphics g) call to a frame containing a 
JOGL component supporting printing
shall decorate it's printAll(..) call with start/end semantics.

Such impl. shall impl the interface AWTPrintLifecycle,
and hence are intrinsically marked.

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() {
           } });
    } finally {
Comment 2 Sven Gothel 2013-09-19 06:30:53 CEST
Bug fixes and enhancements, see summary below:

[597ca0edc8ba536e82494b56bd1bbd6f8290efa6 .. 

  - Null Clip
  - Avoid multiple GLEL init(..) call when attached to tiling
  - No GL-Orientation (i.e. Windows BITMAP)
  - Fix issues w/ overlapping and/or non-opaque contents ; Change AWTPrintLifecycle's lifecycle
  - Add 'DirectDataBufferInt' supporting NIO based BufferedImages
  -  Move init-test of setupPrint(..) to AWT-EDT Runnable
  - GLJPanel: Attempt to initialize if not done yet (similar to GLCanvas)
  - AWTTilePainter: 
    - Use 'Shape getClip()'; 
    - Use double precicion clip bounds 'all the way'
    - Explicitly scale image and clip w/ current scaled transform.

  - TileRenderer: Add and expose clipped image size; Expose size of tiles.
Comment 3 Sven Gothel 2013-09-20 12:33:30 CEST
939d6304d464e69b1d1d2a104c3da5536d3bf326 fixes
non vertical-flipped printing, i.e. cut-off top-row's tile upper area.
Comment 4 Sven Gothel 2013-09-28 11:40:17 CEST
Further fixes and enhancements ..

2f09d266f75dfb4ab0d4504dd0a7699757bc40b3 Remove redundant reshape w/ TR/GLEL
7ec812589190c0fbc6916cc22d9b74f009244f5c  DirectDataBufferInt: support all BufferedImage int types
4ef53cf2ae509a625795bfa3a8982ce75e24e83a TileRendererListener w/ clarifying functionality
469311764a1cb3c3af8439c1638160926741c1e5 Test AWT Printing: Frame size contains border/insets
c943c8cfc39df64ec6682722e86a54c538d3497b Fix AWT Printing: Use delegated GLDrawable's size for tile-size instead of AWT-GLAD's size
c8abb9d2c9a8c92f0c5c42aba13e3e80c69739dc TileRendererBase.GLEL.display(): Skip tile-rendering if TR is not yet setup
fe284b515d984198fdbe702837809f181625a457 AWT Printing: releasePrint() issue reshape from AWT-EDT; GLJPanel: Issue 'handleReshape' if panelSize/awtSize mismatch ...