|
virtual int | clear (void) |
|
virtual int | clearConsole (void) |
|
virtual int | consoleOut (string text) |
|
virtual int | drawBar (int x1, int y1, int x2, int y2) |
|
virtual int | drawBitmap (int x, int y, int w, string bitmap, int bgcol) |
|
int | drawBitmap (int x, int y, int w, const std::vector< unsigned char > &data, int bgcol) |
|
virtual int | drawCircle (int x, int y, int r) |
|
virtual int | drawDisc (int x, int y, int r) |
|
virtual int | drawImage (int x, int y, string imagename) |
|
virtual int | drawPixel (int x, int y) |
|
virtual int | drawRect (int x1, int y1, int x2, int y2) |
|
virtual int | drawText (int x, int y, Y_ALIGN anchor, string text) |
|
int | flush_now () |
|
virtual YDisplay * | get_display (void) |
|
virtual int | get_displayHeight (void) |
|
virtual int | get_displayWidth (void) |
|
virtual int | get_layerHeight (void) |
|
virtual int | get_layerWidth (void) |
|
virtual int | hide (void) |
|
virtual int | lineTo (int x, int y) |
|
virtual int | moveTo (int x, int y) |
|
virtual int | reset (void) |
|
virtual int | resetHiddenFlag (void) |
|
virtual int | selectColorPen (int color) |
|
virtual int | selectEraser (void) |
|
virtual int | selectFont (string fontname) |
|
virtual int | selectGrayPen (int graylevel) |
|
virtual int | setAntialiasingMode (bool mode) |
|
virtual int | setConsoleBackground (int bgcol) |
|
virtual int | setConsoleMargins (int x1, int y1, int x2, int y2) |
|
virtual int | setConsoleWordWrap (bool wordwrap) |
|
virtual int | setLayerPosition (int x, int y, int scrollTime) |
|
virtual int | unhide (void) |
|
| YDisplayLayer (YDisplay *parent, int id) |
|
virtual | ~YDisplayLayer () |
|
YDisplayLayer Class: DisplayLayer object interface
A DisplayLayer is an image layer containing objects to display (bitmaps, text, etc.). The content is displayed only when the layer is active on the screen (and not masked by other overlapping layers).
Definition at line 127 of file yocto_display.h.
int YDisplayLayer::consoleOut |
( |
string |
text | ) |
|
|
virtual |
Outputs a message in the console area, and advances the console pointer accordingly. The console pointer position is automatically moved to the beginning of the next line when a newline character is met, or when the right margin is hit. When the new text to display extends below the lower margin, the console area is automatically scrolled up.
- Parameters
-
text | : the message to display |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 426 of file yocto_display.cpp.
int YDisplayLayer::drawBitmap |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
w, |
|
|
string |
bitmap, |
|
|
int |
bgcol |
|
) |
| |
|
virtual |
Draws a bitmap at the specified position. The bitmap is provided as a binary object, where each pixel maps to a bit, from left to right and from top to bottom. The most significant bit of each byte maps to the leftmost pixel, and the least significant bit maps to the rightmost pixel. Bits set to 1 are drawn using the layer selected pen color. Bits set to 0 are drawn using the specified background gray level, unless -1 is specified, in which case they are not drawn at all (as if transparent).
- Parameters
-
x | : the distance from left of layer to the left of the bitmap, in pixels |
y | : the distance from top of layer to the top of the bitmap, in pixels |
w | : the width of the bitmap, in pixels |
bitmap | : a binary object |
bgcol | : the background gray level to use for zero bits (0 = black, 255 = white), or -1 to leave the pixels unchanged |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 374 of file yocto_display.cpp.
int YDisplayLayer::drawImage |
( |
int |
x, |
|
|
int |
y, |
|
|
string |
imagename |
|
) |
| |
|
virtual |
Draws a GIF image at the specified position. The GIF image must have been previously uploaded to the device built-in memory. If you experience problems using an image file, check the device logs for any error message such as missing image file or bad image file format.
- Parameters
-
x | : the distance from left of layer to the left of the image, in pixels |
y | : the distance from top of layer to the top of the image, in pixels |
imagename | : the GIF file name |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 349 of file yocto_display.cpp.
int YDisplayLayer::drawText |
( |
int |
x, |
|
|
int |
y, |
|
|
Y_ALIGN |
anchor, |
|
|
string |
text |
|
) |
| |
|
virtual |
Draws a text string at the specified position. The point of the text that is aligned to the specified pixel position is called the anchor point, and can be chosen among several options. Text is rendered from left to right, without implicit wrapping.
- Parameters
-
x | : the distance from left of layer to the text anchor point, in pixels |
y | : the distance from top of layer to the text anchor point, in pixels |
anchor | : the text anchor point, chosen among the Y_ALIGN enumeration: Y_ALIGN_TOP_LEFT, Y_ALIGN_CENTER_LEFT, Y_ALIGN_BASELINE_LEFT, Y_ALIGN_BOTTOM_LEFT, Y_ALIGN_TOP_CENTER, Y_ALIGN_CENTER, Y_ALIGN_BASELINE_CENTER, Y_ALIGN_BOTTOM_CENTER, Y_ALIGN_TOP_DECIMAL, Y_ALIGN_CENTER_DECIMAL, Y_ALIGN_BASELINE_DECIMAL, Y_ALIGN_BOTTOM_DECIMAL, Y_ALIGN_TOP_RIGHT, Y_ALIGN_CENTER_RIGHT, Y_ALIGN_BASELINE_RIGHT, Y_ALIGN_BOTTOM_RIGHT. |
text | : the text string to draw |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 330 of file yocto_display.cpp.
int YDisplayLayer::hide |
( |
void |
| ) |
|
|
virtual |
Hides the layer. The state of the layer is perserved but the layer is not displayed on the screen until the next call to unhide(). Hiding the layer can positively affect the drawing speed, since it postpones the rendering until all operations are completed (double-buffering).
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 521 of file yocto_display.cpp.
int YDisplayLayer::reset |
( |
void |
| ) |
|
|
virtual |
Reverts the layer to its initial state (fully transparent, default settings). Reinitializes the drawing pointer to the upper left position, and selects the most visible pen color. If you only want to erase the layer content, use the method clear() instead.
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 120 of file yocto_display.cpp.
int YDisplayLayer::selectColorPen |
( |
int |
color | ) |
|
|
virtual |
Selects the pen color for all subsequent drawing functions, including text drawing. The pen color is provided as an RGB value. For grayscale or monochrome displays, the value is automatically converted to the proper range.
- Parameters
-
color | : the desired pen color, as a 24-bit RGB value |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 153 of file yocto_display.cpp.
int YDisplayLayer::selectEraser |
( |
void |
| ) |
|
|
virtual |
Selects an eraser instead of a pen for all subsequent drawing functions, except for bitmap copy functions. Any point drawn using the eraser becomes transparent (as when the layer is empty), showing the other layers beneath it.
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 187 of file yocto_display.cpp.
int YDisplayLayer::selectFont |
( |
string |
fontname | ) |
|
|
virtual |
Selects a font to use for the next text drawing functions, by providing the name of the font file. You can use a built-in font as well as a font file that you have previously uploaded to the device built-in memory. If you experience problems selecting a font file, check the device logs for any error message such as missing font file or bad font file format.
- Parameters
-
fontname | : the font file name |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 307 of file yocto_display.cpp.
int YDisplayLayer::selectGrayPen |
( |
int |
graylevel | ) |
|
|
virtual |
Selects the pen gray level for all subsequent drawing functions, including text drawing. The gray level is provided as a number between 0 (black) and 255 (white, or whichever the lighest color is). For monochrome displays (without gray levels), any value lower than 128 is rendered as black, and any value equal or above to 128 is non-black.
- Parameters
-
graylevel | : the desired gray level, from 0 to 255 |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 172 of file yocto_display.cpp.
int YDisplayLayer::setAntialiasingMode |
( |
bool |
mode | ) |
|
|
virtual |
Enables or disables anti-aliasing for drawing oblique lines and circles. Anti-aliasing provides a smoother aspect when looked from far enough, but it can add fuzzyness when the display is looked from very close. At the end of the day, it is your personal choice. Anti-aliasing is enabled by default on grayscale and color displays, but you can disable it if you prefer. This setting has no effect on monochrome displays.
- Parameters
-
mode | : true to enable antialiasing, false to disable it. |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 208 of file yocto_display.cpp.
int YDisplayLayer::setLayerPosition |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
scrollTime |
|
) |
| |
|
virtual |
Sets the position of the layer relative to the display upper left corner. When smooth scrolling is used, the display offset of the layer is automatically updated during the next milliseconds to animate the move of the layer.
- Parameters
-
x | : the distance from left of display to the upper left corner of the layer |
y | : the distance from top of display to the upper left corner of the layer |
scrollTime | : number of milliseconds to use for smooth scrolling, or 0 if the scrolling should be immediate. |
- Returns
- YAPI_SUCCESS if the call succeeds.
On failure, throws an exception or returns a negative error code.
Definition at line 506 of file yocto_display.cpp.