public class YDisplayLayer extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
YDisplayLayer.ALIGN |
| Modifier and Type | Field and Description |
|---|---|
protected int |
_polyPrevX |
protected int |
_polyPrevY |
static int |
BG_INK |
static int |
FG_INK |
static int |
NO_INK |
| Constructor and Description |
|---|
YDisplayLayer(YDisplay parent,
int id) |
| Modifier and Type | Method and Description |
|---|---|
int |
clear()
Erases the whole content of the layer (makes it fully transparent).
|
int |
clearConsole()
Blanks the console area within console margins, and resets the console pointer
to the upper left corner of the console.
|
int |
consoleOut(String text)
Outputs a message in the console area, and advances the console pointer accordingly.
|
int |
drawBar(int x1,
int y1,
int x2,
int y2)
Draws a filled rectangular bar at a specified position.
|
int |
drawBitmap(int x,
int y,
int w,
byte[] bitmap,
int bgcol)
Draws a bitmap at the specified position.
|
int |
drawCircle(int x,
int y,
int r)
Draws an empty circle at a specified position.
|
int |
drawDisc(int x,
int y,
int r)
Draws a filled disc at a given position.
|
int |
drawGIF(int x,
int y,
byte[] gifimage)
Draws a GIF image provided as a binary buffer at the specified position.
|
int |
drawImage(int x,
int y,
String imagename)
Draws an image previously uploaded to the device filesystem, at the specified position.
|
int |
drawPixel(int x,
int y)
Draws a single pixel at the specified position.
|
int |
drawRect(int x1,
int y1,
int x2,
int y2)
Draws an empty rectangle at a specified position.
|
int |
drawText(int x,
int y,
YDisplayLayer.ALIGN anchor,
String text)
Draws a text string at the specified position.
|
int |
flush_now() |
YDisplay |
get_display()
Gets parent YDisplay.
|
int |
get_displayHeight()
Returns the display height, in pixels.
|
int |
get_displayWidth()
Returns the display width, in pixels.
|
int |
get_layerHeight()
Returns the height of the layers to draw on, in pixels.
|
int |
get_layerWidth()
Returns the width of the layers to draw on, in pixels.
|
int |
hide()
Hides the layer.
|
int |
lineTo(int x,
int y)
Draws a line from current drawing pointer position to the specified position.
|
int |
moveTo(int x,
int y)
Moves the drawing pointer of this layer to the specified position.
|
int |
polygonAdd(int x,
int y)
Adds a point to the currently open polygon, previously opened using
polygonStart.
|
int |
polygonEnd()
Close the currently open polygon, fill its content the fill color currently
selected for the layer, and draw its outline using the selected line color.
|
int |
polygonStart(int x,
int y)
Starts drawing a polygon with the first corner at the specified position.
|
int |
reset()
Reverts the layer to its initial state (fully transparent, default settings).
|
int |
resetHiddenFlag() |
int |
selectColorPen(int color)
Selects the color to be used for all subsequent drawing functions,
for filling as well as for line and text drawing.
|
int |
selectEraser()
Selects an eraser instead of a pen for all subsequent drawing functions,
except for bitmap copy functions.
|
int |
selectFillColor(int color)
Selects the color to be used for filling rectangular bars,
discs and polygons.
|
int |
selectFont(String fontname)
Selects a font to use for the next text drawing functions, by providing the name of the
font file.
|
int |
selectGrayPen(int graylevel)
Selects the pen gray level for all subsequent drawing functions,
for filling as well as for line and text drawing.
|
int |
selectLineColor(int color)
Selects the color to be used for drawing the outline of rectangular
bars, discs and polygons, as well as for drawing lines and text.
|
int |
selectLineWidth(int width)
Selects the line width for drawing the outline of rectangular
bars, discs and polygons, as well as for drawing lines.
|
int |
setAntialiasingMode(boolean mode) |
int |
setConsoleBackground(int bgcol)
Sets up the background color used by the clearConsole function and by
the console scrolling feature.
|
int |
setConsoleMargins(int x1,
int y1,
int x2,
int y2)
Sets up display margins for the consoleOut function.
|
int |
setConsoleWordWrap(boolean wordwrap)
Sets up the wrapping behavior used by the consoleOut function.
|
int |
setLayerPosition(int x,
int y,
int scrollTime)
Sets the position of the layer relative to the display upper left corner.
|
int |
unhide()
Shows the layer.
|
public static final int NO_INK
public static final int BG_INK
public static final int FG_INK
protected int _polyPrevX
protected int _polyPrevY
public YDisplayLayer(YDisplay parent, int id)
public int flush_now()
throws YAPI_Exception
YAPI_Exceptionpublic int reset()
throws YAPI_Exception
YAPI_Exception - on errorpublic int clear()
throws YAPI_Exception
YAPI_Exception - on errorpublic int selectColorPen(int color)
throws YAPI_Exception
color - : the desired pen color, as a 24-bit RGB valueYAPI_Exception - on errorpublic int selectGrayPen(int graylevel)
throws YAPI_Exception
graylevel - : the desired gray level, from 0 to 255YAPI_Exception - on errorpublic int selectEraser()
throws YAPI_Exception
YAPI_Exception - on errorpublic int selectFillColor(int color)
throws YAPI_Exception
color - : the desired drawing color, as a 24-bit RGB value,
or one of the constants NO_INK, FG_INK
or BG_INKYAPI_Exception - on errorpublic int selectLineColor(int color)
throws YAPI_Exception
color - : the desired drawing color, as a 24-bit RGB value,
or one of the constants NO_INK, FG_INK
or BG_INKYAPI_Exception - on errorpublic int selectLineWidth(int width)
throws YAPI_Exception
width - : the desired line width, in pixelsYAPI_Exception - on errorpublic int setAntialiasingMode(boolean mode)
throws YAPI_Exception
YAPI_Exceptionpublic int drawPixel(int x,
int y)
throws YAPI_Exception
x - : the distance from left of layer, in pixelsy - : the distance from top of layer, in pixelsYAPI_Exception - on errorpublic int drawRect(int x1,
int y1,
int x2,
int y2)
throws YAPI_Exception
x1 - : the distance from left of layer to the left border of the rectangle, in pixelsy1 - : the distance from top of layer to the top border of the rectangle, in pixelsx2 - : the distance from left of layer to the right border of the rectangle, in pixelsy2 - : the distance from top of layer to the bottom border of the rectangle, in pixelsYAPI_Exception - on errorpublic int drawBar(int x1,
int y1,
int x2,
int y2)
throws YAPI_Exception
x1 - : the distance from left of layer to the left border of the rectangle, in pixelsy1 - : the distance from top of layer to the top border of the rectangle, in pixelsx2 - : the distance from left of layer to the right border of the rectangle, in pixelsy2 - : the distance from top of layer to the bottom border of the rectangle, in pixelsYAPI_Exception - on errorpublic int drawCircle(int x,
int y,
int r)
throws YAPI_Exception
x - : the distance from left of layer to the center of the circle, in pixelsy - : the distance from top of layer to the center of the circle, in pixelsr - : the radius of the circle, in pixelsYAPI_Exception - on errorpublic int drawDisc(int x,
int y,
int r)
throws YAPI_Exception
x - : the distance from left of layer to the center of the disc, in pixelsy - : the distance from top of layer to the center of the disc, in pixelsr - : the radius of the disc, in pixelsYAPI_Exception - on errorpublic int selectFont(String fontname) throws YAPI_Exception
fontname - : the font file name, embedded fonts are 8x8.yfm, Small.yfm, Medium.yfm, Large.yfm
(not available on Yocto-MiniDisplay).YAPI_Exception - on errorpublic int drawText(int x,
int y,
YDisplayLayer.ALIGN anchor,
String text)
throws YAPI_Exception
x - : the distance from left of layer to the text anchor point, in pixelsy - : the distance from top of layer to the text anchor point, in pixelsanchor - : the text anchor point, chosen among the YDisplayLayer.ALIGN enumeration:
YDisplayLayer.ALIGN.TOP_LEFT, YDisplayLayer.ALIGN.CENTER_LEFT,
YDisplayLayer.ALIGN.BASELINE_LEFT, YDisplayLayer.ALIGN.BOTTOM_LEFT,
YDisplayLayer.ALIGN.TOP_CENTER, YDisplayLayer.ALIGN.CENTER,
YDisplayLayer.ALIGN.BASELINE_CENTER, YDisplayLayer.ALIGN.BOTTOM_CENTER,
YDisplayLayer.ALIGN.TOP_DECIMAL, YDisplayLayer.ALIGN.CENTER_DECIMAL,
YDisplayLayer.ALIGN.BASELINE_DECIMAL, YDisplayLayer.ALIGN.BOTTOM_DECIMAL,
YDisplayLayer.ALIGN.TOP_RIGHT, YDisplayLayer.ALIGN.CENTER_RIGHT,
YDisplayLayer.ALIGN.BASELINE_RIGHT, YDisplayLayer.ALIGN.BOTTOM_RIGHT.text - : the text string to drawYAPI_Exception - on errorpublic int drawImage(int x,
int y,
String imagename)
throws YAPI_Exception
x - : the distance from left of layer to the left of the image, in pixelsy - : the distance from top of layer to the top of the image, in pixelsimagename - : the GIF file nameYAPI_Exception - on errorpublic int drawBitmap(int x,
int y,
int w,
byte[] bitmap,
int bgcol)
throws YAPI_Exception
x - : the distance from left of layer to the left of the bitmap, in pixelsy - : the distance from top of layer to the top of the bitmap, in pixelsw - : the width of the bitmap, in pixelsbitmap - : a binary objectbgcol - : the background gray level to use for zero bits (0 = black,
255 = white), or -1 to leave the pixels unchangedYAPI_Exception - on errorpublic int drawGIF(int x,
int y,
byte[] gifimage)
throws YAPI_Exception
x - : the distance from left of layer to the left of the image, in pixelsy - : the distance from top of layer to the top of the image, in pixelsgifimage - : a binary object with the content of a GIF fileYAPI_Exception - on errorpublic int moveTo(int x,
int y)
throws YAPI_Exception
x - : the distance from left of layer, in pixelsy - : the distance from top of layer, in pixelsYAPI_Exception - on errorpublic int lineTo(int x,
int y)
throws YAPI_Exception
x - : the distance from left of layer to the end point of the line, in pixelsy - : the distance from top of layer to the end point of the line, in pixelsYAPI_Exception - on errorpublic int polygonStart(int x,
int y)
throws YAPI_Exception
x - : the distance from left of layer, in pixelsy - : the distance from top of layer, in pixelsYAPI_Exception - on errorpublic int polygonAdd(int x,
int y)
throws YAPI_Exception
x - : the distance from left of layer to the new point, in pixelsy - : the distance from top of layer to the new point, in pixelsYAPI_Exception - on errorpublic int polygonEnd()
throws YAPI_Exception
YAPI_Exception - on errorpublic int consoleOut(String text) throws YAPI_Exception
text - : the message to displayYAPI_Exception - on errorpublic int setConsoleMargins(int x1,
int y1,
int x2,
int y2)
throws YAPI_Exception
x1 - : the distance from left of layer to the left margin, in pixelsy1 - : the distance from top of layer to the top margin, in pixelsx2 - : the distance from left of layer to the right margin, in pixelsy2 - : the distance from top of layer to the bottom margin, in pixelsYAPI_Exception - on errorpublic int setConsoleBackground(int bgcol)
throws YAPI_Exception
bgcol - : the background gray level to use when scrolling (0 = black,
255 = white), or -1 for transparentYAPI_Exception - on errorpublic int setConsoleWordWrap(boolean wordwrap)
throws YAPI_Exception
wordwrap - : true to wrap only between words,
false to wrap on the last column anyway.YAPI_Exception - on errorpublic int clearConsole()
throws YAPI_Exception
YAPI_Exception - on errorpublic int setLayerPosition(int x,
int y,
int scrollTime)
throws YAPI_Exception
x - : the distance from left of display to the upper left corner of the layery - : the distance from top of display to the upper left corner of the layerscrollTime - : number of milliseconds to use for smooth scrolling, or
0 if the scrolling should be immediate.YAPI_Exception - on errorpublic int hide()
throws YAPI_Exception
YAPI_Exception - on errorpublic int unhide()
throws YAPI_Exception
YAPI_Exception - on errorpublic YDisplay get_display()
public int get_displayWidth()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_displayHeight()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_layerWidth()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_layerHeight()
throws YAPI_Exception
YAPI_Exception - on errorpublic int resetHiddenFlag()
Copyright © 2026. All rights reserved.