lcd.loadBitmap¶
since 1.1.0
Load a bitmap from a file. Allowed formats are BMP / JPG / PNG. Transparency is supported, but it will use more resources.
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
path |
string | yes | bitmap path |
lazy |
boolean | optional (default true) |
lazy load (only loaded when needed) |
Returns¶
bitmapHandle (userdata): bitmap handle
Examples¶
local BG = lcd.loadBitmap("gfx/panel.png") -- file level: loaded once
local function paint(widget)
if BG then lcd.drawBitmap(0, 0, BG) end
end
- Returns
nilif the file is missing or can't be decoded. Check before drawing. - Decoded images use the Lua bitmap memory, which shares a region with the Lua heap. Size images to how they are displayed and release handles (
= nil) when a tool closes. See Saving RAM. - Transparency (PNG alpha) is supported but costs more.
Used in¶
Real-world usage¶
Called 35 times across 6 open-source Ethos Lua projects. A few short excerpts: