public interface UIImageDrawing
This interface can be fully implemented by a dedicated class in front panel project. This allows to draw and decode images with a custom format.
| Modifier and Type | Method and Description |
|---|---|
default java.lang.Object |
decode(byte[] data,
int offset,
int width,
int height,
boolean isBigEndian)
Decodes the image generated by the Image Generator.
|
default void |
draw(MicroUIGraphicsContext gc,
MicroUIImage img,
int regionX,
int regionY,
int width,
int height,
int x,
int y,
int alpha)
Draws a region of an image.
|
default void |
drawFlipped(MicroUIGraphicsContext gc,
MicroUIImage img,
int regionX,
int regionY,
int width,
int height,
int x,
int y,
LLDWPainter.DrawingFlip flip,
int alpha)
Draws an image applying a flip (0, 90, 180 or 270 degrees with or without mirror).
|
default void |
drawRotatedBilinear(MicroUIGraphicsContext gc,
MicroUIImage img,
int x,
int y,
int rotationX,
int rotationY,
float angle,
int alpha)
Draws an image applying a free rotation (0 to 360 degrees).
|
default void |
drawRotatedNearestNeighbor(MicroUIGraphicsContext gc,
MicroUIImage img,
int x,
int y,
int rotationX,
int rotationY,
float angle,
int alpha)
Draws an image applying a free rotation (0 to 360 degrees).
|
default void |
drawScaledBilinear(MicroUIGraphicsContext gc,
MicroUIImage img,
int x,
int y,
float factorX,
float factorY,
int alpha)
Draws an image applying a scaling.
|
default void |
drawScaledNearestNeighbor(MicroUIGraphicsContext gc,
MicroUIImage img,
int x,
int y,
float factorX,
float factorY,
int alpha)
Draws an image applying a scaling.
|
MicroUIImageFormat |
handledFormat()
Gets the supported custom image format.
|
MicroUIImageFormat handledFormat()
default void draw(MicroUIGraphicsContext gc, MicroUIImage img, int regionX, int regionY, int width, int height, int x, int y, int alpha)
If the specified source region exceeds the image bounds, the copied region is limited to the image boundary. If the copied region goes out of the bounds of the graphics context area, pixels out of the range will not be drawn.
A global opacity value is given. When this value is 0xff (255, opaque), that means the image is drawn on the graphics context without managing an extra opacity. Only the image transparent pixels must have been merged with destination. All image opaque pixels override destination.
When this value is a value between 0 and 0xff, that means each pixel of the image must be merged with destination in addition with the image transparent pixels. An image opaque pixel becomes transparent (its opacity is the given alpha) and the opacity of an image transparent pixel becomes (alpha * alpha(pixel)) / 255.
gc - the MicroUI GraphicsContext target.img - the MicroUI Image to draw.regionX - the x coordinate of the upper-left corner of the region to copy.regionY - the y coordinate of the upper-left corner of the region to copy.width - the width of the region to copy.height - the height of the region to copy.x - the x coordinate of the top-left point in the destination.y - the y coordinate of the top-left point in the destination.alpha - the opacity level to apply to the region.default void drawFlipped(MicroUIGraphicsContext gc, MicroUIImage img, int regionX, int regionY, int width, int height, int x, int y, LLDWPainter.DrawingFlip flip, int alpha)
gc - the MicroUI GraphicsContext target.img - the MicroUI Image to draw.regionX - the x coordinate of the upper-left corner of the region to draw.regionY - the y coordinate of the upper-left corner of the region to draw.width - the width of the region to copy.height - the height of the region to copy.x - the x coordinate of the top-left point in the destination.y - the y coordinate of the top-left point in the destination.flip - the flip to apply.alpha - the opacity level to apply to the region.default void drawRotatedNearestNeighbor(MicroUIGraphicsContext gc, MicroUIImage img, int x, int y, int rotationX, int rotationY, float angle, int alpha)
The rotation is specified by the center and the angle. The reference point is the graphical object top-left corner. The rotation point is relative where the graphical object will be drawn.
This method uses the nearest neighbor algorithm to render the content. This algorithm is faster than bilinear algorithm.
gc - the MicroUI GraphicsContext target.img - the MicroUI Image to draw.x - the x coordinate of the image reference anchor top-left point.y - the y coordinate of the image reference anchor top-left point.rotationX - the x coordinate of the rotation center.rotationY - the y coordinate of the rotation center.angle - the rotation angle.alpha - the opacity level to apply to the region.default void drawRotatedBilinear(MicroUIGraphicsContext gc, MicroUIImage img, int x, int y, int rotationX, int rotationY, float angle, int alpha)
The rotation is specified by the center and the angle. The reference point is the graphical object top-left corner. The rotation point is relative where the graphical object will be drawn.
This method uses the bilinear algorithm to render the content. This algorithm performs better rendering than nearest neighbor algorithm but it is slower to apply.
gc - the MicroUI GraphicsContext target.img - the MicroUI Image to draw.x - the x coordinate of the image reference anchor top-left point.y - the y coordinate of the image reference anchor top-left point.rotationX - the x coordinate of the rotation center.rotationY - the y coordinate of the rotation center.angle - the rotation angle.alpha - the opacity level to apply to the region.default void drawScaledNearestNeighbor(MicroUIGraphicsContext gc, MicroUIImage img, int x, int y, float factorX, float factorY, int alpha)
This method uses the nearest neighbor algorithm to render the content. This algorithm is faster than bilinear algorithm.
gc - the MicroUI GraphicsContext target.img - the MicroUI Image to draw.x - the x coordinate of the image reference anchor top-left point.y - the y coordinate of the image reference anchor top-left point.factorX - scaling X factor.factorY - scaling Y factor.alpha - the opacity level to apply to the region.default void drawScaledBilinear(MicroUIGraphicsContext gc, MicroUIImage img, int x, int y, float factorX, float factorY, int alpha)
This method uses the bilinear algorithm to render the content. This algorithm performs better rendering than nearest neighbor algorithm but it is slower to apply.
gc - the MicroUI GraphicsContext target.img - the MicroUI Image to draw.x - the x coordinate of the image reference anchor top-left point.y - the y coordinate of the image reference anchor top-left point.factorX - scaling X factor.factorY - scaling Y factor.alpha - the opacity level to apply to the region.default java.lang.Object decode(byte[] data,
int offset,
int width,
int height,
boolean isBigEndian)
The image buffer encoding is shared between the Image Generator, the embedded VEE Port and this implementation. On the embedded VEE Port, the data should be used as is (no runtime decoding step) and should be optimized to be as fast as possible. On the simulator, the data has to be decoded at runtime.
The data is encoded in the given byte array at given offset. Its endianness depends on the embedded VEE Port endianness.
The default implementation returns null that means that the implementation is not able to use the
encoded images.
data - the image encoded data.offset - the index of the first data.width - the image width in pixels.height - the image height in pixels.isBigEndian - true when the embedded VEE Port endianness is big endian, false otherwise.