diff options
author | Sven Gothel <[email protected]> | 2013-09-06 20:15:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-06 20:15:54 +0200 |
commit | 95d49687f5b9b783f3d8008df86df58cc0f9bfab (patch) | |
tree | 9ebaa590075856b83e9e2ee6593b007050f8566c /src/jogl/classes/javax/media/opengl | |
parent | 4840117d274f9042fc6528722c1af157ad36384e (diff) |
Add AWTPrintLifecycle interface describing impl. w/ setupPrint()/releasePrint(), modularize unit test TestTiledPrintingGearsAWT
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/AWTPrintLifecycle.java | 49 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 4 |
2 files changed, 52 insertions, 1 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/AWTPrintLifecycle.java b/src/jogl/classes/javax/media/opengl/awt/AWTPrintLifecycle.java new file mode 100644 index 000000000..afa27dbd8 --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/awt/AWTPrintLifecycle.java @@ -0,0 +1,49 @@ +package javax.media.opengl.awt; + +/** + * Copyright 2013 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +import javax.media.opengl.GLAutoDrawable; +import java.awt.Component; + +/** + * Interface describing print lifecycle to support AWT printing + * on AWT {@link GLAutoDrawable}s. + */ +public interface AWTPrintLifecycle { + + /** + * Shall be called before {@link Component#print(java.awt.Graphics)}. + */ + void setupPrint(); + + /** + * Shall be called after very last {@link Component#print(java.awt.Graphics)}. + */ + void releasePrint(); +} diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 02e6e8121..14cc08feb 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -167,7 +167,7 @@ import jogamp.opengl.GLDrawableImpl; */ @SuppressWarnings("serial") -public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosingProtocol, OffscreenLayerOption { +public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosingProtocol, OffscreenLayerOption, AWTPrintLifecycle { private static final boolean DEBUG = Debug.debug("GLCanvas"); @@ -745,6 +745,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private BufferedImage printVFlipImage = null; private Graphics2D printGraphics = null; + @Override public void setupPrint() { if( !validateGLDrawable() ) { if(DEBUG) { @@ -868,6 +869,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } }; + @Override public void releasePrint() { if( !printActive || null == printGLAD ) { throw new IllegalStateException("setupPrint() not called"); |