Picture type
The calls a screen, a canvas and a view all share.
Functions 16
picture:clear(color: Ink?)Its width in pixels: 128 for each map across. Its height in pixels: 128 for each map down. Paints every pixel one colour; black by default. On a view, the default clears it to see-through.
picture:set(x: number, y: number, color: Ink)Paints one pixel; (0, 0) is the top-left.
picture:fill(x: number, y: number, w: number, h: number, color: Ink)Fills a w by h box of pixels with one colour, its top-left at (x, y).
picture:rect(x: number, y: number, w: number, h: number, color: Ink, radius: number?)Fills a box like fill, with smoothed rounded corners of radius pixels when given.
picture:circle(x: number, y: number, r: number, color: Ink)Fills a circle of radius r pixels around (x, y).
picture:text(x: number, y: number, text: string, color: Ink, size: number?) → numberDraws text in DejaVu Sans Bold, size pixels tall (16 by default), smoothed; returns its width in pixels.
picture:measure(text: string, size: number?) → numberThe width in pixels that text would draw, without drawing it; for centring.
picture:line(x0: number, y0: number, x1: number, y1: number, color: Ink, width: number?)Draws a smoothed line with round ends, width pixels wide (1 by default); positions may be fractions.
picture:ring(x: number, y: number, r: number, color: Ink, width: number?)Draws a circle's outline, width pixels wide (1 by default), smoothed.
picture:polygon(points: { { number } | { x: number, y: number } }, color: Ink)Fills a smoothed shape with any number of corners; a point is {x, y} or { x = .., y = .. }.
picture:gradient(x: number, y: number, w: number, h: number, from: Ink, to: Ink, across: string?)Fills a box that fades from from to to, top to bottom; "across" runs it left to right.
picture:sprite(x: number, y: number, rows: { string }, inks: { [string]: Ink }, scale: number?)Draws pixel art: each string a row, each character a dot scale pixels square (1 by default); a character with no ink is skipped.
picture:pixels(x: number, y: number, w: number, h: number, data: buffer | string)Writes raw RGB bytes (a buffer or a string), three a pixel, row by row, into a w by h box.
picture:draw(source: Screen | Canvas | View, x: number?, y: number?)Draws another screen, canvas or view with its top-left at (x, y), skipping its transparent pixels.
picture:part(col: number, row: number) → { id: number }One map of the picture, { id = .. }, by column and row from (0, 0) top- left; for a hand or a single frame.
picture:play(opts: { file: string, fps: number?, loop: boolean? }) → VideoPlays a raw RGB video file from the pack at fps 0.5 to 20, the engine drawing each frame; returns the Video.