public class Display
extends ej.fp.Composite
implements ej.microui.display.LLUIDisplayImpl, ej.fp.MouseListener
LLUIDisplayImpl interface. An implementation of this interface is
required to be able to use a MicroUI Display in a MicroEJ application.
This widget has been implemented to target a standard display: a display whose pixel format is
MicroUIImageFormat.MICROUI_IMAGE_FORMAT_ARGB8888 , MicroUIImageFormat.MICROUI_IMAGE_FORMAT_RGB888,
MicroUIImageFormat.MICROUI_IMAGE_FORMAT_RGB565, MicroUIImageFormat.MICROUI_IMAGE_FORMAT_ARGB1555,
MicroUIImageFormat.MICROUI_IMAGE_FORMAT_ARGB4444, MicroUIImageFormat.MICROUI_IMAGE_FORMAT_C4,
MicroUIImageFormat.MICROUI_IMAGE_FORMAT_C2 or MicroUIImageFormat.MICROUI_IMAGE_FORMAT_C1. To avoid to
create a subclass of this class when the pixel format is custom, an extension of this widget can be set in front
panel description file (fp file) using the widget attribute extensionClass.
This widget manages the double buffering mode (see LLUIDisplayImpl.isDoubleBuffered(). However all involved
methods by this notion are implemented according the value returned by isDoubleBuffered(). The optional
widget attribute doubleBufferFeature can be configured to override default behavior (enabled by
default).
When double buffering mode is enabled, this widget uses a third-party thread to simulate the asynchronous flush action. This allows to have the same behavior than embedded side: the next drawing after a flush has to wait a while before be performed. The flush action takes two parameters in consideration: the time to perform the flush itself (== the time to transmit data to the embedded display) and the embedded display's refresh rate. These times are useless when the double buffering mode is disabled.
This widget manages a backlight with dimming (0 to 100%) (see LLUIDisplayImpl.hasBacklight(). However all
involved methods by this notion are implemented according the value returned by hasBacklight(). The optional
widget attribute backlightFeature can be configured to override default behavior (enabled by default).
The filter image is used to define the display rendering area. Outside this area, the display buffer data is not
drawn. This image must have the same size (@see Widget.setWidth(int) and Widget.setHeight(int)) than the widget
itself. If not, an error is thrown in finalizeConfiguration().
| Modifier and Type | Class and Description |
|---|---|
static interface |
Display.DisplayExtension
This interface is a subset of
LLUIDisplayImpl interface (provided by MicroUI graphical engine and
required to use a MicroUI Display in a MicroEJ application). |
| Constructor and Description |
|---|
Display()
Creates the widget display
|
| Modifier and Type | Method and Description |
|---|---|
int |
convertARGBColorToDisplayColor(int argbColor) |
int |
convertDisplayColorToARGBColor(int displayColor) |
void |
dispose() |
protected void |
drawBacklight(ej.fp.Image imageSkin)
Transforms the skin data applying an algorithm to simulate the display backlight.
|
protected void |
drawContrast(ej.fp.Image imageSkin)
Transforms the skin data applying an algorithm to simulate the display contrast.
|
void |
finalizeConfiguration() |
void |
flush() |
int |
getBacklight()
Returns the backlight of the display.
|
ej.fp.Image |
getCurrentBackBuffer() |
ej.fp.Image |
getCurrentDrawingBuffer() |
ej.fp.Image |
getCurrentSkin()
Gets the current displayed skin.
|
ej.fp.Image |
getDisplayedImage() |
int |
getDisplayHeight()
Gets the display height.
|
int |
getDisplayWidth()
Gets the display width.
|
int |
getInitialColor()
Gets the initial color of the display.
|
int |
getNumberOfColors() |
boolean |
hasBacklight() |
ej.fp.Image |
initialize()
Called by MicroUI graphical engine when MicroUI.start() is called by the MicroEJ application.
|
boolean |
isColor() |
boolean |
isDoubleBuffered() |
void |
mouseDragged(int x,
int y) |
void |
mouseExited(int x,
int y) |
void |
mouseMoved(int x,
int y) |
protected ej.fp.Image |
newDisplayImage()
Creates a new image with the same size than display (not widget size).
|
void |
newDrawingRegion(int x1,
int y1,
int x2,
int y2,
boolean drawingNow) |
protected ej.fp.Image |
newWidgetImage()
Creates a new image with the same size than widget (not display size).
|
boolean |
prepareBlendingOfIndexedColors(java.util.concurrent.atomic.AtomicInteger foreground,
java.util.concurrent.atomic.AtomicInteger background) |
void |
repaint() |
void |
setAlpha(int alpha)
Sets the opacity level (alpha) of the display in order to obtain a translucent display.
|
void |
setBacklight(int backlight)
Sets the backlight of the display.
|
void |
setBacklightFeature(boolean enable)
Enables or disables the backlight feature.
|
void |
setBufferPolicyClass(java.lang.String bufferPolicyClassName)
Sets the buffer policy.
|
void |
setDisplayHeight(int height)
Sets the height of the display in pixels (see class comment).
|
void |
setDisplayWidth(int width)
Sets the width of the display in pixels (see class comment).
|
void |
setExtensionClass(java.lang.String extensionClassName)
Defines the optional class name of the display extension.
|
void |
setFlushTime(int ms)
Simulates the embedded display's flush time when double buffering mode is enabled.
|
void |
setInitialColor(int initialColor)
Sets the initial color of the display (color used on startup, just before first drawing).
|
void |
setRefreshRate(int hertz)
Simulates the embedded display's refresh rate when double buffering mode is enabled.
|
void |
setRefreshStrategyClass(java.lang.String refreshStrategyClassName)
Sets the refresh strategy.
|
void |
showYourself(boolean appearSwitchedOn) |
void |
start()
Called by the parser after filling all the fields defined in the xml.
|
void |
waitFlush() |
getAbsoluteX, getAbsoluteY, getFilter, getHeight, getLabel, getParent, getSkin, getWidth, getX, getY, isOver, repaint, setCurrentSkin, setFilter, setHeight, setLabel, setOverlay, setSkin, setWidth, setX, setYclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecode, getContrast, setContrastpublic void setDisplayWidth(int width)
This method should only be called by front panel parser.
width - the width to set.public void setDisplayHeight(int height)
This method should only be called by front panel parser.
height - the height to set.public int getDisplayWidth()
public int getDisplayHeight()
public void setInitialColor(int initialColor)
This is a RGB color (24 bits: 8-8-8). Alpha level is ignored.
This method should only be called by front panel parser.
initialColor - the initial color to set.public void setAlpha(int alpha)
This method should only be called by front panel parser.
alpha - the opacity level to set, 0x00 is fully transparent and 0xff fully opaque.java.lang.IllegalArgumentException - if the given argument is not between 0x0 and 0xff.public void setFlushTime(int ms)
The widget will wait this time before unlocking the caller to waitFlush().
The time is expressed in milliseconds. A negative or zero value (default value) indicates the flush time is instantaneous. Typical values are between 5 and 10ms.
ms - the flush time in milliseconds.public void setRefreshRate(int hertz)
When set, the widget is only allowed to initiate a flush action at every refresh tick. It is synchronized on the hardware display's periodic signal (tearing).
The signal is expressed in hertz. A negative or zero value (default value) indicates the display does not manage the display's refresh rate and the flush action can start at once. Typical value is 60Hz.
hertz - the refresh rate in hertz.public void setBacklightFeature(boolean enable)
By default the backlight feature is enabled.
See LLUIDisplayImpl.hasBacklight() to have more information.
enable - true to enable backlight feature (default value).public void setExtensionClass(java.lang.String extensionClassName)
Display.
When set, a check is performed in finalizeConfiguration() to verify whether this class is valid.
This method should only be called by front panel parser.
extensionClassName - the user display extension class name.public void setBufferPolicyClass(java.lang.String bufferPolicyClassName)
bufferPolicyClassName - the buffer policy class name to set.public void setRefreshStrategyClass(java.lang.String refreshStrategyClassName)
refreshStrategyClassName - the refresh strategy class name to set.public void finalizeConfiguration()
finalizeConfiguration in class ej.fp.Widgetpublic void showYourself(boolean appearSwitchedOn)
showYourself in class ej.fp.Widgetpublic void start()
start in class ej.fp.Widgetpublic void dispose()
dispose in class ej.fp.Compositepublic ej.fp.Image getDisplayedImage()
getDisplayedImage in interface ej.microui.display.LLUIDisplayImplpublic ej.fp.Image getCurrentSkin()
getCurrentSkin in class ej.fp.Widgetpublic int getInitialColor()
public ej.fp.Image initialize()
initialize in interface ej.microui.display.LLUIDisplayImplpublic boolean hasBacklight()
hasBacklight in interface ej.microui.display.LLUIDisplayImplpublic int getBacklight()
backlight value range is
LLUIDisplayImpl.BACKLIGHT_MIN-LLUIDisplayImpl.BACKLIGHT_MAX. If the display do not manage backlight (
hasBacklight() == false), returns LLUIDisplayImpl.BACKLIGHT_MIN.getBacklight in interface ej.microui.display.LLUIDisplayImplpublic void setBacklight(int backlight)
setBacklight in interface ej.microui.display.LLUIDisplayImplbacklight - the new value of the backlight.public boolean isColor()
isColor in interface ej.microui.display.LLUIDisplayImplpublic int getNumberOfColors()
getNumberOfColors in interface ej.microui.display.LLUIDisplayImplpublic int convertARGBColorToDisplayColor(int argbColor)
convertARGBColorToDisplayColor in interface ej.microui.display.LLUIDisplayImplpublic int convertDisplayColorToARGBColor(int displayColor)
convertDisplayColorToARGBColor in interface ej.microui.display.LLUIDisplayImplpublic boolean prepareBlendingOfIndexedColors(java.util.concurrent.atomic.AtomicInteger foreground,
java.util.concurrent.atomic.AtomicInteger background)
prepareBlendingOfIndexedColors in interface ej.microui.display.LLUIDisplayImplpublic ej.fp.Image getCurrentBackBuffer()
getCurrentBackBuffer in interface ej.microui.display.LLUIDisplayImplpublic ej.fp.Image getCurrentDrawingBuffer()
getCurrentDrawingBuffer in interface ej.microui.display.LLUIDisplayImplpublic boolean isDoubleBuffered()
isDoubleBuffered in interface ej.microui.display.LLUIDisplayImplpublic void flush()
flush in interface ej.microui.display.LLUIDisplayImplpublic void waitFlush()
waitFlush in interface ej.microui.display.LLUIDisplayImplpublic void newDrawingRegion(int x1,
int y1,
int x2,
int y2,
boolean drawingNow)
newDrawingRegion in interface ej.microui.display.LLUIDisplayImplpublic void repaint()
repaint in class ej.fp.Widgetprotected ej.fp.Image newDisplayImage()
protected ej.fp.Image newWidgetImage()
protected void drawContrast(ej.fp.Image imageSkin)
The default implementation performs nothing.
imageSkin - the image where applying the algorithm.protected void drawBacklight(ej.fp.Image imageSkin)
imageSkin - the image where applying the algorithm.public void mouseDragged(int x,
int y)
mouseDragged in interface ej.fp.MouseListenerpublic void mouseMoved(int x,
int y)
mouseMoved in interface ej.fp.MouseListenerpublic void mouseExited(int x,
int y)
mouseExited in interface ej.fp.MouseListener