Skip to content

lcd.drawMask

since 1.1.0

Draw a mask.

lcd.drawMask(x, y, mask)

Parameters

Name Type Required Description
x number yes X coordinate
y number yes Y coordinate
mask Mask yes mask

Returns

Nothing.

Examples

local ARROW = lcd.loadMask("gfx/arrow.png")   -- file level

local function paint(widget)
  lcd.color(lcd.RGB(255, 200, 0))   -- the mask is painted in the current color
  lcd.drawMask(10, 10, ARROW)
end

Masks are single-channel images, cheaper than full-color bitmaps and recolorable, so they suit icons that should follow the theme or signal state with color.

Used in

Real-world usage

Called 2 times across 2 open-source Ethos Lua projects. A few short excerpts:
local minIconY = labelY + (labelH or 0) + iconGap
local iconY = by + bh - iconSize - iconBottomPad
if iconY < minIconY then iconY = minIconY end
lcd.drawMask(math.floor(bx + (bw - iconSize) / 2 + 0.5), math.floor(iconY + 0.5), mask)

src/rfsuite/widgets/dashboard.lua:602