org.apache.xmlgraphics.java2d.ps
Class AbstractPSDocumentGraphics2D
java.lang.Object
|
+--java.awt.Graphics
|
+--java.awt.Graphics2D
|
+--org.apache.xmlgraphics.java2d.AbstractGraphics2D
|
+--org.apache.xmlgraphics.java2d.ps.PSGraphics2D
|
+--org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D
- All Implemented Interfaces:
- java.lang.Cloneable
- Direct Known Subclasses:
- EPSDocumentGraphics2D, PSDocumentGraphics2D
- public abstract class AbstractPSDocumentGraphics2D
- extends PSGraphics2D
This class is a wrapper for the PSGraphics2D that
is used to create a full document around the PostScript rendering from
PSGraphics2D.
- Version:
- $Id: AbstractPSDocumentGraphics2D.java 390751 2006-04-01 21:01:14Z jeremias $
- Author:
- Keiron Liddle
- See Also:
PSGraphics2D
Methods inherited from class org.apache.xmlgraphics.java2d.ps.PSGraphics2D |
applyPaint, applyStroke, buildBufferedImage, copyArea, create, dispose, doDrawing, draw, drawImage, drawImage, drawRenderableImage, drawRenderedImage, drawString, drawString, establishColor, fill, getCustomTextHandler, getDeviceConfiguration, getFallbackTextHandler, getFontMetrics, getPSGenerator, handleIOException, processPathIterator, setCustomTextHandler, setGraphicContext, setPSGenerator, setXORMode, writeClip |
Methods inherited from class org.apache.xmlgraphics.java2d.AbstractGraphics2D |
addRenderingHints, clearRect, clip, clipRect, drawArc, drawGlyphVector, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, getBackground, getClip, getClipBounds, getColor, getComposite, getFont, getFontRenderContext, getGraphicContext, getPaint, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, rotate, rotate, scale, setBackground, setClip, setClip, setColor, setComposite, setFont, setPaint, setPaintMode, setRenderingHint, setRenderingHints, setStroke, setTransform, shear, transform, translate, translate |
Methods inherited from class java.awt.Graphics2D |
draw3DRect, fill3DRect |
Methods inherited from class java.awt.Graphics |
create, drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ZERO
protected static final java.lang.Integer ZERO
width
protected int width
height
protected int height
viewportWidth
protected float viewportWidth
viewportHeight
protected float viewportHeight
pagecount
protected int pagecount
pagePending
protected boolean pagePending
initialClip
protected java.awt.Shape initialClip
initialTransform
protected java.awt.geom.AffineTransform initialTransform
AbstractPSDocumentGraphics2D
public AbstractPSDocumentGraphics2D(boolean textAsShapes,
java.io.OutputStream stream,
int width,
int height)
throws java.io.IOException
- Create a new AbstractPSDocumentGraphics2D.
This is used to create a new PostScript document of the given height
and width.
The resulting document is written to the stream after rendering.
- Parameters:
textAsShapes
- set this to true so that text will be rendered
using curves and not the font.stream
- the stream that the final document should be written to.width
- the width of the documentheight
- the height of the document- Throws:
java.io.IOException
- an io exception if there is a problem
writing to the output stream
AbstractPSDocumentGraphics2D
public AbstractPSDocumentGraphics2D(AbstractPSDocumentGraphics2D g)
- This constructor supports the create method
- Parameters:
g
- the PostScript document graphics to make a copy of
setupDocument
public void setupDocument(java.io.OutputStream stream,
int width,
int height)
throws java.io.IOException
- Setup the document.
- Parameters:
stream
- the output stream to write the documentwidth
- the width of the pageheight
- the height of the page- Throws:
java.io.IOException
- an io exception if there is a problem
writing to the output stream
writeFileHeader
protected abstract void writeFileHeader()
throws java.io.IOException
setViewportDimension
public void setViewportDimension(float w,
float h)
throws java.io.IOException
- Set the dimensions of the document that will be drawn.
This is useful if the dimensions of the document are different
from the PostScript document that is to be created.
The result is scaled so that the document fits correctly inside the
PostScript document.
- Parameters:
w
- the width of the pageh
- the height of the page- Throws:
java.io.IOException
- in case of an I/O problem
setBackgroundColor
public void setBackgroundColor(java.awt.Color col)
- Set the background of the PostScript document.
This is used to set the background for the PostScript document
Rather than leaving it as the default white.
- Parameters:
col
- the background colour to fill
getPageCount
public int getPageCount()
nextPage
public void nextPage()
throws java.io.IOException
closePage
protected void closePage()
throws java.io.IOException
writePageHeader
protected abstract void writePageHeader()
throws java.io.IOException
- Writes the page header for a page.
- Throws:
java.io.IOException
- In case an I/O error occurs
writePageTrailer
protected abstract void writePageTrailer()
throws java.io.IOException
- Writes the page trailer for a page.
- Throws:
java.io.IOException
- In case an I/O error occurs
preparePainting
public void preparePainting()
- {@inheritDoc}
- Overrides:
preparePainting
in class PSGraphics2D
startPage
protected void startPage()
throws java.io.IOException
finish
public void finish()
throws java.io.IOException
- The rendering process has finished.
This should be called after the rendering has completed as there is
no other indication it is complete.
This will then write the results to the output stream.
- Throws:
java.io.IOException
- an io exception if there is a problem
writing to the output stream
Copyright 1999-2006 The Apache Software Foundation. All Rights Reserved.