Package com.jogamp.nativewindow.awt
Interface AWTPrintLifecycle
-
public interface AWTPrintLifecycle
Interface describing print lifecycle to support AWT printing, e.g. on AWTGLAutoDrawable
s.Implementations
Implementing
GLAutoDrawable
classes based on AWT supportingComponent.print(Graphics)
shall implement this interface.Usage
Users attempting to print an AWT
Container
containingAWTPrintLifecycle
elements shall consider decorating theComponent.printAll(Graphics)
call with
setupPrint(..)
andreleasePrint()
on allAWTPrintLifecycle
elements in theContainer
.
To minimize this burden, a user can useContext.setupPrint(..)
:Container cont; double scaleGLMatXY = 72.0/glDPI; int numSamples = 0; // leave multisampling as-is PrinterJob job; ... final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(cont, scaleGLMatXY, scaleGLMatXY, numSamples); try { AWTEDTExecutor.singleton.invoke(true, new Runnable() { public void run() { try { job.print(); } catch (PrinterException ex) { ex.printStackTrace(); } } }); } finally { ctx.releasePrint(); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
AWTPrintLifecycle.Context
ConvenientAWTPrintLifecycle
context simplifying callingsetupPrint(..)
andreleasePrint()
on allAWTPrintLifecycle
elements of aContainer
.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PRINT_TILE_SIZE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
releasePrint()
Shall be called afterPrinterJob.print()
.void
setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight)
Shall be called beforePrinterJob.print()
.
-
-
-
Field Detail
-
DEFAULT_PRINT_TILE_SIZE
static final int DEFAULT_PRINT_TILE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setupPrint
void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight)
Shall be called beforePrinterJob.print()
.See Usage.
- Parameters:
scaleMatX
-Graphics2D
scaling factor
, i.e. rendering 1/scaleMatX * width pixelsscaleMatY
-Graphics2D
scaling factor
, i.e. rendering 1/scaleMatY * height pixelsnumSamples
- multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samplestileWidth
- custom tile width fortile renderer
, pass -1 for default.tileHeight
- custom tile height fortile renderer
, pass -1 for default. FIXME: Add border size !
-
releasePrint
void releasePrint()
Shall be called afterPrinterJob.print()
.See Usage.
-
-