lcd.drawBitmap¶
since 1.1.0
Draw a bitmap.
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
x |
number | yes | X coordinate |
y |
number | yes | Y coordinate |
bitmap |
Bitmap | yes | bitmap |
w |
number | optional (default 0) |
the width of the bitmap displayed |
h |
number | optional (default 0) |
the height of the bitmap display |
Returns¶
Nothing.
Examples¶
local LOGO = lcd.loadBitmap("gfx/logo.png")
local function paint(widget)
local w, h = lcd.getWindowSize()
if not LOGO then return end
lcd.drawBitmap(0, 0, LOGO) -- natural size
lcd.drawBitmap(w - 64, 0, LOGO, 64, 64) -- scaled into a 64x64 box
end
Scaling at draw time is convenient, but an image that is always shown small should be stored small: the decoded size is what costs RAM.
Used in¶
Real-world usage¶
Called 39 times across 7 open-source Ethos Lua projects. A few short excerpts: