public class ImageDevice extends Device
Implements the interface for outputting text and graphic content to image(s).
| Modifier | Constructor and Description |
|---|---|
|
ImageDevice() |
|
ImageDevice(boolean whiteBackground)
Creates new instance.
|
protected |
ImageDevice(ImageDevice device)
Clone constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
int |
getPageCount()
Gets the number of pages.
|
byte[][] |
getResult()
Returns the resulting images byte arrays.
|
ColoredStroke |
getStroke()
Gets the current stroke.
|
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 |
setStroke(ColoredStroke value)
Sets the current stroke.
|
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, saveGraphicsStatepublic ImageDevice()
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 Devicepublic boolean isReady()
Shows if device is ready for output.
public String getDestinationName()
Gets destination name: output file name or device description.
getDestinationName in class Devicepublic 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 Devicepublic void endDocument()
Finalizes the whole document.
endDocument in class Devicepublic void startPage(float width,
float height)
Starts a new page.
public void setTransform(AffineTransform matrix)
Sets the current coordinate space transformation.
setTransform in class Devicematrix - 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 void drawString(String str, float originX, float originY, List<GlyphData> charInfos)
Draws a text string.
drawString in class Devicestr - 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 © 2021 Aspose. All Rights Reserved.