ArduinoDumbDisplay v0.9.9-r50
DumbDisplay Arduino Library -- https://github.com/trevorwslee/Arduino-DumbDisplay
 
Loading...
Searching...
No Matches
DDLayer Class Reference

Base class for the different layers support by DumbDisplay; created with various layer creation methods of DumbDisplay, DumbDisplay::createLedGridLayer() More...

#include <dumbdisplay.h>

Inheritance diagram for DDLayer:
DDObject DumbDisplayWindowDDLayer JoystickDDLayer LcdDDLayer LedGridDDLayer MbDDLayer MultiLevelDDLayer PlotterDDLayer RtspClientDDLayer SelectionBaseDDLayer SevenSegmentRowDDLayer TerminalDDLayer TomTomMapDDLayer WebViewDDLayer

Public Member Functions

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 backgroundImage (const String &backgroundImageName, const String &drawBackgroundOptions, int refImageWidth=0)
 
void noBackgroundImage ()
 set no layer background image
 
void exportAsBackgroundImage (bool replace=true, bool noDrawBackground=true, int exportAsWidth=0)
 
void animateBackgroundImage (float fps, bool reset=true, const String &options="")
 
void stopAnimateBackgroundImage (bool reset=true)
 
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=DDFeedbackType::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 DDFeedbackgetFeedback ()
 
void debugOnly (int i)
 for debug use
 
DDFeedbackManager * getFeedbackManager () const
 
DDFeedbackHandler getFeedbackHandler () const
 

Protected Member Functions

 DDLayer (int8_t layerId)
 
void _enableFeedback ()
 

Protected Attributes

String layerId
 
DDFeedbackManager * pFeedbackManager
 
DDFeedbackHandler feedbackHandler
 

Additional Inherited Members

- Public Attributes inherited from DDObject
int8_t objectType
 object type – DD_OBJECT_TYPE_LAYER or DD_OBJECT_TYPE_TUNNEL
 
String customData
 custom data
 

Detailed Description

Base class for the different layers support by DumbDisplay; created with various layer creation methods of DumbDisplay, DumbDisplay::createLedGridLayer()

Member Function Documentation

◆ alpha()

void DDLayer::alpha ( int  alpha)

set layer's alpha channel; it combines with opacity

Parameters
alpha0 - 255
Note
layer property

◆ animateBackgroundImage()

void DDLayer::animateBackgroundImage ( float  fps,
bool  reset = true,
const String &  options = "" 
)

experimental: start animate background image series

Parameters
fpsframes per second which is used to calculate the interval between the series of images
resetreset to the first image in the series (before start animation)
optionscan be "r" to reverse the order of the series of images

◆ backgroundColor()

void DDLayer::backgroundColor ( const String &  color,
int  opacity = 100 
)

set layer background color

Parameters
colorDD_COLOR_XXX; DD_RGB_COLOR(...); can also be common "color name"
opacitybackground opacity (0 - 100); it combines with layer opacity and alpha
Note
layer property

◆ backgroundImage()

void DDLayer::backgroundImage ( const String &  backgroundImageName,
const String &  drawBackgroundOptions,
int  refImageWidth = 0 
)

set layer background image (on top of background color; follow opacity of background color)

Parameters
backgroundImageNamename of the image can be a series of images like dumbdisplay_##0-7##.png (for dumbdisplay_0.png to dumbdisplay_7.png) which can be used for animation with animateBackgroundImage()
drawBackgroundOptionsoptions for drawing the background; same means as the option param of GraphicalDDLayer::drawImageFiler()
refImageWidththe reference width of the image to scale the image (while keeping the aspect ration); 0 means no scaling

◆ blend()

void DDLayer::blend ( const String &  color,
int  alpha = 255,
const String &  mode = "darken" 
)

blending with "film" of color over the layer

Parameters
color
alpha
modexfermode "darken" / "lighten" / "screen" / "overlay" / "" (no xfermode)
Note
layer property

◆ border()

void DDLayer::border ( float  size,
const String &  color,
const String &  shape = "flat",
float  extraSize = 0 
)

set border for each size

Parameters
sizesize unit is pixel:
  • LcdLayer – each character is composed of pixels
  • 7SegmentRowLayer – each 7-segment is composed of fixed 220 x 320 pixels
  • LedGridLayer – a LED is considered as a pixel
colorDD_COLOR_XXX; DD_RGB_COLOR(...); can also be common "color name"
shapecan be "flat", "hair", "round", "raised" or "sunken"
extraSizesimply add to size; however if shape is "round", it affects the "roundness"
Note
layer property

◆ disabled()

void DDLayer::disabled ( bool  disabled = true)

set layer disabled or not; if disabled, layer will not have "feedback", and its appearance will be like disabled

Note
layer property

◆ enableFeedback()

