diff options
author | Sven Gothel <[email protected]> | 2013-09-08 03:02:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-08 03:02:36 +0200 |
commit | 76048cd784ea6df32f19e97bb228e4ead880ea07 (patch) | |
tree | 38f86d539cfd27d8f784f767b00904342b9b42b3 /src/test | |
parent | 9b5cee85c299e72735bebbfea5c23d3c71bc704e (diff) |
Test: Don't resize frame, tweek print-matrix; AWTPrintLifecycle: Add scale and convenient AWT container traversal context; GLCanvas/GLJPanel properly handle existing MSAA and req. AA;
- Test: Don't resize frame, tweek print-matrix
- Use scaleComp72 to scale the frame to fit on page,
i.e. global print matrix
- Use scaleGLMatXY = 72.0 / glDPI
to locally scale on the GL drawable as being passed to AWTPrintLifecycle.setup(..)
- Hence frame stays untouched/stable, no need for 'offscreen' print test,
which is removed.
- AWTPrintLifecycle: Add scale and convenient AWT container traversal context
Use a simple decoration for all AWTPrintLifecycle impl. components within a container:
final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(frame, g2d, scaleGLMatXY, scaleGLMatXY);
try {
} finally {
ctx.releasePrint();
}
- GLCanvas/GLJPanel properly handle existing MSAA and req. AA;
- GLCanvas: Workaround bug where onscreen MSAA cannot switch to offscreen FBO,
i.e. stay 'onscreen'
- GLJPanel: Use new offscreen FBO if MSAA is requested and not yet used.
- GLJPanel.Offscreen.postGL(): always swapBufer(), was missing for !GLSL swapping
Results GLCanvas / GLJPanel:
- Good scaling
- Stable behavior / visibility
- High DPI mode works
Diffstat (limited to 'src/test')
3 files changed, 98 insertions, 143 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java index 86c06247f..60ba35836 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java @@ -66,6 +66,8 @@ import com.jogamp.opengl.util.Animator; public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { static boolean waitForKey = false; + /** only when run manually .. */ + static boolean allow600dpi = false; static GLProfile glp; static int width, height; @@ -87,7 +89,7 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps, final boolean offscreenPrinting) throws InterruptedException, InvocationTargetException { + protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException { final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); Dimension glc_sz = new Dimension(width, height); @@ -98,33 +100,33 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { final Gears gears = new Gears(); glCanvas.addGLEventListener(gears); - final Frame frame = new Frame("AWT Print (offscr "+offscreenPrinting+")"); + final Frame frame = new Frame("AWT Print"); Assert.assertNotNull(frame); final ActionListener print72DPIAction = new ActionListener() { public void actionPerformed(ActionEvent e) { - doPrintManual(frame, glCanvas, TestTiledPrintingGearsAWT.this, offscreenPrinting, 72, false); + doPrintManual(frame, 72, false); } }; - final ActionListener print150DPIAction = new ActionListener() { + final ActionListener print300DPIAction = new ActionListener() { public void actionPerformed(ActionEvent e) { - doPrintManual(frame, glCanvas, TestTiledPrintingGearsAWT.this, offscreenPrinting, 150, false); + doPrintManual(frame, 300, false); } }; - final ActionListener print300DPIAction = new ActionListener() { + final ActionListener print600DPIAction = new ActionListener() { public void actionPerformed(ActionEvent e) { - doPrintManual(frame, glCanvas, TestTiledPrintingGearsAWT.this, offscreenPrinting, 300, false); + doPrintManual(frame, 600, false); } }; final Button print72DPIButton = new Button("72dpi"); print72DPIButton.addActionListener(print72DPIAction); - final Button print150DPIButton = new Button("150dpi"); - print150DPIButton.addActionListener(print150DPIAction); final Button print300DPIButton = new Button("300dpi"); print300DPIButton.addActionListener(print300DPIAction); + final Button print600DPIButton = new Button("600dpi"); + print600DPIButton.addActionListener(print600DPIAction); frame.setLayout(new BorderLayout()); Panel printPanel = new Panel(); printPanel.add(print72DPIButton); - printPanel.add(print150DPIButton); printPanel.add(print300DPIButton); + printPanel.add(print600DPIButton); Panel southPanel = new Panel(); southPanel.add(new Label("South")); Panel eastPanel = new Panel(); @@ -155,22 +157,22 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { animator.setUpdateFPSFrames(60, System.err); animator.start(); - boolean dpi72Done = false; - boolean dpi150Done = false; + boolean printDone = false; while(!quitAdapter.shouldQuit() && animator.isAnimating() && ( 0 == duration || animator.getTotalFPSDuration()<duration )) { - Thread.sleep(100); - if( !dpi72Done ) { - dpi72Done = true; - doPrintAuto(frame, glCanvas, TestTiledPrintingGearsAWT.this, PageFormat.LANDSCAPE, null, offscreenPrinting, 72, false); + Thread.sleep(200); + if( !printDone ) { + printDone = true; + doPrintAuto(frame, PageFormat.LANDSCAPE, null, 72, false); waitUntilPrintJobsIdle(); - doPrintAuto(frame, glCanvas, TestTiledPrintingGearsAWT.this, PageFormat.LANDSCAPE, null, offscreenPrinting, 72, true); + doPrintAuto(frame, PageFormat.LANDSCAPE, null, 72, true); waitUntilPrintJobsIdle(); - } else if( !dpi150Done ) { - dpi150Done = true; - doPrintAuto(frame, glCanvas, TestTiledPrintingGearsAWT.this, PageFormat.LANDSCAPE, null, offscreenPrinting, 150, false); - waitUntilPrintJobsIdle(); - doPrintAuto(frame, glCanvas, TestTiledPrintingGearsAWT.this, PageFormat.LANDSCAPE, null, offscreenPrinting, 150, true); + // No AA needed for 300 dpi and greater :) + doPrintAuto(frame, PageFormat.LANDSCAPE, null, 300, false); waitUntilPrintJobsIdle(); + if( allow600dpi ) { + doPrintAuto(frame, PageFormat.LANDSCAPE, null, 600, false); + waitUntilPrintJobsIdle(); + } } } // try { Thread.sleep(4000); } catch (InterruptedException e) { } // time to finish print jobs .. FIXME ?? @@ -197,26 +199,21 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { @Test public void test01_Onscreen_aa0() throws InterruptedException, InvocationTargetException { GLCapabilities caps = new GLCapabilities(glp); - runTestGL(caps, false); + runTestGL(caps); } - // @Test + @Test public void test02_Onscreen_aa8() throws InterruptedException, InvocationTargetException { GLCapabilities caps = new GLCapabilities(glp); caps.setSampleBuffers(true); caps.setNumSamples(8); // FIXME - runTestGL(caps, false); - } - - @Test - public void test03_Offscreen_aa0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); - runTestGL(caps, true); + runTestGL(caps); } static long duration = 500; // ms public static void main(String args[]) { + allow600dpi = true; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java index 0f3267dc6..d63f73924 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java @@ -69,6 +69,8 @@ import com.jogamp.opengl.util.Animator; public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { static boolean waitForKey = false; + /** only when run manually .. */ + static boolean allow600dpi = false; static GLProfile glp; static int width, height; @@ -90,7 +92,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps, final boolean offscreenPrinting) throws InterruptedException, InvocationTargetException { + protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException { final GLJPanel glJPanel = new GLJPanel(caps); Assert.assertNotNull(glJPanel); Dimension glc_sz = new Dimension(width, height); @@ -101,32 +103,32 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { final Gears gears = new Gears(); glJPanel.addGLEventListener(gears); - final JFrame frame = new JFrame("Swing Print (offscr "+offscreenPrinting+")"); + final JFrame frame = new JFrame("Swing Print"); Assert.assertNotNull(frame); final ActionListener print72DPIAction = new ActionListener() { public void actionPerformed(ActionEvent e) { - doPrintManual(frame, glJPanel, TestTiledPrintingGearsSwingAWT.this, offscreenPrinting, 72, false); + doPrintManual(frame, 72, false); } }; - final ActionListener print150DPIAction = new ActionListener() { + final ActionListener print300DPIAction = new ActionListener() { public void actionPerformed(ActionEvent e) { - doPrintManual(frame, glJPanel, TestTiledPrintingGearsSwingAWT.this, offscreenPrinting, 150, false); + doPrintManual(frame, 300, false); } }; - final ActionListener print300DPIAction = new ActionListener() { + final ActionListener print600DPIAction = new ActionListener() { public void actionPerformed(ActionEvent e) { - doPrintManual(frame, glJPanel, TestTiledPrintingGearsSwingAWT.this, offscreenPrinting, 300, false); + doPrintManual(frame, 600, false); } }; final Button print72DPIButton = new Button("72dpi"); print72DPIButton.addActionListener(print72DPIAction); - final Button print150DPIButton = new Button("150dpi"); - print150DPIButton.addActionListener(print150DPIAction); final Button print300DPIButton = new Button("300dpi"); print300DPIButton.addActionListener(print300DPIAction); + final Button print600DPIButton = new Button("600dpi"); + print600DPIButton.addActionListener(print600DPIAction); final JPanel printPanel = new JPanel(); printPanel.add(print72DPIButton); - printPanel.add(print150DPIButton); printPanel.add(print300DPIButton); + printPanel.add(print600DPIButton); final JPanel southPanel = new JPanel(); southPanel.add(new Label("South")); final JPanel eastPanel = new JPanel(); @@ -161,22 +163,22 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { animator.start(); Assert.assertEquals(true, animator.isAnimating()); - boolean dpi72Done = false; - boolean dpi150Done = false; + boolean printDone = false; while(!quitAdapter.shouldQuit() && animator.isAnimating() && ( 0 == duration || animator.getTotalFPSDuration()<duration )) { Thread.sleep(200); - if( !dpi72Done ) { - dpi72Done = true; - doPrintAuto(frame, glJPanel, TestTiledPrintingGearsSwingAWT.this, PageFormat.LANDSCAPE, null, offscreenPrinting, 72, false); - waitUntilPrintJobsIdle(); - doPrintAuto(frame, glJPanel, TestTiledPrintingGearsSwingAWT.this, PageFormat.LANDSCAPE, null, offscreenPrinting, 72, true); + if( !printDone ) { + printDone = true; + doPrintAuto(frame, PageFormat.LANDSCAPE, null, 72, false); waitUntilPrintJobsIdle(); - } else if( !dpi150Done ) { - dpi150Done = true; - doPrintAuto(frame, glJPanel, TestTiledPrintingGearsSwingAWT.this, PageFormat.LANDSCAPE, null, offscreenPrinting, 150, false); + doPrintAuto(frame, PageFormat.LANDSCAPE, null, 72, true); waitUntilPrintJobsIdle(); - doPrintAuto(frame, glJPanel, TestTiledPrintingGearsSwingAWT.this, PageFormat.LANDSCAPE, null, offscreenPrinting, 150, true); + // No AA needed for 300 dpi and greater :) + doPrintAuto(frame, PageFormat.LANDSCAPE, null, 300, false); waitUntilPrintJobsIdle(); + if( allow600dpi ) { + doPrintAuto(frame, PageFormat.LANDSCAPE, null, 600, false); + waitUntilPrintJobsIdle(); + } } } // try { Thread.sleep(4000); } catch (InterruptedException e) { } // time to finish print jobs .. FIXME ?? @@ -201,19 +203,23 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { } @Test - public void test01_Onscreen() throws InterruptedException, InvocationTargetException { + public void test01_Onscreen_aa0() throws InterruptedException, InvocationTargetException { GLCapabilities caps = new GLCapabilities(glp); - runTestGL(caps, false); + runTestGL(caps); } + @Test - public void test02_Offscreen() throws InterruptedException, InvocationTargetException { + public void test02_Onscreen_aa8() throws InterruptedException, InvocationTargetException { GLCapabilities caps = new GLCapabilities(glp); - runTestGL(caps, true); + caps.setSampleBuffers(true); + caps.setNumSamples(8); // FIXME + runTestGL(caps); } - + static long duration = 500; // ms public static void main(String args[]) { + allow600dpi = true; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java index 6b4742b6e..50625d48c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java @@ -33,7 +33,6 @@ 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; import java.awt.print.Printable; @@ -65,14 +64,10 @@ public abstract class TiledPrintingAWTBase extends UITestCase implements Printab public static final double A0_WIDTH_INCH = A0_WIDTH_MM / MM_PER_INCH; public static final double A0_HEIGHT_INCH = A0_WIDTH_MM / MM_PER_INCH; */ - /** Helper to pass desired AWTPrintLifecycle ! **/ - private AWTPrintLifecycle awtPrintObject = null; /** Helper to pass desired Frame to print! **/ private Frame frame; - /** Helper to pass desired on- and offscreen mode ! **/ - private boolean printOffscreen = false; /** Helper to pass desired DPI value ! **/ - private int printDPI = 72; + private int glDPI = 72; /** Helper to pass desired AA hint ! **/ private boolean printAA = false; @@ -126,94 +121,56 @@ public abstract class TiledPrintingAWTBase extends UITestCase implements Printab System.err.println("PF: Page orientation "+pf.getOrientation()); /** - * We fit the frame into the imageable area with the desired DPI. - * <p> - * We assume AWT painting happens w/ 72 dpi! - * </p> + * We fit the frame into the imageable area with for 72 dpi, + * assuming that is the default AWT painting density. * <p> * The frame borders are considered. * </p> + * <p> + * The frame's scale factor is used for the graphics print matrix + * of the overall print-job, hence no frame resize is required. + * </p> + * <p> + * 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. + * </p> */ final Insets frameInsets = frame.getInsets(); final int frameWidth = frame.getWidth(); final int frameHeight= frame.getHeight(); - final int frameWidthS; - final int frameHeightS; - final double scaleComp; + final double scaleComp72; { final int frameBorderW = frameInsets.left + frameInsets.right; final int frameBorderH = frameInsets.top + frameInsets.bottom; final double sx = pf.getImageableWidth() / ( frameWidth + frameBorderW ); final double sy = pf.getImageableHeight() / ( frameHeight + frameBorderH ); - scaleComp = Math.min(sx, sy) * ( printDPI/72.0 ); - if( 0f < scaleComp ) { - frameWidthS = (int) ( frameWidth*scaleComp ); // cut off FIXME - frameHeightS = (int) ( frameHeight*scaleComp ); // cut off FIXME - } else { - frameWidthS = frameWidth; - frameHeightS = frameHeight; - } + scaleComp72 = Math.min(sx, sy); } - // Since we fit the frame size into the imageable size respecting the DPI, - // we simply can scale the print graphics matrix to the DPI - // w/o the need to fiddle w/ the margins (matrix translation). - final double scaleGraphics = 72.0 / printDPI; - - System.err.println("PRINT offscreen: "+printOffscreen+", thread "+Thread.currentThread().getName()); - System.err.println("PRINT DPI: "+printDPI+", AA "+printAA+", scaleGraphics "+scaleGraphics+", scaleComp "+scaleComp+ - ", frame: border "+frameInsets+", size "+frameWidth+"x"+frameHeight+" -> "+frameWidthS+"x"+frameHeightS); + final double scaleGLMatXY = 72.0 / glDPI; + System.err.println("PRINT thread "+Thread.currentThread().getName()); + System.err.println("PRINT DPI: "+glDPI+", AA "+printAA+", scaleGL "+scaleGLMatXY+", scaleComp72 "+scaleComp72+ + ", frame: border "+frameInsets+", size "+frameWidth+"x"+frameHeight); final Graphics2D printG2D = (Graphics2D)g; - final Graphics2D offscreenG2D; - final BufferedImage offscreenImage; - final Graphics2D g2d; - if( printOffscreen ) { - offscreenImage = new BufferedImage(frameWidthS, frameHeightS, BufferedImage.TYPE_4BYTE_ABGR); - offscreenG2D = (Graphics2D) offscreenImage.getGraphics(); - offscreenG2D.setClip(0, 0, frameWidthS, frameHeightS); - g2d = offscreenG2D; - } else { - offscreenG2D = null; - offscreenImage = null; - g2d = printG2D; + final Graphics2D g2d = printG2D; - g2d.translate(pf.getImageableX(), pf.getImageableY()); - g2d.scale(scaleGraphics, scaleGraphics); - } + g2d.translate(pf.getImageableX(), pf.getImageableY()); + g2d.scale(scaleComp72, scaleComp72); + if( printAA ) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } - awtPrintObject.setupPrint(g2d); + final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(frame, g2d, scaleGLMatXY, scaleGLMatXY); try { + System.err.println("PRINT AWTPrintLifecycle.setup.count "+ctx.getCount()); AWTEDTExecutor.singleton.invoke(true, new Runnable() { - public void run() { - frame.setSize(frameWidthS, frameHeightS); - frame.invalidate(); - frame.validate(); - } - }); - - AWTEDTExecutor.singleton.invoke(true, new Runnable() { - public void run() { - frame.printAll(g2d); - } } ); - - System.err.println("PRINT DPI: reset frame size "+frameWidth+"x"+frameHeight); - AWTEDTExecutor.singleton.invoke(true, new Runnable() { - public void run() { - frame.setSize(frameWidth, frameHeight); - frame.invalidate(); - frame.validate(); + public void run() { + frame.printAll(g2d); } }); } finally { - awtPrintObject.releasePrint(); - } - - if( printOffscreen ) { - printG2D.translate(pf.getImageableX(), pf.getImageableY()); - printG2D.scale(scaleGraphics, scaleGraphics); - printG2D.drawImage(offscreenImage, 0, 0, offscreenImage.getWidth(), offscreenImage.getHeight(), null); // Null ImageObserver since image data is ready. + ctx.releasePrint(); + System.err.println("PRINT AWTPrintLifecycle.release.count "+ctx.getCount()); } /* tell the caller that this page is part of the printed document */ @@ -230,8 +187,7 @@ public abstract class TiledPrintingAWTBase extends UITestCase implements Printab super(); } - public void doPrintAuto(Frame frame, AWTPrintLifecycle awtPrintObject, - Printable printable, int pOrientation, Paper paper, boolean offscreen, int dpi, boolean antialiasing) { + public void doPrintAuto(Frame frame, int pOrientation, Paper paper, int dpi, boolean antialiasing) { lock.lock(); try { final PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); @@ -253,7 +209,7 @@ public abstract class TiledPrintingAWTBase extends UITestCase implements Printab FileOutputStream outstream; try { outstream = new FileOutputStream(fname); - Assert.assertTrue(doPrintAutoImpl(frame, awtPrintObject, printable, pj, factories[0].getPrintService(outstream), pOrientation, paper, offscreen, dpi, antialiasing)); + Assert.assertTrue(doPrintAutoImpl(frame, pj, factories[0].getPrintService(outstream), pOrientation, paper, dpi, antialiasing)); } catch (FileNotFoundException e) { Assert.assertNull("Unexpected exception", e); } @@ -268,7 +224,7 @@ public abstract class TiledPrintingAWTBase extends UITestCase implements Printab FileOutputStream outstream; try { outstream = new FileOutputStream(fname); - Assert.assertTrue(doPrintAutoImpl(frame, awtPrintObject, printable, pj, factories[0].getPrintService(outstream), pOrientation, paper, offscreen, dpi, antialiasing)); + Assert.assertTrue(doPrintAutoImpl(frame, pj, factories[0].getPrintService(outstream), pOrientation, paper, dpi, antialiasing)); } catch (FileNotFoundException e) { Assert.assertNull("Unexpected exception", e); } @@ -285,13 +241,11 @@ public abstract class TiledPrintingAWTBase extends UITestCase implements Printab final String sAA = antialiasing ? "aa_" : "raw"; return String.format("%-"+maxSimpleTestNameLen+"s-n%04d-dpi%03d-%s.%s", simpleTestName, printCount, dpi, sAA, suffix).replace(' ', '_'); } - private boolean doPrintAutoImpl(Frame frame, AWTPrintLifecycle awtPrintObject, - Printable printable, PrinterJob job, StreamPrintService ps, int pOrientation, - Paper paper, boolean offscreen, int dpi, boolean antialiasing) { - this.awtPrintObject = awtPrintObject; + private boolean doPrintAutoImpl(Frame frame, PrinterJob job, + StreamPrintService ps, int pOrientation, Paper paper, int dpi, + boolean antialiasing) { this.frame = frame; - printOffscreen = offscreen; - printDPI = dpi; + glDPI = dpi; printAA = antialiasing; boolean ok = true; try { @@ -305,7 +259,7 @@ public abstract class TiledPrintingAWTBase extends UITestCase implements Printab } pageFormat.setOrientation(pOrientation); // PageFormat.LANDSCAPE or PageFormat.PORTRAIT job.setPrintService(ps); - job.setPrintable(printable, pageFormat); + job.setPrintable(this, pageFormat); job.print(); } catch (PrinterException pe) { pe.printStackTrace(); @@ -314,16 +268,14 @@ public abstract class TiledPrintingAWTBase extends UITestCase implements Printab return ok; } - public void doPrintManual(Frame frame, AWTPrintLifecycle awtPrintObject, Printable printable, boolean offscreen, int dpi, boolean antialiasing) { + public void doPrintManual(Frame frame, int dpi, boolean antialiasing) { lock.lock(); try { - this.awtPrintObject = awtPrintObject; this.frame = frame; - printOffscreen = offscreen; - printDPI = dpi; + glDPI = dpi; printAA = antialiasing; PrinterJob job = PrinterJob.getPrinterJob(); - job.setPrintable(printable); + job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { |