public abstract class Device extends Object
This class encapsulates rendering of document to abstract device. Rendering of the document is performed page by page.
Modifier and Type | Field and Description |
---|---|
static String |
VERSION
Current device version.
|
Constructor and Description |
---|
Device(Dimension pageSize)
Creates the new instance of Device with a size of a page.
|
Modifier and Type | Method and Description |
---|---|
Device |
create()
Creates a copy of this device.
|
void |
dispose()
Disposes the device.
|
void |
draw(Shape path)
Draws a path.
|
void |
drawArc(float x,
float y,
float width,
float height,
float startAngle,
float arcAngle)
Draws an arc.
|
void |
drawImage(BufferedImage image,
AffineTransform transform,
Color bkg)
Draws an image with assigned transform and background.
|
void |
drawLine(float x1,
float y1,
float x2,
float y2)
Draws a line segment.
|
void |
drawOval(float x,
float y,
float width,
float height)
Draws an oval.
|
void |
drawPolygon(float[] xPoints,
float[] yPoints,
int nPoints)
Draws a polygon.
|
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a polygon.
|
void |
drawPolyline(float[] xPoints,
float[] yPoints,
int nPoints)
Draws a polyline.
|
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a polyline.
|
void |
drawRect(float x,
float y,
float width,
float height)
Draws a rectangle.
|
void |
drawRoundRect(float x,
float y,
float width,
float height,
float arcWidth,
float arcHeight)
Draws a round rectangle.
|
void |
drawString(String str,
float x,
float y)
Draws a string at given point.
|
void |
endDocument()
Makes necessary preparation of device after the document has been rendered.
|
void |
fill(Shape path)
Fills a path.
|
void |
fillArc(float x,
float y,
float width,
float height,
float startAngle,
float arcAngle)
Fills an arc.
|
void |
fillOval(float x,
float y,
float width,
float height)
Fills an oval.
|
void |
fillPolygon(float[] xPoints,
float[] yPoints,
int nPoints)
Fills a polygon.
|
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Fills a polygon.
|
void |
fillRect(float x,
float y,
float width,
float height)
Fills a rectangle.
|
void |
fillRoundRect(float x,
float y,
float width,
float height,
float arcWidth,
float arcHeight)
Draws a round rectangle.
|
Color |
getBackground()
Gets current background of the page.
|
AffineTransform |
getCharTM()
Gets current characters transform.
|
String |
getCreator()
Gets creator of resulting device output.
|
ITrFont |
getFont()
Gets current font.
|
float |
getOpacity()
Gets current opacity.
|
Paint |
getOpacityMask()
Gets current opacity mask.
|
Paint |
getPaint()
Gets current paint.
|
UserProperties |
getProperties()
Gets device properties including metadata.
|
String |
getProperty(String key)
Gets a value of string property.
|
Color |
getPropertyColor(String key)
Gets a value of color property.
|
double |
getPropertyDouble(String key)
Gets a value of double property.
|
int |
getPropertyInt(String key)
Gets a value of integer property.
|
Insets |
getPropertyMargins(String key)
Gets a value of margins property.
|
Rectangle |
getPropertyRectangle(String key)
Gets a value of rectangle property.
|
Dimension |
getPropertySize(String key)
Gets a value of size property.
|
Dimension |
getSize()
Gets a size of the page.
|
Stroke |
getStroke()
Gets current stroke.
|
TextRenderingMode |
getTextRenderingMode()
Gets current text rendering mode.
|
float |
getTextStrokeWidth()
Gets current text stroke width.
|
AffineTransform |
getTransform()
Gets current transform.
|
void |
initClip()
Initializes clip of the device.
|
boolean |
isDirectRGB()
Indicates whether device uses direct RGB mode, that is RGB.
|
boolean |
isLicensed()
Indicates whether this instance of Aspose.Page library is licensed.
|
boolean |
isProperty(String key)
Gets a value of boolean property.
|
void |
renew()
Reset device to initial state for whole document.
|
void |
reset()
Reset the device to initial state for a page.
|
void |
rotate(double theta)
Rotate the current transformation matrix.
|
void |
rotate(double theta,
double x,
double y)
Rotate the current transformation matrix around a point.
|
void |
scale(double x,
double y)
Scales the current transformation matrix.
|
void |
setBackground(Color background)
Specifies current background of the page.
|
void |
setCharTM(AffineTransform charTM)
Specifies characters transform.
|
void |
setClip(Shape clipPath)
Specifies the clip of the device.
|
void |
setCreator(String creator)
Specifies creator of resulting device output.
|
void |
setFont(ITrFont font)
Specifies a font.
|
void |
setOpacity(float opacity)
Specifies opacity.
|
void |
setOpacityMask(Paint opacityMask)
Specifies a opacity mask.
|
void |
setPaint(Paint paint)
Specifies a paint.
|
void |
setProperties(UserProperties props)
Specifies device properties including metadata.
|
void |
setSaveOptions(SaveOptions options)
Specifies options for managing rendering process.
|
void |
setSize(Dimension size)
Specifies size of page.
|
void |
setStroke(Stroke stroke)
Specifies a stroke.
|
void |
setTextRenderingMode(TextRenderingMode textRenderingMode)
Specifies text rendering mode.
|
void |
setTextStrokeWidth(float textStrokeWidth)
Specifies text stroke width.
|
void |
setTransform(AffineTransform transform)
Specifies current transform.
|
void |
shear(double shx,
double shy)
Shears the current transformation matrix.
|
void |
startDocument()
Makes necessary preparation of device before start rendering of document.
|
String |
toString()
Returns the name of device type.
|
void |
transform(AffineTransform transform)
Transforms the current transformation matrix.
|
void |
translate(double x,
double y)
Translates the current transformation matrix.
|
void |
writeComment(String comment)
Writes a comment.
|
void |
writeString(ITrFont font,
String str)
Writes out string with specified font.
|
public static String VERSION
Current device version.
public Device(Dimension pageSize)
Creates the new instance of Device with a size of a page.
pageSize
- Page size.public void renew()
Reset device to initial state for whole document. Used for reseting output stream.
public void setSaveOptions(SaveOptions options)
Specifies options for managing rendering process.
options
- Options for managing rendering process.public UserProperties getProperties()
Gets device properties including metadata.
public void setProperties(UserProperties props)
Specifies device properties including metadata.
props
- Device properties.public String getProperty(String key)
Gets a value of string property.
key
- The name of property.public Color getPropertyColor(String key)
Gets a value of color property.
key
- The name of property.public Rectangle getPropertyRectangle(String key)
Gets a value of rectangle property.
key
- The name of property.public Insets getPropertyMargins(String key)
Gets a value of margins property.
key
- The name of property.public Dimension getPropertySize(String key)
Gets a value of size property.
key
- The name of property.public int getPropertyInt(String key)
Gets a value of integer property.
key
- The name of property.public double getPropertyDouble(String key)
Gets a value of double property.
key
- The name of property.public boolean isProperty(String key)
Gets a value of boolean property.
key
- The name of property.public String getCreator()
Gets creator of resulting device output.
public void setCreator(String creator)
Specifies creator of resulting device output.
creator
- A creator value.public Dimension getSize()
Gets a size of the page.
public void setSize(Dimension size)
Specifies size of page.
size
- Size of page.public boolean isDirectRGB()
Indicates whether device uses direct RGB mode, that is RGB.
public Color getBackground()
Gets current background of the page.
public void setBackground(Color background)
Specifies current background of the page.
background
- A background of the page.public float getOpacity()
Gets current opacity.
public void setOpacity(float opacity)
Specifies opacity.
opacity
- An opacity.public Stroke getStroke()
Gets current stroke.
public void setStroke(Stroke stroke)
Specifies a stroke.
stroke
- A stroke.public Paint getPaint()
Gets current paint.
public void setPaint(Paint paint)
Specifies a paint.
paint
- A paint.public Paint getOpacityMask()
Gets current opacity mask.
public void setOpacityMask(Paint opacityMask)
Specifies a opacity mask.
opacityMask
- A opacity mask.public ITrFont getFont()
Gets current font.
public void setFont(ITrFont font)
Specifies a font.
font
- A font.public AffineTransform getCharTM()
Gets current characters transform.
public void setCharTM(AffineTransform charTM)
Specifies characters transform.
charTM
- Сharacters transform.public TextRenderingMode getTextRenderingMode()
Gets current text rendering mode.
public void setTextRenderingMode(TextRenderingMode textRenderingMode)
Specifies text rendering mode.
textRenderingMode
- Text rendering mode.public float getTextStrokeWidth()
Gets current text stroke width.
public void setTextStrokeWidth(float textStrokeWidth)
Specifies text stroke width.
textStrokeWidth
- Text stroke width.public Device create()
Creates a copy of this device.
public void setTransform(AffineTransform transform)
Specifies current transform.
transform
- A transform..public AffineTransform getTransform()
Gets current transform.
public void transform(AffineTransform transform)
Transforms the current transformation matrix. Calls writeTransform(Transform).
transform
- Transform to be applied.public void translate(double x, double y)
Translates the current transformation matrix. Calls writeTransform(Transform).
x
- Translation in X axis.y
- Translation in Y axis.public void rotate(double theta)
Rotate the current transformation matrix. Calls writeTransform(Transform). Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.
theta
- Angle in radians over which to rotate.public void rotate(double theta, double x, double y)
Rotate the current transformation matrix around a point.
theta
- An angle of rotation in radians.x
- X coordinate of point.y
- Y coordinate of point.public void scale(double x, double y)
Scales the current transformation matrix. Calls writeTransform(Transform).
x
- A scale in X axis.y
- A scale in Y axis.public void shear(double shx, double shy)
Shears the current transformation matrix. Calls writeTransform(Transform).
shx
- A shear in X axis.shy
- A shear in Y axis.public void initClip()
Initializes clip of the device.
public void setClip(Shape clipPath)
Specifies the clip of the device.
clipPath
- A clipping path.public void draw(Shape path)
Draws a path.
path
- A path to be drawn.public void fill(Shape path)
Fills a path.
path
- A path to be filled.public void drawString(String str, float x, float y)
Draws a string at given point.
str
- A string to be drawn.x
- X coordinate of point.y
- Y coordinate of point.public void drawImage(BufferedImage image, AffineTransform transform, Color bkg)
Draws an image with assigned transform and background.
image
- An image to be drawn.transform
- A transform.bkg
- A background color.public void startDocument()
Makes necessary preparation of device before start rendering of document.
public void endDocument()
Makes necessary preparation of device after the document has been rendered.
public void dispose()
Disposes the device.
public void reset()
Reset the device to initial state for a page.
public void writeComment(String comment)
Writes a comment.
comment
- A comment to be written.public String toString()
Returns the name of device type.
public void drawArc(float x, float y, float width, float height, float startAngle, float arcAngle)
Draws an arc.
x
- X coordinate of center of the arc.y
- Y coordinate of center of the arc.width
- A width of circumscribed rectangle.height
- A height of circumscribed rectangle.startAngle
- A start angle of the arc.arcAngle
- An angle of the arc.public void drawLine(float x1, float y1, float x2, float y2)
Draws a line segment.
x1
- X coordinate of the beginning of segment.y1
- Y coordinate of the beginning of segment.x2
- X coordinate of the end of segment.y2
- Y coordinate of the end of segment.public void drawOval(float x, float y, float width, float height)
Draws an oval.
x
- X coordinate of center of the oval.y
- Y coordinate of center of the oval.width
- A width of circumscribed rectangle.height
- A height of circumscribed rectangle.public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
Draws a polyline.
xPoints
- X coordinates of points.yPoints
- Y coordinate of points.nPoints
- The number of points.public void drawPolyline(float[] xPoints, float[] yPoints, int nPoints)
Draws a polyline.
xPoints
- X coordinates of points.yPoints
- Y coordinate of points.nPoints
- The number of points.public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Draws a polygon.
xPoints
- X coordinates of points.yPoints
- Y coordinate of points.nPoints
- The number of points.public void drawPolygon(float[] xPoints, float[] yPoints, int nPoints)
Draws a polygon.
xPoints
- X coordinates of points.yPoints
- Y coordinate of points.nPoints
- The number of points.public void drawRect(float x, float y, float width, float height)
Draws a rectangle.
x
- X coordinate of upper left corner of the rectangle.y
- Y coordinate of upper left corner of the rectangle.width
- A width of the rectangle.height
- A height of the rectangle.public void drawRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
Draws a round rectangle.
x
- X coordinate of upper left corner of the rectangle.y
- Y coordinate of upper left corner of the rectangle.width
- A width of the rectangle.height
- A height of the rectangle.arcWidth
- A width of circumscribed rectangle of the arc that rounds an angle of the rectangle.arcHeight
- A height of circumscribed rectangle of the arc that rounds an angle of the rectangle.public void fillArc(float x, float y, float width, float height, float startAngle, float arcAngle)
Fills an arc.
x
- X coordinate of center of the arc.y
- Y coordinate of center of the arc.width
- A width of circumscribed rectangle.height
- A height of circumscribed rectangle.startAngle
- A start angle of the arc.arcAngle
- An angle of the arc.public void fillOval(float x, float y, float width, float height)
Fills an oval.
x
- X coordinate of center of the oval.y
- Y coordinate of center of the oval.width
- A width of circumscribed rectangle.height
- A height of circumscribed rectangle.public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Fills a polygon.
xPoints
- X coordinates of points.yPoints
- Y coordinate of points.nPoints
- The number of points.public void fillPolygon(float[] xPoints, float[] yPoints, int nPoints)
Fills a polygon.
xPoints
- X coordinates of points.yPoints
- Y coordinate of points.nPoints
- The number of points.public void fillRect(float x, float y, float width, float height)
Fills a rectangle.
x
- X coordinate of upper left corner of the rectangle.y
- Y coordinate of upper left corner of the rectangle.width
- A width of the rectangle.height
- A height of the rectangle.public void fillRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
Draws a round rectangle.
x
- X coordinate of upper left corner of the rectangle.y
- Y coordinate of upper left corner of the rectangle.width
- A width of the rectangle.height
- A height of the rectangle.arcWidth
- A width of circumscribed rectangle of the arc that rounds an angle of the rectangle.arcHeight
- A height of circumscribed rectangle of the arc that rounds an angle of the rectangle.public void writeString(ITrFont font, String str)
Writes out string with specified font.
font
- Specified font.str
- The string.public boolean isLicensed()
Indicates whether this instance of Aspose.Page library is licensed.