public interface MicroUIGraphicsContext extends MicroUIImage
This interface is used by all drawing functions to target the destination. It can be mapped on byte array given as parameter in MicroUI natives. This byte array is retrieved in MicroEJ application using the method GraphicsContext.getSNIContext().
| Modifier and Type | Method and Description |
|---|---|
void |
configureClip(boolean enable)
Enables or disables the graphics context clip.
|
int |
getAndClearDrawingLogFlags()
Gets and clears the drawing log flags from a graphics context.
|
int |
getClipX1() |
int |
getClipX2() |
int |
getClipY1() |
int |
getClipY2() |
int |
getEllipsisWidth()
Tells if the ellipsis is enabled or not.
|
int |
getMicroUIColor()
Returns the current MicroUI drawing color to use to perform drawings.
|
int |
getRenderingColor()
Returns the color to use to render the drawings.
|
void |
intersectClip(int x,
int y,
int width,
int height)
Combines the given clipping rectangle with the clipping area of this graphics context.
|
boolean |
isClipEnabled()
Tells if the clip is enabled or not.
|
boolean |
isHorizontalLineInClip(int x1,
int x2,
int y)
Tells if given horizontal line fully fits the clip or not.
|
boolean |
isPointInClip(int x,
int y)
Tells if given point fits the clip or not.
|
boolean |
isRectangleInClip(int x1,
int y1,
int x2,
int y2)
Tells if given rectangle fully fits the clip or not.
|
boolean |
isRegionInClip(int x,
int y,
int width,
int height)
Tells if given region (from x,y to x+width-1,y+height-1) fully fits the clip or not.
|
boolean |
isVerticalLineInClip(int y1,
int y2,
int x)
Tells if given vertical line fully fits the clip or not.
|
boolean |
regionsOverlap(MicroUIImage img,
int regionX,
int regionY,
int width,
int height,
int destX,
int destY)
Tells if source and destination share a region.
|
void |
reportError(int flags)
Reports errors occurring during a drawing operation.
|
void |
reportWarning(int flags)
Reports non-critical incidents occurring during a drawing operation.
|
boolean |
requestDrawing()
Requests a drawing on the graphics context.
|
void |
setClip(int x,
int y,
int width,
int height)
Sets the clip.
|
void |
setMicroUIColor(int color)
Sets the current MicroUI drawing color to use to perform drawings.
|
getFormat, getHeight, getIdentifier, getImage, getImage, getWidth, isClosed, isLCD, isMutable, readPixel, requestReadingint getMicroUIColor()
void setMicroUIColor(int color)
Beware that calling this method alters the color in the GraphicsContext instance manipulated by the Java user. The caller must save the color before modifying it and restore it afterwards.
color - in 0xAARRGGBB format (where alpha level is always 0xff == fully opaque).int getRenderingColor()
Equivalent of LLUIDisplay.Instance.convertARGBColorToColorToDraw(getMicroUIColor());
LLUIDisplay.convertARGBColorToColorToDraw(int)int getClipX1()
int getClipY1()
int getClipX2()
int getClipY2()
void setClip(int x,
int y,
int width,
int height)
Make sure that the clip is enabled for this call to be efficient.
Beware that calling this method alters the clip in the GraphicsContext instance manipulated by the Java user. The caller must save the clip before modifying it and restore it afterwards.
x - top-left X coordinate of the clip.y - top-left Y coordinate of the clip.width - width of the clip.height - height of the clip.configureClip(boolean),
isClipEnabled()void intersectClip(int x,
int y,
int width,
int height)
This method sets the clipping area to be the intersection of the given rectangle with the current clipping area.
Make sure that the clip is enabled for this call to be efficient.
Beware that calling this method alters the clip in the GraphicsContext instance manipulated by the Java user. The caller must save the clip before modifying it and restore it afterwards.
x - top-left X coordinate of the clip.y - top-left Y coordinate of the clip.width - width of the clip.height - height of the clip.configureClip(boolean),
isClipEnabled()void configureClip(boolean enable)
enable - false to disable the clip.boolean isClipEnabled()
When it is disabled, that means the caller considers the drawing is fitting the clip. In this case checking the clip bounds is useless.
boolean isPointInClip(int x,
int y)
x - the pixel X coordinate.y - the pixel Y coordinate.boolean isHorizontalLineInClip(int x1,
int x2,
int y)
x1 - the first pixel line X coordinate.x2 - the last pixel line X coordinate.y - the both pixels line Y coordinate.boolean isVerticalLineInClip(int y1,
int y2,
int x)
x - the both pixels line X coordinate.y1 - the first pixel line Y coordinate.y2 - the last pixel line Y coordinate.boolean isRectangleInClip(int x1,
int y1,
int x2,
int y2)
x1 - the top-left pixel X coordinate.y1 - the top-left pixel Y coordinate.x2 - the bottom-right pixel X coordinate.y2 - the top-right pixel Y coordinate.boolean isRegionInClip(int x,
int y,
int width,
int height)
x - the top-left pixel X coordinate.y - the top-left pixel Y coordinate.width - the region width.height - the region height.boolean regionsOverlap(MicroUIImage img, int regionX, int regionY, int width, int height, int destX, int destY)
gc - the MicroUI GraphicsContext target of destination.img - the MicroUI Image to draw.regionX - the x coordinate of the upper-left corner of the region to check.regionY - the y coordinate of the upper-left corner of the region to check.width - the width of the region to check.height - the height of the region to check.destX - the x coordinate of the top-left point in the destination.destY - the y coordinate of the top-left point in the destination.int getEllipsisWidth()
int getAndClearDrawingLogFlags()
sd - the graphics contextvoid reportWarning(int flags)
context - the graphics context in which the incidents occurredflags - the flags to setvoid reportError(int flags)
context - the graphics context in which the errors occurredflags - the flags to setboolean requestDrawing()