public interface ISurface
Modifier and Type | Field and Description |
---|---|
static int |
IMAGE_SURFACE |
static int |
PRINTERJOB_SURFACE |
static int |
WINDOW_SURFACE |
Modifier and Type | Method and Description |
---|---|
boolean |
canCapture()
This returns true if it is possible to read pixel data from the surface
into an Image.
|
boolean |
canMove()
This returns true if it is possible to move pixel within the surface.
|
boolean |
captureImage(Image dest,
int x,
int y,
int width,
int height)
Capture pixel data from the surface to an Image.
|
void |
drawImage(Image src,
int clipX,
int clipY,
int clipWidth,
int clipHeight,
int destX,
int destY,
int width,
int height)
This should always work for any surface and is the minimum functionality
expected.
|
Image |
getCompatibleImage(int width,
int height)
Get an Image that is optimized for display on the surface.
|
Image |
getCompatibleImagePoints(double widthInPoints,
double heightInPoints)
Get an Image that is optimized for display on the surface and which covers a specific size in points (1/72 of an inch)
when rendered on the surface.
|
boolean |
getDPI(double[] xyDpi)
Get the dots per inch resolution of the surface if possible.
|
FontMetrics |
getFontMetrics(Font f)
Return a FontMetrics for the surface.
|
Graphics |
getGraphics()
This returns a new Graphics for use on the surface IF it is supported.
|
Object |
getNativeDrawable()
This is used internally and should not be used.
|
int |
getSurfaceType()
This returns one of the XXX_SURFACE values.
|
boolean |
moveImage(int srcX,
int srcY,
int srcWidth,
int srcHeight,
int destX,
int destY)
Move pixel data within the surface.
|
static final int WINDOW_SURFACE
static final int IMAGE_SURFACE
static final int PRINTERJOB_SURFACE
int getSurfaceType()
Object getNativeDrawable()
FontMetrics getFontMetrics(Font f)
f
- the Font to use.void drawImage(Image src, int clipX, int clipY, int clipWidth, int clipHeight, int destX, int destY, int width, int height)
Note that the image is not scaled. If width and height are smaller than the actual image dimensions, then the image is clipped.
src
- The source image.clipX
- The x co-ordinate of the clipping rectangle within the surface.clipY
- The y co-ordinate of the clipping rectangle within the surface.clipWidth
- The width of the clipping rectangle within the surface.clipHeight
- The height of the clipping rectangle within the surface.destX
- The destination x co-ordinate for the image.destY
- The destination y co-ordinate for the image.width
- The number of pixels horizontally to draw from the image.height
- The number of pixels vertically to draw from the image.boolean captureImage(Image dest, int x, int y, int width, int height)
dest
- x
- y
- width
- height
- boolean moveImage(int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY)
srcX
- srcY
- srcWidth
- srcHeight
- destX
- destY
- boolean canCapture()
boolean canMove()
Image getCompatibleImage(int width, int height) throws IllegalArgumentException
width
- the width of the image. This must be greater than or equal to 1.height
- the height of the image. This must be greater than or equal to 1.IllegalArgumentException
- if the width or height is less than 1.Graphics getGraphics() throws UnsupportedOperationException
UnsupportedOperationException
boolean getDPI(double[] xyDpi)
xyDpi
- a destination double array to hold the dpi information. Element 0 will hold the horizontal DPI
and element 1 will hold the vertical DIP.Image getCompatibleImagePoints(double widthInPoints, double heightInPoints) throws IllegalArgumentException
widthInPoints
- the width of the image int points (1/72 of an inch). This must be greater than 0.heightInPoints
- the height of the image int points (1/72 of an inch). This must be greater than 0.IllegalArgumentException
- if the width or height is less than or is zero.