Class for graphical LCD layer; created with DumbDisplay::createGraphicalLayer() More...
#include <dumbdisplay.h>
Public Member Functions | |
GraphicalDDLayer (int8_t layerId) | |
for internal use only | |
void | setRotation (int8_t rotationType) |
rotate the screen | |
void | setCursor (int x, int y) |
set cursor to position | |
void | moveCursorBy (int byX, int byY) |
move cursor by some amount | |
void | setTextColor (const String &color, const String &bgColor="") |
void | setTextSize (int size) |
set text size | |
void | setTextFont (const String &fontName) |
void | setTextFont () |
reset text font and size | |
void | setTextFont (const String &fontName, int textSize) |
void | setTextWrap (bool wrapOn) |
set whether "print" will auto wrap or not | |
void | fillScreen (const String &color) |
void | print (const String &text) |
print text | |
void | println (const String &text="") |
print text with line feed | |
void | drawChar (int x, int y, char c, const String &color="", const String &bgColor="", int size=0) |
void | drawStr (int x, int y, const String &string, const String &color="", const String &bgColor="", int size=0) |
void | drawTextLine (const String &text, int y, const String &align="L", const String &color="", const String &bgColor="", int size=0) |
void | drawPixel (int x, int y, const String &color="") |
void | drawLine (int x1, int y1, int x2, int y2, const String &color="") |
void | drawCircle (int x, int y, int r, const String &color="", bool filled=false) |
void | fillCircle (int x, int y, int r, const String &color="") |
void | drawTriangle (int x1, int y1, int x2, int y2, int x3, int y3, const String &color="", bool filled=false) |
void | fillTriangle (int x1, int y1, int x2, int y2, int x3, int y3, const String &color="") |
void | drawRect (int x, int y, int w, int h, const String &color="", bool filled=false) |
void | fillRect (int x, int y, int w, int h, const String &color="") |
void | drawRoundRect (int x, int y, int w, int h, int r, const String &color="", bool filled=false) |
void | fillRoundRect (int x, int y, int w, int h, int r, const String &color="") |
void | drawOval (int x, int y, int w, int h, const String &color="", bool filled=false) |
void | fillOval (int x, int y, int w, int h, const String &color="") |
void | drawArc (int x, int y, int w, int h, int startAngle, int sweepAngle, bool useCenter, const String &color="", bool filled=false) |
void | fillArc (int x, int y, int w, int h, int startAngle, int sweepAngle, bool useCenter, const String &color="") |
void | forward (int distance) |
move forward (relative to cursor) | |
void | leftTurn (int angle) |
turn left | |
void | rightTurn (int angle) |
turn right | |
void | setHeading (int angle) |
set heading angle (degree) | |
void | penSize (int size) |
set pen size | |
void | penColor (const String &color) |
void | fillColor (const String &color) |
void | noFillColor () |
set no fill color (for shape) | |
void | circle (int radius, bool centered=false) |
draw a circle; centered or not | |
void | oval (int width, int height, bool centered=false) |
draw an oval; centered or not | |
void | arc (int width, int height, int startAngle, int sweepAngle, bool centered=false) |
draw arc; centered or not | |
void | triangle (int side1, int angle, int side2) |
draw triangle (SAS) | |
void | isoscelesTriangle (int side, int angle) |
draw isosceles triangle; given size and angle | |
void | rectangle (int width, int height, bool centered=false) |
draw rectangle; centered or not | |
void | polygon (int side, int vertexCount) |
draw polygon given side and vertex count | |
void | centeredPolygon (int radius, int vertexCount, bool inside=false) |
void | write (const String &text, bool draw=false) |
void | loadImageFile (const String &imageFileName, int w=0, int h=0, const String &asImageFileName="") |
void | loadImageFileScaled (const String &imageFileName, int w, int h, const String &asImageFileName) |
void | loadImageFileCropped (const String &imageFileName, int x, int y, int w, int h, const String &asImageFileName, int scaleW=0, int scaleH=0) |
void | unloadImageFile (const String &imageFileName) |
unload image file from cache | |
void | unloadAllImageFiles () |
unload all image files from cache | |
void | drawImageFile (const String &imageFileName, int x=0, int y=0, int w=0, int h=0, const String &options="") |
void | drawImageFile (const String &imageFileName, const String &options) |
another version of drawImageFile() with options | |
void | drawImageFileScaled (const String &imageFileName, int w, int h, const String &options="") |
void | drawImageFileFit (const String &imageFileName, int x=0, int y=0, int w=0, int h=0, const String &options="") |
void | drawImageFileFit (const String &imageFileName, const String &options) |
another version of drawImageFileFit() with options | |
void | cacheImage (const String &imageName, const uint8_t *bytes, int byteCount, char compressionMethod=0) |
void | cacheImageWithTS (const String &imageName, const uint8_t *bytes, int byteCount, long imageTimestamp, char compressionMethod=0) |
void | cachePixelImage (const String &imageName, const uint8_t *bytes, int width, int height, const String &color="", char compressionMethod=0) |
void | cachePixelImage16 (const String &imageName, const uint16_t *data, int width, int height, const String &options="", char compressMethod=0) |
void | cachePixelImageGS (const String &imageName, const uint8_t *data, int width, int height, const String &options="", char compressMethod=0) |
void | saveCachedImageFile (const String &imageName, const String &asImageName="") |
void | saveCachedImageFileAsync (const String &imageName, const String &asImageName="") |
void | saveCachedImageFiles (const String &stitchAsImageName="") |
![]() | |
void | addLevel (const String &levelId, float width, float height, bool switchToIt=false) |
void | addLevel (const String &levelId, bool switchToIt=false) |
another version of addLevel() | |
void | addTopLevel (const String &levelId, float width=0, float height=0, bool switchToIt=false) |
like addLevel() but add to the top (i.e. will be drawn last) | |
void | addTopLevel (const String &levelId, bool switchToIt) |
another version of addTopLevel() | |
void | switchLevel (const String &levelId, bool addIfMissing=true) |
void | pushLevel () |
push the current level onto the level stack, to be pop with popLevel() | |
void | pushLevelAndSwitchTo (const String &switchTolevelId, bool addIfMissing=true) |
void | popLevel () |
pop a level from the level stack and make it the current level | |
void | levelOpacity (int opacity) |
void | levelTransparent (bool transparent) |
set whether level is transparent | |
void | setLevelAnchor (float x, float y, long reachInMillis=0) |
set the anchor of the level; note that level anchor is the top-left corner of the level "opening" | |
void | moveLevelAnchorBy (float byX, float byY, long reachInMillis=0) |
move the level anchor | |
void | registerLevelBackground (const String &backgroundId, const String &backgroundImageName, const String &drawBackgroundOptions="") |
void | setLevelBackground (const String &backgroundId, const String &backgroundImageName="", const String &drawBackgroundOptions="") |
void | setLevelNoBackground () |
set that the current level uses no background image | |
void | animateLevelBackground (int fps, bool reset=true, const String &options="") |
void | stopAnimateLevelBackground (bool reset=true) |
void | reorderLevel (const String &levelId, const String &how) |
void | exportLevelsAsImage (const String &imageFileName, bool cacheItNotSave=false) |
export (and save) the levels as an image (without the decorations of the layer like border) | |
void | deleteLevel (const String &levelId) |
delete the specified level | |
![]() | |
void | border (float size, const String &color, const String &shape="flat", float extraSize=0) |
void | noBorder () |
void | padding (float size) |
void | padding (float left, float top, float right, float bottom) |
void | noPadding () |
void | margin (float size) |
void | margin (float left, float top, float right, float bottom) |
void | noMargin () |
void | backgroundColor (const String &color, int opacity=100) |
void | noBackgroundColor () |
void | visible (bool visible) |
void | transparent (bool transparent) |
void | disabled (bool disabled=true) |
void | opacity (int opacity) |
void | alpha (int alpha) |
void | blend (const String &color, int alpha=255, const String &mode="darken") |
void | noblend () |
void | clear () |
clear the layer | |
void | flash () |
normally used for "feedback" – flash the default way (layer + border) | |
void | flashArea (int x, int y) |
normally used for "feedback" – flash the area (x, y) where the layer is clicked | |
void | explicitFeedback (int16_t x=0, int16_t y=0, const String &text="", DDFeedbackType type=CLICK, const String &option="") |
const String & | getLayerId () const |
void | setFeedbackHandler (DDFeedbackHandler handler, const String &autoFeedbackMethod="", const String &allowFeedbackTypes="") |
void | enableFeedback (const String &autoFeedbackMethod="", const String &allowFeedbackTypes="") |
void | disableFeedback () |
disable "feedback" | |
const DDFeedback * | getFeedback () |
void | debugOnly (int i) |
for debug use | |
DDFeedbackManager * | getFeedbackManager () const |
DDFeedbackHandler | getFeedbackHandler () const |
Additional Inherited Members | |
![]() | |
int8_t | objectType |
object type – DD_OBJECT_TYPE_LAYER or DD_OBJECT_TYPE_TUNNEL | |
String | customData |
custom data | |
![]() | |
MultiLevelDDLayer (int8_t layerId) | |
![]() | |
DDLayer (int8_t layerId) | |
void | _enableFeedback () |
![]() | |
String | layerId |
DDFeedbackManager * | pFeedbackManager |
DDFeedbackHandler | feedbackHandler |
Class for graphical LCD layer; created with DumbDisplay::createGraphicalLayer()
void GraphicalDDLayer::cacheImage | ( | const String & | imageName, |
const uint8_t * | bytes, | ||
int | byteCount, | ||
char | compressionMethod = 0 |
||
) |
cache image; not saved
imageName | cachedImageName |
void GraphicalDDLayer::cacheImageWithTS | ( | const String & | imageName, |
const uint8_t * | bytes, | ||
int | byteCount, | ||
long | imageTimestamp, | ||
char | compressionMethod = 0 |
||
) |
cache image with specified timestamp; not saved
imageName | cachedImageName |
void GraphicalDDLayer::cachePixelImage | ( | const String & | imageName, |
const uint8_t * | bytes, | ||
int | width, | ||
int | height, | ||
const String & | color = "" , |
||
char | compressionMethod = 0 |
||
) |
cache single-bit "pixel" image (i.e. B&W image); not saved
imageName | cachedImageName |
void GraphicalDDLayer::cachePixelImage16 | ( | const String & | imageName, |
const uint16_t * | data, | ||
int | width, | ||
int | height, | ||
const String & | options = "" , |
||
char | compressMethod = 0 |
||
) |
cache 16-bit "pixel" image (i.e. 565 RGB image); not saved
imageName | cachedImageName |
void GraphicalDDLayer::cachePixelImageGS | ( | const String & | imageName, |
const uint8_t * | data, | ||
int | width, | ||
int | height, | ||
const String & | options = "" , |
||
char | compressMethod = 0 |
||
) |
cache grayscale "pixel" image; not saved
imageName | cachedImageName |
void GraphicalDDLayer::centeredPolygon | ( | int | radius, |
int | vertexCount, | ||
bool | inside = false |
||
) |
draw polygon "enclosed" in an imaginary centered circle
radius | circle radius |
vertexCount | number of vertices |
inside | whether inside the imaginary circle or outside of it |
void GraphicalDDLayer::drawArc | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
int | startAngle, | ||
int | sweepAngle, | ||
bool | useCenter, | ||
const String & | color = "" , |
||
bool | filled = false |
||
) |
draw an arc
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::drawChar | ( | int | x, |
int | y, | ||
char | c, | ||
const String & | color = "" , |
||
const String & | bgColor = "" , |
||
int | size = 0 |
||
) |
draw char
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
backgroundColor | DD_RGB_COLOR(...) or common color name; empty background color means no background color |
size | 0 means default |
void GraphicalDDLayer::drawCircle | ( | int | x, |
int | y, | ||
int | r, | ||
const String & | color = "" , |
||
bool | filled = false |
||
) |
draw a circle
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::drawImageFile | ( | const String & | imageFileName, |
int | x = 0 , |
||
int | y = 0 , |
||
int | w = 0 , |
||
int | h = 0 , |
||
const String & | options = "" |
||
) |
draw image file in cache (if not already loaded to cache, load it)
x,y | position of the left-top corner |
w,h | image size to scale to; if both 0, will not scale, if any 0, will scale keeping aspect ratio |
void GraphicalDDLayer::drawImageFileFit | ( | const String & | imageFileName, |
int | x = 0 , |
||
int | y = 0 , |
||
int | w = 0 , |
||
int | h = 0 , |
||
const String & | options = "" |
||
) |
draw image file in cache (if not already loaded to cache, load it)
x,y,w,h | rect to draw the image; 0 means the default value |
options | (e.g. "LB"): left align "L"; right align "R"; top align "T"; bottom align "B"; default to fit centered |
|
inline |
draw image file in cache scaled, like calling drawImageFile(imageFileName, 0, 0, w, h, options) with w and h
void GraphicalDDLayer::drawLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
const String & | color = "" |
||
) |
draw a line
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::drawOval | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
const String & | color = "" , |
||
bool | filled = false |
||
) |
draw an ellipse (oval)
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::drawPixel | ( | int | x, |
int | y, | ||
const String & | color = "" |
||
) |
draw a pixel
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::drawRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
const String & | color = "" , |
||
bool | filled = false |
||
) |
draw a rectangle
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::drawRoundRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
int | r, | ||
const String & | color = "" , |
||
bool | filled = false |
||
) |
draw a rounded rectangle
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::drawStr | ( | int | x, |
int | y, | ||
const String & | string, | ||
const String & | color = "" , |
||
const String & | bgColor = "" , |
||
int | size = 0 |
||
) |
draw string
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
backgroundColor | DD_RGB_COLOR(...) or common color name; empty background color means no background color |
size | 0 means default |
void GraphicalDDLayer::drawTextLine | ( | const String & | text, |
int | y, | ||
const String & | align = "L" , |
||
const String & | color = "" , |
||
const String & | bgColor = "" , |
||
int | size = 0 |
||
) |
similar to drawStr(), but draw string as a text line at (0, y) with alignment option
align | 'L', 'C', or 'R' |
void GraphicalDDLayer::drawTriangle | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | x3, | ||
int | y3, | ||
const String & | color = "" , |
||
bool | filled = false |
||
) |
draw a triangle
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
|
inline |
draw filled arc
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
|
inline |
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::fillColor | ( | const String & | color | ) |
set fill color (for shape)
color | DD_COLOR_XXX; DD_RGB_COLOR(...); can also be common "color name" |
|
inline |
draw filled ellipse (oval)
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
|
inline |
draw filled rectangle
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
|
inline |
draw filled rounded rectangle
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::fillScreen | ( | const String & | color | ) |
fill screen with color
color | DD_COLOR_XXX; DD_RGB_COLOR(...); can also be common "color name" |
|
inline |
draw filled triangle
color | DD_RGB_COLOR(...) or common color name; empty color means text color |
void GraphicalDDLayer::loadImageFile | ( | const String & | imageFileName, |
int | w = 0 , |
||
int | h = 0 , |
||
const String & | asImageFileName = "" |
||
) |
load image file to cache
w,h | image size to scale to; if both 0, will not scale, if any 0, will scale keeping aspect ratio |
asImageFileName | better provide a different name for the scaled cached |
|
inline |
load image file to cache cropped
x,y,w,h | rect to crop the image |
asImageFileName | since image cropped, should provide a different name for the scaled cached |
see loadImageFile()
void GraphicalDDLayer::penColor | ( | const String & | color | ) |
set pen color (i.e. text color)
color | DD_COLOR_XXX; DD_RGB_COLOR(...); can also be common "color name" |
void GraphicalDDLayer::saveCachedImageFile | ( | const String & | imageName, |
const String & | asImageName = "" |
||
) |
saved cached image
imageName | cachedImageName |
void GraphicalDDLayer::saveCachedImageFileAsync | ( | const String & | imageName, |
const String & | asImageName = "" |
||
) |
saved cached image (async / non-blocking)
imageName | cachedImageName |
void GraphicalDDLayer::saveCachedImageFiles | ( | const String & | stitchAsImageName = "" | ) |
saved cached image
stitchAsImageName | if not empty, will stitch all cached images to one image file of the given name |
void GraphicalDDLayer::setTextColor | ( | const String & | color, |
const String & | bgColor = "" |
||
) |
set text color and text background color
color | DD_COLOR_XXX; DD_RGB_COLOR(...); can also be common "color name" |
bgColor | empty background color means no background color |
void GraphicalDDLayer::setTextFont | ( | const String & | fontName | ) |
set font
fontName | empty means default |
textSize | 0 means default |
|
inline |
void GraphicalDDLayer::write | ( | const String & | text, |
bool | draw = false |
||
) |
write text; will not auto wrap
draw | means draw the text (in the heading direction) |