void DDLayer::enableFeedback ( const String &  autoFeedbackMethod = "",
const String &  allowFeedbackTypes = "" 
)

rely on getFeedback() being called

Parameters
autoFeedbackMethod
  • "" – no auto feedback flash (the default)
  • "f" – flash the standard way (layer + border)
  • "fl" – flash the layer
  • "fa" – flash the area where the layer is clicked
  • "fas" – flash the area (as a spot) where the layer is clicked
  • "fs" – flash the spot where the layer is clicked (regardless of any area boundary)
allowedFeedbackTypecan be comma-delimited list of "CLICK", "LONGPRESS" and "DOUBLECLICK"
Note
if you will not be making use of "feedback", you can disable it by defining DD_NO_FEEDBACK in order to reduce footprint

◆ explicitFeedback()

void DDLayer::explicitFeedback ( int16_t  x = 0,
int16_t  y = 0,
const String &  text = "",
DDFeedbackType  type = DDFeedbackType::CLICK,
const String &  option = "" 
)

trigger explicit "feedback" to the layer (similar to implicit "feedback" when layer is clicked)

Parameters
typeother than CLICK etc, can be CUSTOM (which is only possible with explicit "feedback");
optioncan be "" / "keys" / "numkeys" / "confirm";
  • in case of "keys" / "numkeys", input box will be popped up for user to enter the "text" of the "feedback"; and the "text" in the parameter will be the "hint"
  • in case of "confirm", a confirmation dialog will be popped up with "text" as the message, and the "feedback" "text" will be "Yes" or "No";
Note
feedback must be enabled for this to work

◆ exportAsBackgroundImage()

void DDLayer::exportAsBackgroundImage ( bool  replace = true,
bool  noDrawBackground = true,
int  exportAsWidth = 0 
)

export the layer as background image

Parameters
replacereplace any existing background image; for add as an item of background image series that can be used for animation with animateBackgroundImage()
noDrawBackgroundduring export, do not draw background
exportAsWidththe width of the image; 0 means the default (should be good enough)

◆ getFeedback()

const DDFeedback * DDLayer::getFeedback ( )

get "feedback" DDFeedback

Returns
NULL if no pending "feedback"

◆ getFeedbackHandler()

DDFeedbackHandler DDLayer::getFeedbackHandler ( ) const
inline
Attention
used internally

◆ getFeedbackManager()

DDFeedbackManager * DDLayer::getFeedbackManager ( ) const
inline
Attention
used internally

◆ margin() [1/2]

void DDLayer::margin ( float  left,
float  top,
float  right,
float  bottom 
)

set margin for each side; for unit, see DDLayer::border()

Note
layer property

◆ margin() [2/2]

void DDLayer::margin ( float  size)

set margin for all sides

Parameters
sizefor size unit, see border()
Note
layer property

◆ noBackgroundColor()

void DDLayer::noBackgroundColor ( )

set no layer background color

Note
layer property

◆ noblend()

void DDLayer::noblend ( )

no blending

Note
layer property

◆ noBorder()

void DDLayer::noBorder ( )

set no border

Note
layer property

◆ noMargin()

void DDLayer::noMargin ( )

set no margin

Note
layer property

◆ noPadding()

void DDLayer::noPadding ( )

set no padding

Note
layer property

◆ opacity()

void DDLayer::opacity ( int  opacity)

set layer opacity percentage

Parameters
opacity0 - 100
Note
layer property

◆ padding() [1/2]

void DDLayer::padding ( float  left,
float  top,
float  right,
float  bottom 
)

set padding for each side; for unit, see border()

Note
layer property

◆ padding() [2/2]

void DDLayer::padding ( float  size)

set padding for all sides

Parameters
sizefor size unit, see border()
Note
layer property

◆ setFeedbackHandler()

void DDLayer::setFeedbackHandler ( DDFeedbackHandler  handler,
const String &  autoFeedbackMethod = "",
const String &  allowFeedbackTypes = "" 
)

set explicit (and more responsive) "feedback" handler (and enable feedback)

Parameters
handler"feedback" handler; see DDFeedbackHandler
autoFeedbackMethodsee DDLayer::enableFeedback()
allowedFeedbackTypecan be comma-delimited list of "CLICK", "LONGPRESS" and "DOUBLECLICK"
Note
if you will not be making use of "feedback", you can disable it by defining DD_NO_FEEDBACK in order to reduce footprint

◆ stopAnimateBackgroundImage()

void DDLayer::stopAnimateBackgroundImage ( bool  reset = true)

stop animate background image

Parameters
resetreset to the first image in the series

◆ transparent()

void DDLayer::transparent ( bool  transparent)

set whether layer is transparent

Note
layer property

◆ visible()

void DDLayer::visible ( bool  visible)

set whether layer visible (not visible means hidden)

Note
layer property