Skip to content

lcd.setClipping

since 1.1.0

Set the clipping rect.

local width = lcd.setClipping(x, y, w, h)

Parameters

Name Type Required Description
x number yes X coordinate
y number yes Y coordinate
w number yes rectangle width
h number yes rectangle height

Returns

width (integer): window with

Examples

-- draw a striped fill that must not spill past the filled width
lcd.setClipping(barX, barY, fillW, barH)
lcd.drawBitmap(barX, barY, STRIPES)
lcd.setClipping()                          -- reset
-- or: lcd.setClipping(0, 0, lcd.getWindowSize())

Used in

Real-world usage

Called 32 times across 5 open-source Ethos Lua projects. A few short excerpts:
lcd.setClipping(F.x, F.y, F.w, F.h)

src/inav-dashboard/render/ah.lua:189

lcd.setClipping(0, 0, lcd.getWindowSize())

src/wfsuite/widgets/dashboard/objects/navigation/ah.lua:270