public static class PdfMaker.PageCanvas extends Object implements IPointCanvas
Modifier and Type | Field and Description |
---|---|
protected Color |
brushColor |
protected int |
brushRule |
protected int |
brushStyle |
protected String |
curFont |
protected double |
curFontSize |
protected double |
fontAscent |
protected double |
fontDescent |
protected Color |
penColor |
protected double |
penMiter |
protected int |
penStyle |
protected double |
penWidth |
Modifier and Type | Method and Description |
---|---|
void |
addToPath(double x,
double y)
Add a straight line segment to the path.
|
void |
addToPath(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Add a Cubic Bezier curve segment from the current point to (x3,y3) using
(x1, y1) and (x2, y2) as the control points.
|
void |
append(String data) |
void |
appendLiteral(char[] data,
int offset,
int length) |
void |
cancel()
Cancel the operations of this PageCanvas.
|
void |
closePath()
Close the path by making a straight line segment back to the original point.
|
void |
drawImageData(ImageData src,
double x,
double y,
double width,
double height,
PointRect destArea,
int options)
Scale and draw an ImageData to the PointGraphics, specifying the destination area
that is to be drawn on the PointGraphics - all other sections of the image will
be clipped.
|
void |
drawLine(double x,
double y,
double x2,
double y2) |
void |
drawLines(double[] x,
double[] y,
int xoffset,
int yoffset,
int numberOfPoints,
boolean separateLines)
Draw a set of lines either by joining one to the next forming a single unbroken path,
or by drawing sets of separate lines.
|
void |
drawText(char[] data,
int offset,
int length,
double x,
double y)
Draw text at a particular location.
|
void |
drawText(String data,
double x,
double y) |
void |
finish()
Finish the operations of this PageCanvas and commit it to the page.
|
void |
freePointCanvas() |
IPointDocument |
getDocument() |
PdfMaker.Page |
getPage() |
PointFontMetrics |
getPointFontMetrics(PointFont f) |
void |
getUnityTransform(AffineTransform at)
Get the default transform for the canvas.
|
void |
paintPath(boolean useBrush,
boolean usePen)
Stroke/fill the path.
|
void |
paintPolygon(double[] x,
double[] y,
int xoffset,
int yoffset,
int count,
boolean useBrush,
boolean usePen)
Paint a closed polygon.
|
void |
paintRect(double x,
double y,
double width,
double height,
boolean useBrush,
boolean usePen) |
void |
setBrush(Color c,
int style,
int rule) |
void |
setFont(PointFont f) |
void |
setPen(Color c,
int style,
double width,
double width2,
float miterLimit) |
void |
setTransform(AffineTransform at)
Set the transform.
|
void |
startPath(double x,
double y)
Start a new sub path at x and y.
|
protected double fontAscent
protected double fontDescent
protected String curFont
protected double curFontSize
protected Color penColor
protected double penWidth
protected int penStyle
protected double penMiter
protected Color brushColor
protected int brushStyle
protected int brushRule
public PdfMaker.Page getPage()
public void setFont(PointFont f)
setFont
in interface IPointCanvas
public PointFontMetrics getPointFontMetrics(PointFont f)
getPointFontMetrics
in interface IPointCanvas
public void drawText(String data, double x, double y)
public void appendLiteral(char[] data, int offset, int length)
public void drawText(char[] data, int offset, int length, double x, double y)
IPointCanvas
drawText
in interface IPointCanvas
data
- the chars to draw.offset
- the start of the characters.length
- the number of characters.x
- the x location for the start of the base line.y
- the y location for the start of the base line.public void finish() throws IOException
IOException
public void cancel()
public void append(String data)
public void drawLine(double x, double y, double x2, double y2)
drawLine
in interface IPointCanvas
public void paintRect(double x, double y, double width, double height, boolean useBrush, boolean usePen)
paintRect
in interface IPointCanvas
public void setTransform(AffineTransform at)
IPointCanvas
setTransform
in interface IPointCanvas
public void addToPath(double x, double y)
IPath
public void addToPath(double x1, double y1, double x2, double y2, double x3, double y3)
IPath
public void closePath()
IPath
public void freePointCanvas()
freePointCanvas
in interface IPointCanvas
public void getUnityTransform(AffineTransform at)
IPointCanvas
getUnityTransform
in interface IPointCanvas
at
- a non-null destination AffineTransform.public void paintPath(boolean useBrush, boolean usePen)
IPointCanvas
paintPath
in interface IPointCanvas
useBrush
- true to fill the path (assuming it is closed).usePen
- true to stroke the path (which is done after filling).public void setBrush(Color c, int style, int rule)
setBrush
in interface IPointCanvas
public void setPen(Color c, int style, double width, double width2, float miterLimit)
setPen
in interface IPointCanvas
public void startPath(double x, double y)
IPath
public void drawLines(double[] x, double[] y, int xoffset, int yoffset, int numberOfPoints, boolean separateLines)
IPointCanvas
drawLines
in interface IPointCanvas
x
- the array holding the X co-ordinate points. If y is null then this
also holds the Y co-ordinate points,
either in a separate area or interleaved with the x values.y
- the Y co-ordinate points or null if the Y co-ordinates are in the
x array.xoffset
- the offset into the x array containing the first X point.yoffset
- the offset into the y array containing the first Y point.
If the y array is null then the y points are in the x array. If the yoffset
is equal to xoffset or to xoffset+1, it is assumed that the x and y
co-ordinates are interleaved (first x, then y, then x, then y),
otherwise it is assumed that the x and y co-ordinates
are in non-overlapping contiguous sections within the array.numberOfPoints
- the number of points in the array.separateLines
- true to draw as separate lines (i.e from x0,y0 to x1,y1 and then x2,y2 to x3,y3)
false to draw as a single path (i.e. from x0,y0 to x1,y1 to x2,y2 to x3,y3).public void drawImageData(ImageData src, double x, double y, double width, double height, PointRect destArea, int options)
IPointCanvas
drawImageData
in interface IPointCanvas
src
- the source ImageDatax
- the x location where the top left corner of the ImageData would be
if the entire image was drawn.y
- the y location where the top left corner of the ImageData would be
if the entire image was drawn.width
- the full width of the scaled image.height
- the full heigh of the scaled image.destArea
- the destination area being updated on the PointGraphics.
If this is null then the full x, y, width and height values are used.options
- scale options, none of which are currently defined.public void paintPolygon(double[] x, double[] y, int xoffset, int yoffset, int count, boolean useBrush, boolean usePen)
IPointCanvas
paintPolygon
in interface IPointCanvas
x
- the array holding the X co-ordinate points. If y is null then this
also holds the Y co-ordinate points,
either in a separate area or interleaved with the x values.y
- the Y co-ordinate points or null if the Y co-ordinates are in the
x array.xoffset
- the offset into the x array containing the first X point.yoffset
- the offset into the y array containing the first Y point.
If the y array is null then the y points are in the x array. If the yoffset
is equal to xoffset or to xoffset+1, it is assumed that the x and y
co-ordinates are interleaved (first x, then y, then x, then y),
otherwise it is assumed that the x and y co-ordinates
are in non-overlapping contiguous sections within the array.count
- the number of points in the array.public IPointDocument getDocument()
getDocument
in interface IPointCanvas