summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-09-27 13:49:59 +0200
committerSven Gothel <[email protected]>2013-09-27 13:49:59 +0200
commit469311764a1cb3c3af8439c1638160926741c1e5 (patch)
treeabacead9f574b85bb51e6ef2f49af2a99418afe4
parent9a8f9b9f7e6148b60b6f0f4326df8d213774284c (diff)
Test AWT Printing: Frame size contains border/insets, use as-is for scaling; Only force TEXT AA print-rendering hint.
-rwxr-xr-xmake/scripts/tests-osx-x64.sh1
-rw-r--r--make/scripts/tests.sh4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java21
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java10
5 files changed, 25 insertions, 27 deletions
diff --git a/make/scripts/tests-osx-x64.sh b/make/scripts/tests-osx-x64.sh
index 7585e68ad..1204b8a7b 100755
--- a/make/scripts/tests-osx-x64.sh
+++ b/make/scripts/tests-osx-x64.sh
@@ -4,6 +4,7 @@ export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
JAVA_HOME=`/usr/libexec/java_home -version 1.7`
#JAVA_HOME=`/usr/libexec/java_home -version 1.7.0_25`
+#JAVA_HOME=`/usr/libexec/java_home -version 1.6.0`
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 8c58efb3f..442b12672 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -332,7 +332,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering2GL2NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering3GL2AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT $*
+testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT2 $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingNIOImageSwingAWT $*
@@ -454,7 +454,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPosAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPosAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java
index 37ad8c361..bd526419c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java
@@ -31,6 +31,7 @@ import java.awt.Container;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
+import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
@@ -121,36 +122,34 @@ public class OffscreenPrintable extends PrintableBase implements Printable {
/**
* See: 'Scaling of Frame and GL content' in Class description!
+ * Note: Frame size contains the frame border (i.e. insets)!
*/
final Insets frameInsets = cont.getInsets();
final int frameWidth = cont.getWidth();
final int frameHeight= cont.getHeight();
- final int frameWidthT = frameWidth + frameInsets.left + frameInsets.right;
- final int frameHeightT = frameHeight + frameInsets.top + frameInsets.bottom;
final double scaleGraphics = dpi / 72.0;
- final int frameSWidthT = (int) ( frameWidthT * scaleGraphics );
- final int frameSHeightT = (int) ( frameHeightT * scaleGraphics );
+ final int frameSWidth = (int) ( frameWidth * scaleGraphics );
+ final int frameSHeight = (int) ( frameHeight * scaleGraphics );
final double scaleComp72;
{
- final double sx = pf.getImageableWidth() / (double)frameSWidthT;
- final double sy = pf.getImageableHeight() / (double)frameSHeightT;
+ final double sx = pf.getImageableWidth() / (double)frameSWidth;
+ final double sy = pf.getImageableHeight() / (double)frameSHeight;
scaleComp72 = Math.min(sx, sy);
}
System.err.println("PRINT.offscrn thread "+Thread.currentThread().getName());
System.err.println("PRINT.offscrn DPI: scaleGraphics "+scaleGraphics+", scaleComp72 "+scaleComp72);
System.err.println("PRINT.offscrn DPI: frame: border "+frameInsets+", size "+frameWidth+"x"+frameHeight+
- " -> total "+frameWidthT+ "x" + frameHeightT+
- " -> scaled "+frameSWidthT+ "x" + frameSHeightT);
+ " -> scaled "+frameSWidth+ "x" + frameSHeight);
- final BufferedImage image = DirectDataBufferInt.createBufferedImage(frameSWidthT, frameSHeightT, imageType, null /* location */, null /* properties */);
+ final BufferedImage image = DirectDataBufferInt.createBufferedImage(frameSWidth, frameSHeight, imageType, null /* location */, null /* properties */);
{
System.err.println("PRINT.offscrn image "+image);
final Graphics2D g2d = (Graphics2D) image.getGraphics();
- g2d.setClip(0, 0, frameSWidthT, frameSHeightT);
+ g2d.setClip(0, 0, frameSWidth, frameSHeight);
g2d.scale(scaleGraphics, scaleGraphics);
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- // g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
AWTEDTExecutor.singleton.invoke(true, new Runnable() {
public void run() {
cont.printAll(g2d);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java
index a23f7f8c3..7e8bac295 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java
@@ -120,33 +120,31 @@ public class OnscreenPrintable extends PrintableBase implements Printable {
/**
* See: 'Scaling of Frame and GL content' in Class description!
+ * Note: Frame size contains the frame border (i.e. insets)!
*/
final Insets frameInsets = cont.getInsets();
final int frameWidth = cont.getWidth();
final int frameHeight= cont.getHeight();
- final int frameWidthT = frameWidth + frameInsets.left + frameInsets.right;
- final int frameHeightT = frameHeight + frameInsets.top + frameInsets.bottom;
final double scaleGraphics = dpi / 72.0;
- final int frameSWidthT = (int) ( frameWidthT * scaleGraphics );
- final int frameSHeightT = (int) ( frameHeightT * scaleGraphics );
+ final int frameSWidth = (int) ( frameWidth * scaleGraphics );
+ final int frameSHeight = (int) ( frameHeight * scaleGraphics );
final double scaleComp72;
{
- final double sx = pf.getImageableWidth() / (double)frameWidthT;
- final double sy = pf.getImageableHeight() / (double)frameHeightT;
+ final double sx = pf.getImageableWidth() / (double)frameWidth;
+ final double sy = pf.getImageableHeight() / (double)frameHeight;
scaleComp72 = Math.min(sx, sy);
}
System.err.println("PRINT.onscrn thread "+Thread.currentThread().getName());
System.err.println("PRINT.onscrn DPI: scaleGraphics "+scaleGraphics+", scaleComp72 "+scaleComp72);
System.err.println("PRINT.onscrn DPI: frame: border "+frameInsets+", size "+frameWidth+"x"+frameHeight+
- " -> total "+frameWidthT+ "x" + frameHeightT+
- " -> scaled "+frameSWidthT+ "x" + frameSHeightT);
+ " -> scaled "+frameSWidth+ "x" + frameSHeight);
final Graphics2D g2d = (Graphics2D)g;
System.err.println("PRINT at.pre: "+g2d.getTransform());
g2d.translate(pf.getImageableX(), pf.getImageableY());
g2d.scale(scaleComp72, scaleComp72); // WARNING: Produces rounding artifacts due to diff scale-factor of AWT/GL comps !!!
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- // g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
AWTEDTExecutor.singleton.invoke(true, new Runnable() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
index 3198212b5..0fe08ebc2 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
@@ -36,6 +36,7 @@ import java.awt.Frame;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Label;
+import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
@@ -105,11 +106,10 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase {
final int imageWidth = image.getWidth();
final int imageHeight= image.getHeight();
final double scaleComp72;
+ // Note: Frame size contains the frame border (i.e. insets)!
{
- final double frameBorderW = frameInsets.left + frameInsets.right;
- final double frameBorderH = frameInsets.top + frameInsets.bottom;
- final double sx = (double)imageWidth / ( frameWidth + frameBorderW );
- final double sy = (double)imageHeight / ( frameHeight + frameBorderH );
+ final double sx = (double)imageWidth / frameWidth;
+ final double sy = (double)imageHeight / frameHeight;
scaleComp72 = Math.min(sx, sy);
}
System.err.println("PRINT DPI: scaleComp72 "+scaleComp72+", image-size "+imageWidth+"x"+imageHeight+", frame[border "+frameInsets+", size "+frameWidth+"x"+frameHeight+"]");
@@ -125,7 +125,7 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase {
g2d.setClip(0, 0, image.getWidth(), image.getHeight());
g2d.scale(scaleComp72, scaleComp72);
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- // g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// frame.paintAll(g2d);
final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(frame, 1.0/scaleComp72, 1.0/scaleComp72, 0);