public class ImageDevice extends Device
Implements the interface for outputting text and graphic content to image(s).
Modifier | Constructor and Description |
---|---|
|
ImageDevice()
Creates new instance.
|
|
ImageDevice(boolean whiteBackground)
Creates new instance.
|
protected |
ImageDevice(ImageDevice device)
Clone constructor.
|
Modifier and Type | Method and Description |
---|---|
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 |
cropPage(int scale,
Color bgColor,
float margin) |
void |
dispose()
Disposes this device instance.
|
void |
drawPath(Shape path)
Draws a path.
|
void |
drawString(String str,
float originX,
float originY,
List<GlyphData> charInfos)
Draws a text string.
|
void |
endDocument()
Finalizes the whole document.
|
void |
endPage()
Finalizes a page.
|
void |
fillPath(Shape path)
Fills a path.
|
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.
|
int |
getPageCount()
Gets the number of pages.
|
byte[][] |
getResult()
Returns the resulting images byte arrays.
|
ColoredStroke |
getStroke()
Gets the current stroke.
|
float |
getStrokeOpacity()
Gets the current stroke opacity.
|
void |
init()
Initializes device.
|
boolean |
isReady()
Shows if device is ready for output.
|
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.
|
void |
setTransform(AffineTransform matrix)
Sets the current coordinate space transformation.
|
void |
showImage(Point2D origin,
Dimension2D size,
byte[] imageData)
Shows a raster image.
|
void |
startDocument()
Starts the whole document.
|
void |
startPage(float width,
float height)
Starts a new page.
|
restoreGraphicsState, saveGraphicsState
public ImageDevice()
Creates new instance. The output file will be written to the output working directory taking the job name as a file name.
public ImageDevice(boolean whiteBackground)
Creates new instance. The output file will be written to the output working directory taking the job name as a file name.
whiteBackground
- If true then fills white background on every page.protected ImageDevice(ImageDevice device)
Clone constructor. Initializes this device with another device.
device
- The device to clone.public int getPageCount()
Gets the number of pages.
getPageCount
in class Device
public boolean isReady()
Shows if device is ready for output.
public String getDestinationName()
Gets destination name: output file name or device description.
getDestinationName
in class Device
public byte[][] getResult()
Returns the resulting images byte arrays. The first dimension is for pages.
public Device create()
Creates a copy of this device.
public void dispose()
Disposes this device instance. Finalizes this device instance graphics state, i.e. switches composing context to the level higher then this device's graphics state.
public void startDocument()
Starts the whole document.
startDocument
in class Device
public void endDocument()
Finalizes the whole document.
endDocument
in class Device
public void startPage(float width, float height)
Starts a new page.
public void addHyperlink(Rectangle2D activeRect, ColoredStroke border, String targetUri)
Sets the hyperlink with a URI as its target.
addHyperlink
in class Device
activeRect
- The active rectangle of the link.border
- The link border.targetUri
- The target URI.public void setTransform(AffineTransform matrix)
Sets the current coordinate space transformation.
setTransform
in class Device
matrix
- The transformation matrix.public void setClip(Shape path)
Sets the current clip path.
public ColoredStroke getStroke()
Gets the current stroke.
public void setStroke(ColoredStroke value)
Sets the current stroke.
public Color getFill()
Gets the current fill color.
public void setFill(Color value)
Sets the current fill color.
public float getStrokeOpacity()
Gets the current stroke opacity.
getStrokeOpacity
in class Device
public void setStrokeOpacity(float value)
Sets the current stroke opacity.
setStrokeOpacity
in class Device
value
- The current stroke opacity.public float getFillOpacity()
Gets the current fill opacity.
getFillOpacity
in class Device
public void setFillOpacity(float value)
Sets the current fill opacity.
setFillOpacity
in class Device
value
- The current fill opacity.public void drawString(String str, float originX, float originY, List<GlyphData> charInfos)
Draws a text string.
drawString
in class Device
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 void drawPath(Shape path)
Draws a path.
public void fillPath(Shape path)
Fills a path.
public void showImage(Point2D origin, Dimension2D size, byte[] imageData)
Shows a raster image.
public void cropPage(int scale, Color bgColor, float margin)
Copyright © 2022 Aspose. All Rights Reserved.