public interface LLUIDisplay
An instance of this framework is available via the Instance field. To use the framework methods, caller must
synchronize its calls on this Instance field.
| Modifier and Type | Field and Description |
|---|---|
static LLUIDisplay |
Instance
Unique instance of MicroUI Graphics Engine.
|
| Modifier and Type | Method and Description |
|---|---|
int |
blend(int foreground,
int background,
int alpha)
Blends two colors applying a global alpha factor.
|
int |
convertARGBColorToColorToDraw(int color)
Converts the given MicroUI color (format 0xAARRGGBB) in a truncated color (same format: 0xAARRGGBB).
|
void |
convertRegion(MicroUIImage image,
int x,
int y,
int width,
int height)
Converts the colors of the pixels in the given image's region.
|
BufferedImageProvider |
getBufferedImageProvider(MicroUIImageFormat format)
Gets the buffered image provider used to create images with the given format.
|
MicroUIImageFormat |
getDisplayFormat()
Gets the display format.
|
int |
getDisplayPixelDepth()
Gets the number of bits (opacity included) to represent a pixel on the hardware device.
|
java.nio.ByteOrder |
getEndianness()
Gets the endianness of the architecture.
|
MicroUIImage |
getSource(MicroUIImage image)
Returns an image that targets the front buffer (display buffer) instead of the back buffer.
|
UIDrawing |
getUIDrawer(MicroUIGraphicsContext gc)
Gets the drawer used to draw on the given graphics context.
|
UIDrawing |
getUIDrawer(MicroUIImageFormat format)
Gets the drawer used to draw with the given format.
|
UIDrawing |
getUIDrawerSoftware()
Unique instance of MicroUI Graphics Engine's internal software drawer.
|
UIFontDrawing |
getUIFontDrawer(MicroUIFont font)
Gets the font drawer used to draw the given font.
|
UIFontDrawing |
getUIFontDrawer(MicroUIFontFormat format)
Gets the font drawer used to draw the fonts with the given format.
|
UIImageDrawing |
getUIImageDrawer(MicroUIImage image)
Gets the image drawer used to draw the given image.
|
UIImageDrawing |
getUIImageDrawer(MicroUIImageFormat format)
Gets the image drawer used to draw the images with the given format.
|
boolean |
isCustomFormat(MicroUIFontFormat format)
Tells if format is a custom format or not.
|
boolean |
isCustomFormat(MicroUIImageFormat format)
Tells if format is a custom format or not.
|
boolean |
isDisplayFormat(MicroUIImageFormat format)
Tells if format is the display format or not.
|
MicroUIFont |
mapMicroUIFont(byte[] font)
Maps a MicroUI Font byte array (retrieved by MicroEJ application calling
font.getSNIContext()) on a
MicroUIFont. |
MicroUIGraphicsContext |
mapMicroUIGraphicsContext(byte[] gc)
Maps a MicroUI GraphicsContext byte array (retrieved by MicroEJ application calling
gc.getSNIContext()) on a MicroUIGraphicsContext. |
MicroUIImage |
mapMicroUIImage(byte[] image)
Maps a MicroUI Image byte array (retrieved by MicroEJ application calling
image.getSNIContext()) on
a MicroUIImage. |
MicroUIRenderableString |
mapMicroUIRenderableString(byte[] renderableString)
Maps a MicroUI RenderableString byte array (retrieved by MicroEJ application calling
renderableString.getSNIContext()) on a MicroUIRenderableString. |
char[] |
mapString(char[] chars,
int offset,
int length)
Maps a char array subset on a string.
|
MicroUIGraphicsContext |
newMicroUIGraphicsContext(byte[] gc)
Creates a new
MicroUIGraphicsContext for the given MicroUI GraphicsContext byte array. |
MicroUIImage |
newMicroUIImage(byte[] image)
Creates a new
MicroUIImage for the given MicroUI Image byte array. |
void |
registerBufferedImageProvider(BufferedImageProvider provider)
Registers a buffered image provider.
|
void |
registerUIDrawer(UIDrawing drawer)
Registers a drawer that supports a specific format.
|
void |
registerUIFontDrawer(UIFontDrawing drawer)
Registers a drawer that supports a specific format.
|
void |
registerUIImageDrawer(UIImageDrawing drawer)
Registers a drawer that supports a specific format.
|
void |
requestFlush()
Requests a call to
LLUIDisplayImpl.flush() if something has been drawn in the back buffer (application
dirty region is not null). |
void |
requestRender()
Requests a call to
Displayable.render() (current displayable on display). |
void |
unregisterBufferedImageProvider(MicroUIImageFormat format)
Unregisters the buffered image provider registered for a specific format.
|
void |
unregisterUIDrawer(MicroUIImageFormat format)
Unregisters the drawer registered for the given format.
|
void |
unregisterUIFontDrawer(MicroUIFontFormat format)
Unregisters the drawer registered for the given format.
|
void |
unregisterUIImageDrawer(MicroUIImageFormat format)
Unregisters the drawer registered for the given format.
|
static final LLUIDisplay Instance
To use the framework methods, caller must synchronize its calls on this Instance field.
UIDrawing getUIDrawerSoftware()
UIDrawing and
it implements all drawings in software. The rendering is exactly the same than the embedded algorithms listed in
ui_drawing_soft.h.
This drawer converts the MicroUI graphics context color, respects the clip and updates the new
Display.flush() region (dirty region) as mentioned in LLUIPainter class comment.
UIDrawing in software.MicroUIGraphicsContext mapMicroUIGraphicsContext(byte[] gc)
gc.getSNIContext()) on a MicroUIGraphicsContext.
Implementation notes:
MicroUIGraphicsContext fields are updated. By
consequence this method can only be called once during a MicroUI native call. See
newMicroUIGraphicsContext(byte[]) to force to create a new MicroUIGraphicsContext instead.gc.getSNIContext(). If given byte array does not respect this rule, the behavior is unknown.gc - the MicroUI GraphicsContext representation.MicroUIGraphicsContext object updated with the given MicroUI GraphicsContext
characteristics.MicroUIGraphicsContext newMicroUIGraphicsContext(byte[] gc)
MicroUIGraphicsContext for the given MicroUI GraphicsContext byte array. This allows to
manipulate several destination targets in same native call. However it takes more time to create a new instance
at each native call than mapping the unique instance.
The implementation assumes given byte array has been retrieved by MicroEJ application calling
gc.getSNIContext(). If given byte array does not respect this rule, the behavior is unknown.
gc - the MicroUI GraphicsContext representation.MicroUIGraphicsContext object updated with the given MicroUI GraphicsContext
characteristics.mapMicroUIGraphicsContext(byte[])MicroUIImage mapMicroUIImage(byte[] image)
image.getSNIContext()) on
a MicroUIImage. This image can be used as source (copy image in a graphics context) or as target (copy
image in another image).
Implementation notes:
MicroUIImage fields are updated. By consequence this
method can only be called once during a MicroUI native call. See newMicroUIImage(byte[]) to force to
create a new MicroUIImage instead.image.getSNIContext(). If given byte array does not respect this rule, the behavior is unknown.image - the MicroUI Image representation.MicroUIImage object updated with the given MicroUI Image characteristics.MicroUIImage newMicroUIImage(byte[] image)
MicroUIImage for the given MicroUI Image byte array. This allows to manipulate several
sources and targets in same native call. However it takes more time to create a new instance at each native call
than mapping the unique instance.
The implementation assumes given byte array has been retrieved by MicroEJ application calling
image.getSNIContext(). If given byte array does not respect this rule, the behavior is unknown.
image - the MicroUI Image representation.MicroUIImage object updated with the given MicroUI Image characteristics.mapMicroUIImage(byte[])MicroUIFont mapMicroUIFont(byte[] font)
font.getSNIContext()) on a
MicroUIFont.
Implementation notes:
MicroUIFont fields are updated. By consequence this
method can only be called once during a MicroUI native call.font.getSNIContext(). If given byte array does not respect this rule, the behavior is unknown.font - the MicroUI Font representation.MicroUIFont object updated with the given MicroUI Font characteristics.MicroUIRenderableString mapMicroUIRenderableString(byte[] renderableString)
renderableString.getSNIContext()) on a MicroUIRenderableString.
Implementation notes:
MicroUIRenderableString fields are updated. By
consequence this method can only be called once during a MicroUI native call.renderableString.getSNIContext(). If given byte array does not respect this rule, the behavior is
unknown.renderableString - the MicroUI RenderableString representationMicroUIRenderableString object updated with the given MicroUI RenderableString
characteristicschar[] mapString(char[] chars,
int offset,
int length)
chars - the char arrayoffset - the offset in the char arraylength - the lengthint getDisplayPixelDepth()
void requestFlush()
LLUIDisplayImpl.flush() if something has been drawn in the back buffer (application
dirty region is not null). The call of LLUIDisplayImpl.flush() is synchronized with the MicroEJ
application drawing (see MicroUI event pump).void requestRender()
Displayable.render() (current displayable on display). The call of
Displayable.render() is synchronized with the MicroEJ application drawing (see MicroUI event pump).int convertARGBColorToColorToDraw(int color)
This color takes in consideration the hardware display pixel representation constraints. For instance, for a display with the pixel format RGB565, the truncated color of green color (0xff00ff00) is 0xff00fc00 (because RGB565 format keeps only 6 first bits for green component).
This truncated color must be used to convert the MicroUI GraphicsContext current color in order to respect the hardware display pixel representation constraints.
color - the MicroUI color in format 0xAARRGGBB.void convertRegion(MicroUIImage image, int x, int y, int width, int height)
convertARGBColorToColorToDraw(int) for each region's
pixel.image - the image to update.x - the top-left pixel X coordinate.y - the top-left pixel Y coordinate.width - the region width.height - the region height.int blend(int foreground,
int background,
int alpha)
foreground - the ARGB8888 foreground color.background - the ARGB8888 background color.alpha - the global alpha factor.MicroUIImageFormat getDisplayFormat()
MicroUIImageFormatboolean isDisplayFormat(MicroUIImageFormat format)
format - the format to check.MicroUIImageFormatboolean isCustomFormat(MicroUIImageFormat format)
format - the format to check.MicroUIImageFormatvoid registerUIDrawer(UIDrawing drawer)
drawer - the drawerUIDrawing.handledFormat()void unregisterUIDrawer(MicroUIImageFormat format)
format - the now unsupported formatUIDrawing.handledFormat()UIDrawing getUIDrawer(MicroUIGraphicsContext gc)
gc - the graphics context to draw onUIDrawing getUIDrawer(MicroUIImageFormat format)
format - the formatvoid registerUIImageDrawer(UIImageDrawing drawer)
drawer - the drawerUIImageDrawing.handledFormat()void unregisterUIImageDrawer(MicroUIImageFormat format)
format - the now unsupported formatUIImageDrawing.handledFormat()UIImageDrawing getUIImageDrawer(MicroUIImage image)
image - the image to drawUIImageDrawing getUIImageDrawer(MicroUIImageFormat format)
format - the format of the image to drawvoid registerBufferedImageProvider(BufferedImageProvider provider)
It will be used to create buffered image for the format it handles
(BufferedImageProvider.newBufferedImage(int, int)).
It will also be registered as is also registered as drawer registerUIDrawer(UIDrawing) and custom image
drawer registerUIImageDrawer(UIImageDrawing).
provider - the buffered image providervoid unregisterBufferedImageProvider(MicroUIImageFormat format)
format - the formatBufferedImageProvider getBufferedImageProvider(MicroUIImageFormat format)
format - the format of the created imagesnull if none)boolean isCustomFormat(MicroUIFontFormat format)
format - the format to check.MicroUIFontFormatUIFontDrawing getUIFontDrawer(MicroUIFont font)
font - the font to drawUIFontDrawing getUIFontDrawer(MicroUIFontFormat format)
format - the format of the font to drawvoid registerUIFontDrawer(UIFontDrawing drawer)
drawer - the drawerUIFontDrawing.handledFormat()void unregisterUIFontDrawer(MicroUIFontFormat format)
format - the now unsupported formatUIFontDrawing.handledFormat()MicroUIImage getSource(MicroUIImage image)
This behavior only concerns the following use case:
For all other use cases, the returned image is the given parameter.
image - the Java image.java.nio.ByteOrder getEndianness()