|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.pdfview.BaseWatchable
com.sun.pdfview.PDFRenderer
public class PDFRenderer
This class turns a set of PDF Commands from a PDF page into an image. It encapsulates the state of drawing in terms of stroke, fill, transform, etc., as well as pushing and popping these states. When the run method is called, this class goes through all remaining commands in the PDF Page and draws them to its buffered image. It then updates any ImageConsumers with the drawn data.
Field Summary | |
---|---|
static int |
NOCAP
|
static float[] |
NODASH
|
static int |
NOJOIN
|
static float |
NOLIMIT
|
static float |
NOPHASE
|
static float |
NOWIDTH
|
static long |
UPDATE_DURATION
how long (in milliseconds) to wait between image updates |
Fields inherited from interface com.sun.pdfview.Watchable |
---|
COMPLETED, ERROR, NEEDS_DATA, NOT_STARTED, PAUSED, RUNNING, STOPPED, UNKNOWN |
Constructor Summary | |
---|---|
PDFRenderer(PDFPage page,
java.awt.Graphics2D g,
java.awt.Rectangle imgbounds,
java.awt.geom.Rectangle2D clip,
java.awt.Color bgColor)
create a new PDFGraphics state, given a Graphics2D. |
|
PDFRenderer(PDFPage page,
ImageInfo imageinfo,
java.awt.image.BufferedImage bi)
create a new PDFGraphics state |
Method Summary | |
---|---|
void |
addObserver(java.awt.image.ImageObserver observer)
Add an image observer |
void |
cleanup()
Called when iteration has stopped |
void |
clip(java.awt.geom.GeneralPath s)
add the path to the current clip. |
void |
draw(java.awt.geom.GeneralPath p,
java.awt.BasicStroke bs)
draw an outline. |
java.awt.geom.Rectangle2D |
drawImage(PDFImage image)
draw an image. |
java.awt.geom.Rectangle2D |
fill(java.awt.geom.GeneralPath s)
fill an outline using the current fill paint |
java.awt.geom.AffineTransform |
getInitialTransform()
get the initial transform from page space to Java space |
java.awt.geom.GeneralPath |
getLastShape()
Get the last shape drawn |
java.awt.BasicStroke |
getStroke()
get the current stroke as a BasicStroke |
java.awt.geom.AffineTransform |
getTransform()
get the current affinetransform |
int |
iterate()
Draws the next command in the PDFPage to the buffered image. |
void |
pop()
restore the state of this object to what it was when the previous push() was called. |
void |
push()
push the current graphics state onto the stack. |
void |
removeObserver(java.awt.image.ImageObserver observer)
Remove an image observer |
void |
setFillAlpha(float alpha)
set the stroke alpha |
void |
setFillPaint(PDFPaint paint)
set the fill color |
void |
setLastShape(java.awt.geom.GeneralPath shape)
Set the last shape drawn |
void |
setStroke(java.awt.BasicStroke bs)
set the current stroke as a BasicStroke |
void |
setStrokeAlpha(float alpha)
set the stroke alpha |
void |
setStrokePaint(PDFPaint paint)
set the stroke color |
void |
setStrokeParts(float w,
int cap,
int join,
float limit,
float[] ary,
float phase)
Set some or all aspects of the current stroke. |
void |
setTransform(java.awt.geom.AffineTransform at)
replace the current transform with the given one. |
void |
setup()
Setup rendering. |
java.awt.geom.Rectangle2D |
stroke(java.awt.geom.GeneralPath s)
draw an outline using the current stroke and draw paint |
void |
transform(java.awt.geom.AffineTransform at)
concatenate the given transform with the current transform |
Methods inherited from class com.sun.pdfview.BaseWatchable |
---|
execute, getStatus, go, go, go, go, isExecutable, isFinished, isSuppressSetErrorStackTrace, run, setError, setStatus, setSuppressSetErrorStackTrace, stop, waitForFinish |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
---|
run |
Field Detail |
---|
public static final long UPDATE_DURATION
public static final float NOPHASE
public static final float NOWIDTH
public static final float NOLIMIT
public static final int NOCAP
public static final float[] NODASH
public static final int NOJOIN
Constructor Detail |
---|
public PDFRenderer(PDFPage page, ImageInfo imageinfo, java.awt.image.BufferedImage bi)
page
- the current pageimageinfo
- the paramters of the image to renderpublic PDFRenderer(PDFPage page, java.awt.Graphics2D g, java.awt.Rectangle imgbounds, java.awt.geom.Rectangle2D clip, java.awt.Color bgColor)
page
- the current pageg
- the Graphics2D object to use for drawingimgbounds
- the bounds of the image into which to fit the pageclip
- the portion of the page to draw, in page space, or null
if the whole page should be drawnbgColor
- the color to draw the background of the image, or
null for no color (0 alpha value)Method Detail |
---|
public void push()
public void pop()
public java.awt.geom.Rectangle2D stroke(java.awt.geom.GeneralPath s)
s
- the path to stroke
public void draw(java.awt.geom.GeneralPath p, java.awt.BasicStroke bs)
p
- the path to drawbs
- the stroke with which to draw the pathpublic java.awt.geom.Rectangle2D fill(java.awt.geom.GeneralPath s)
s
- the path to fillpublic java.awt.geom.Rectangle2D drawImage(PDFImage image)
image
- the image to drawpublic void clip(java.awt.geom.GeneralPath s)
public java.awt.geom.AffineTransform getTransform()
public void transform(java.awt.geom.AffineTransform at)
public void setTransform(java.awt.geom.AffineTransform at)
public java.awt.geom.AffineTransform getInitialTransform()
public void setStrokeParts(float w, int cap, int join, float limit, float[] ary, float phase)
w
- the width of the stroke, or NOWIDTH to leave it unchangedcap
- the end cap style, or NOCAP to leave it unchangedjoin
- the join style, or NOJOIN to leave it unchangedlimit
- the miter limit, or NOLIMIT to leave it unchangedphase
- the phase of the dash array, or NOPHASE to leave it
unchangedary
- the dash array, or null to leave it unchanged. phase
and ary must both be valid, or phase must be NOPHASE while ary is null.public java.awt.BasicStroke getStroke()
public void setStroke(java.awt.BasicStroke bs)
public void setStrokePaint(PDFPaint paint)
public void setFillPaint(PDFPaint paint)
public void setStrokeAlpha(float alpha)
public void setFillAlpha(float alpha)
public void addObserver(java.awt.image.ImageObserver observer)
public void removeObserver(java.awt.image.ImageObserver observer)
public void setLastShape(java.awt.geom.GeneralPath shape)
public java.awt.geom.GeneralPath getLastShape()
public void setup()
setup
in class BaseWatchable
public int iterate() throws java.lang.Exception
iterate
in class BaseWatchable
java.lang.Exception
public void cleanup()
cleanup
in class BaseWatchable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |