public abstract class Device extends Object
Implements the interface for outputting text and graphic content to abstract device. Rendering is performed page by page.
Modifier | Constructor and Description |
---|---|
|
Device()
Creates a new instance.
|
protected |
Device(Device device)
Clone constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addHyperlink(Rectangle2D activeRect,
ColoredStroke border,
String targetUri)
Sets the hyperlink with a URI as its target.
|
Device |
create()
Creates a copy of this device.
|
void |
dispose()
Disposes the device.
|
abstract void |
drawPath(Shape path)
Draws a path.
|
abstract void |
drawString(String str,
float originX,
float originY,
List<GlyphData> charInfos)
Draws a text string.
|
abstract void |
endDocument()
Finalizes the whole document.
|
abstract void |
endPage()
Finalizes a page.
|
abstract void |
fillPath(Shape path)
Fills a path.
|
abstract String |
getDestinationName()
Gets destination name: output file name or device description.
|
Color |
getFill()
Gets the current fill color.
|
float |
getFillOpacity()
Gets the current fill opacity.
|
abstract int |
getPageCount()
Gets the number of pages.
|
ColoredStroke |
getStroke()
Gets the current stroke.
|
float |
getStrokeOpacity()
Gets the current stroke opacity.
|
abstract void |
init()
Initializes device.
|
abstract boolean |
isReady()
Shows if device is ready for output.
|
protected void |
restoreGraphicsState()
Rolls back to the graphics state previously saved.
|
protected void |
saveGraphicsState()
Saves the current graphics state.
|
abstract void |
setClip(Shape path)
Sets the current clip path.
|
void |
setFill(Color value)
Sets the current fill color.
|
void |
setFillOpacity(float value)
Sets the current fill opacity.
|
void |
setStroke(ColoredStroke value)
Sets the current stroke.
|
void |
setStrokeOpacity(float value)
Sets the current stroke opacity.
|
abstract void |
setTransform(AffineTransform matrix)
Sets the current coordinate space transformation.
|
abstract void |
showImage(Point2D origin,
Dimension2D size,
byte[] imageData)
Shows a raster image.
|
abstract void |
startDocument()
Starts the whole document.
|
abstract void |
startPage(float width,
float height)
Starts a new page.
|
public Device()
Creates a new instance.
protected Device(Device device)
Clone constructor. Initializes this device with another device.
device
- The device to clone.public abstract void init()
Initializes device.
public abstract int getPageCount()
Gets the number of pages.
public abstract boolean isReady()
Shows if device is ready for output.
True
if device is ready to receive output. Otherwise, False
.public abstract String getDestinationName()
Gets destination name: output file name or device description.
public Device create()
Creates a copy of this device.
public void dispose()
Disposes the device.
public abstract void startDocument()
Starts the whole document.
public abstract void endDocument()
Finalizes the whole document.
public abstract void startPage(float width, float height)
Starts a new page.
width
- The page width.height
- The page height.public abstract void endPage()
Finalizes a page.
public abstract void addHyperlink(Rectangle2D activeRect, ColoredStroke border, String targetUri)
Sets the hyperlink with a URI as its target.
activeRect
- The active rectangle of the link.border
- The link border.targetUri
- The target URI.public abstract void setTransform(AffineTransform matrix)
Sets the current coordinate space transformation.
matrix
- The transformation matrix.public abstract void setClip(Shape path)
Sets the current clip path.
path
- The clip path.public ColoredStroke getStroke()
Gets the current stroke.
public void setStroke(ColoredStroke value)
Sets the current stroke.
value
- The new current stroke.public Color getFill()
Gets the current fill color.
public void setFill(Color value)
Sets the current fill color.
value
- The new current fill color.public float getStrokeOpacity()
Gets the current stroke opacity.
public void setStrokeOpacity(float value)
Sets the current stroke opacity.
value
- The current stroke opacity.public float getFillOpacity()
Gets the current fill opacity.
public void setFillOpacity(float value)
Sets the current fill opacity.
value
- The current fill opacity.protected void saveGraphicsState()
Saves the current graphics state.
protected void restoreGraphicsState()
Rolls back to the graphics state previously saved.
public abstract void drawString(String str, float originX, float originY, List<GlyphData> charInfos)
Draws a text string.
str
- The string.originX
- The x coordinate of the origin.originY
- The x coordinate of the origin.charInfos
- Glyph data required for precise typesetting of a text string.public abstract void drawPath(Shape path)
Draws a path.
path
- A path to draw.public abstract void fillPath(Shape path)
Fills a path.
path
- A path to fill.public abstract void showImage(Point2D origin, Dimension2D size, byte[] imageData)
Shows a raster image.
origin
- The bottom-left corner of the shown image.size
- The size of the shown image.imageData
- The image data.