public interface Image
Device
. An image must be obtained in a
platform-specific manner using FrontPanel.newImage(int, int, int, boolean)
or
FrontPanel.newImage(java.io.InputStream)
.Modifier and Type | Method and Description |
---|---|
void |
crop(Image mask)
Crop this image keeping only non-transparent pixels from given image mask.
|
void |
dispose()
Disposes the image and its resources.
|
default void |
drawImage(Image image)
Draws the given image in the image at position (0,0) (top-left).
|
default void |
drawImage(Image image,
int dx,
int dy,
int dWidth,
int dHeight)
Draws the given image in the image at given position.
|
void |
drawImage(Image image,
int sx,
int sy,
int sWidth,
int sHeight,
int dx,
int dy,
int dWidth,
int dHeight)
Draws the part of the given image in the image at given position.
|
void |
drawLine(int x1,
int y1,
int x2,
int y2,
int color)
Draws a line with the specified boundary and the specified color.
|
void |
drawPixel(int x,
int y,
int color)
Draws a pixel at the specified coordinates and with the specified color.
|
void |
drawRectangle(int x,
int y,
int width,
int height,
int color)
Draws a rectangle with the specified bounds and the specified color.
|
void |
drawString(String s,
int x,
int y,
int textColor,
int backColor)
Draws a string with default font at specified top-left position.
|
void |
drawTransparentImage(Image image,
byte alpha,
int sx,
int sy,
int sWidth,
int sHeight,
int dx,
int dy,
int dWidth,
int dHeight)
Draws the specified area of the given image at the specified destination using alpha blending.
|
void |
fillOval(int x,
int y,
int width,
int height,
int color)
Fills an oval bounded by the specified rectangle with the specified color.
|
void |
fillRectangle(int x,
int y,
int width,
int height,
int color)
Fills a rectangle with the specified bounds and the specified color.
|
void |
fillTransparentRectangle(int x,
int y,
int width,
int height,
int argbColor)
Fills a transparent rectangle (force to turn this image as transparent image).
|
int |
getHeight()
Gets the height of the image.
|
void |
getPixels(int[] pixels)
Gets all the pixels of the image.
|
Object |
getRAWImage()
Gets the RAW image of the front panel image.
|
Image |
getTransparentImage(byte alpha)
Gets a transparent image of the image.
|
int |
getWidth()
Gets the width of the image.
|
int |
readPixel(int x,
int y)
Gets the color at the specified location.
|
void |
setPixels(int[] pixels)
Sets all the pixels of the image.
|
void |
setTransparentMode(boolean transparent)
All drawings in transparent mode manage alpha channel for the given colors.
|
void crop(Image mask) throws IllegalArgumentException
If mask is null, nothing is cropped. When not null, the mask must have the same size than this image.
mask
- the reference image.IllegalArgumentException
- if the given mask has not the same size than this image.void dispose()
default void drawImage(Image image)
getWidth()
* getHeight()
.image
- the image to draw.default void drawImage(Image image, int dx, int dy, int dWidth, int dHeight)
image
- the image to draw.dx
- the x coordinate of the destination point.dy
- the y coordinate of the destination point.dWidth
- destination rectangle width.dHeight
- destination rectangle height.void drawImage(Image image, int sx, int sy, int sWidth, int sHeight, int dx, int dy, int dWidth, int dHeight)
image
- the image to draw.sx
- the x coordinate of the image area to draw.sy
- the y coordinate of the image area to draw.sWidth
- the width of the image area to draw.sHeight
- the height of the image area to draw.dx
- the x coordinate of the destination point.dy
- the y coordinate of the destination point.dWidth
- destination rectangle width.dHeight
- destination rectangle height.void drawLine(int x1, int y1, int x2, int y2, int color)
x1
- the x coordinate of the first point.y1
- the y coordinate of the first point.x2
- the x coordinate of the second point.y2
- the y coordinate of the second point.color
- the color of the drawing.void drawPixel(int x, int y, int color)
x
- the x coordinate of the pixel.y
- the y coordinate of the pixel.color
- the color of the drawing.void drawRectangle(int x, int y, int width, int height, int color)
x
- the x coordinate of the rectangle.y
- the x coordinate of the rectangle.width
- the width of the rectangle.height
- the height of the rectangle.color
- the color of the drawing.void drawString(String s, int x, int y, int textColor, int backColor)
s
- the string to draw.x
- the x coordinate of the upper left corner.y
- the y coordinate of the upper left corner.textColor
- the ARGB color of text.backColor
- the ARGB color of background.void drawTransparentImage(Image image, byte alpha, int sx, int sy, int sWidth, int sHeight, int dx, int dy, int dWidth, int dHeight)
image
- the image to draw.alpha
- the alpha blending to apply during drawing (0 <= alpha <= 0xff).sx
- the top-left X coordinate of the area to draw.sy
- the top-left Y coordinate of the area to draw.sWidth
- the width of the area to draw.sHeight
- the height of the area to draw.dx
- the top-left X coordinate of the destination.dy
- the top-left Y coordinate of the destination.dWidth
- destination rectangle width.dHeight
- destination rectangle height.void fillOval(int x, int y, int width, int height, int color)
x
- the x coordinate of the upper left corner of the oval to be filled.y
- the y coordinate of the upper left corner of the oval to be filled.width
- the width of the oval to be filled.height
- the height of the oval to be filled.color
- the color of the drawing.void fillRectangle(int x, int y, int width, int height, int color)
x
- the x coordinate of the rectangle.y
- the x coordinate of the rectangle.width
- the width of the rectangle.height
- the height of the rectangle.color
- the color of the drawing.void fillTransparentRectangle(int x, int y, int width, int height, int argbColor)
x
- the x coordinate of the rectangle.y
- the x coordinate of the rectangle.width
- the width of the rectangle.height
- the height of the rectangle.argbColor
- the rectangle color with the alpha level.int getHeight()
void getPixels(int[] pixels)
pixels
- the array of pixels (its size must be greater equals to
getWidth()
* getHeight()
.ArrayIndexOutOfBoundsException
- if the given pixels array is too small.Object getRAWImage()
java.awt.image.BufferedImage
.org.eclipse.swt.graphics.Image
Image getTransparentImage(byte alpha)
alpha
- the opacity level (0xff is opaque, 0x00 is transparent).int getWidth()
int readPixel(int x, int y)
x
- the x coordinate.y
- the x coordinate.IndexOutOfBoundsException
- if the specified coordinates are out of the image bounds.void setPixels(int[] pixels)
pixels
- the array of pixels (its size must be greater equals to
getWidth()
* getHeight()
ArrayIndexOutOfBoundsException
- if the given pixels array is too small.void setTransparentMode(boolean transparent)
transparent
- true
to set transparent mode, false
otherwise.