75b3a2c490
Namespaces were shared across features: `settings` was written by core, the
panel and touch, and `input` by touch and buttons. That made "does this
firmware implement the whole feature?" a question no pointer could answer.
Each namespace now belongs to exactly one feature or to core, so a feature is
a provider pointer and the compiler validates completeness:
gui, node -> screen, tree, under the screen feature
settings -> screen (rotation, theme), sys (timezone),
touch (calibration)
input -> touch, buttons
Runtime::open() no longer requires a GuiProvider; a firmware without one runs
with no screen/tree globals and reports sys.hasFeature("screen") false.
Rotation is one value again: GuiProvider::setRotation applies and persists, so
an app rotating the panel transiently puts the old value back itself.
165 lines
5.2 KiB
Lua
165 lines
5.2 KiB
Lua
---@meta
|
|
|
|
-- Generated from native/src/bindings/features/screen/screen.cpp. Do not edit.
|
|
|
|
-- The panel itself; the widget tree it paints is `tree`, and
|
|
-- sys.hasFeature("screen") covers both.
|
|
---@alias ScreenColor integer
|
|
---@alias ScreenFont integer
|
|
---@alias ScreenTextStyle integer
|
|
|
|
---@class ScreenLib
|
|
---@field FONT_SMALL ScreenFont Small auxiliary text.
|
|
---@field FONT_UI ScreenFont Normal controls and labels.
|
|
---@field FONT_BODY ScreenFont Normal reading text.
|
|
---@field FONT_LARGE ScreenFont Headings and prominent values.
|
|
---@field STYLE_NORMAL ScreenTextStyle
|
|
---@field STYLE_BOLD ScreenTextStyle
|
|
screen = {}
|
|
screen.FONT_SMALL = 0
|
|
screen.FONT_UI = 0
|
|
screen.FONT_BODY = 0
|
|
screen.FONT_LARGE = 0
|
|
screen.STYLE_NORMAL = 0
|
|
screen.STYLE_BOLD = 0
|
|
|
|
---Returns the live frame width.
|
|
---@return integer
|
|
function screen.getWidth() end
|
|
|
|
---Returns the live frame height.
|
|
---@return integer
|
|
function screen.getHeight() end
|
|
|
|
---Rotates the panel and persists the choice, so there is one rotation
|
|
---rather than a live one and a saved one to reconcile.
|
|
---@param degrees integer 0, 90, 180, or 270 clockwise.
|
|
---@return true? ok
|
|
---@return string? error
|
|
function screen.setRotation(degrees) end
|
|
|
|
---Returns the rotation in degrees clockwise.
|
|
---@return integer
|
|
function screen.getRotation() end
|
|
|
|
---Returns the saved palette name. Apps read ui.getTheme() instead; this
|
|
---is the stored value, which only ui.setTheme() knows how to apply.
|
|
---@return string
|
|
function screen.getTheme() end
|
|
|
|
---Persists a palette name without applying it. Call ui.setTheme(), which
|
|
---writes through here and then rebuilds the palette and repaints.
|
|
---@param theme string
|
|
---@return true? ok
|
|
---@return string? error
|
|
function screen.setTheme(theme) end
|
|
|
|
---Returns an opaque native color. E-ink implementations quantize RGB to available grayscale.
|
|
---@param r integer 0 through 255.
|
|
---@param g integer 0 through 255.
|
|
---@param b integer 0 through 255.
|
|
---@return ScreenColor
|
|
function screen.color(r, g, b) end
|
|
|
|
---Clears the frame.
|
|
---@param color? ScreenColor Defaults to white.
|
|
function screen.clear(color) end
|
|
|
|
---Fills a rectangle.
|
|
---@param x integer
|
|
---@param y integer
|
|
---@param w integer
|
|
---@param h integer
|
|
---@param color ScreenColor
|
|
function screen.fillRect(x, y, w, h, color) end
|
|
|
|
---Outlines a rectangle.
|
|
---@param x integer
|
|
---@param y integer
|
|
---@param w integer
|
|
---@param h integer
|
|
---@param color ScreenColor
|
|
function screen.drawRect(x, y, w, h, color) end
|
|
|
|
---Draws a line.
|
|
---@param x1 integer
|
|
---@param y1 integer
|
|
---@param x2 integer
|
|
---@param y2 integer
|
|
---@param color ScreenColor
|
|
---@param width? integer Defaults to one pixel.
|
|
function screen.drawLine(x1, y1, x2, y2, color, width) end
|
|
|
|
---Draws a single pixel.
|
|
---@param x integer
|
|
---@param y integer
|
|
---@param color ScreenColor
|
|
function screen.drawPixel(x, y, color) end
|
|
|
|
---Outlines a circle.
|
|
---@param x integer Center.
|
|
---@param y integer Center.
|
|
---@param radius integer
|
|
---@param color ScreenColor
|
|
---@param width? integer Defaults to one pixel.
|
|
function screen.drawCircle(x, y, radius, color, width) end
|
|
|
|
---Fills a circle.
|
|
---@param x integer Center.
|
|
---@param y integer Center.
|
|
---@param radius integer
|
|
---@param color ScreenColor
|
|
---@param background? ScreenColor Surface behind an anti-aliased edge.
|
|
function screen.fillCircle(x, y, radius, color, background) end
|
|
|
|
---Draws an anti-aliased rounded fill, optional gradient, and optional border in one pass.
|
|
---@param x integer
|
|
---@param y integer
|
|
---@param w integer
|
|
---@param h integer
|
|
---@param radius integer
|
|
---@param background ScreenColor Surface behind the anti-aliased edge.
|
|
---@param top? ScreenColor Fill, or gradient top; omitted for no fill.
|
|
---@param bottom? ScreenColor Gradient bottom; defaults to top. Panels without a gradient use top.
|
|
---@param border? ScreenColor Omitted for no border.
|
|
function screen.roundRect(x, y, w, h, radius, background, top, bottom, border) end
|
|
|
|
---Fills a polygon.
|
|
---@param xs integer[]
|
|
---@param ys integer[]
|
|
---@param color ScreenColor
|
|
function screen.fillPolygon(xs, ys, color) end
|
|
|
|
---Draws a bitmap.
|
|
---@param path string Absolute BMP path.
|
|
---@param x? integer Left edge; defaults to centered.
|
|
---@param y? integer Top edge; defaults to centered.
|
|
---@param maxWidth? integer Defaults to panel width.
|
|
---@param maxHeight? integer Defaults to panel height.
|
|
---@return true? ok
|
|
---@return string? error
|
|
function screen.drawBmp(path, x, y, maxWidth, maxHeight) end
|
|
|
|
---Measures a text run.
|
|
---@param font ScreenFont Use a named screen.FONT_* role.
|
|
---@param text string
|
|
---@param style? ScreenTextStyle Defaults to screen.STYLE_NORMAL.
|
|
---@return integer
|
|
function screen.getTextWidth(font, text, style) end
|
|
|
|
---Returns the line height of a font role.
|
|
---@param font ScreenFont Use a named screen.FONT_* role.
|
|
---@param style? ScreenTextStyle Defaults to screen.STYLE_NORMAL.
|
|
---@return integer
|
|
function screen.getFontHeight(font, style) end
|
|
|
|
---Draws a text run with its top-left corner at x, y.
|
|
---@param font ScreenFont Use a named screen.FONT_* role.
|
|
---@param x integer Left edge.
|
|
---@param y integer Top edge.
|
|
---@param text string
|
|
---@param color? ScreenColor Defaults to black.
|
|
---@param style? ScreenTextStyle Defaults to screen.STYLE_NORMAL.
|
|
---@param background? ScreenColor Omitted for transparent text.
|
|
function screen.drawText(font, x, y, text, color, style, background) end
|