Pixel canvas — an ergonomic Lua wrapper over the C term.gfx_core surface.
The surface holds the raw RGBA bytes and does the per-pixel/blit/serialize
work in C; this layer adds the friendly API the rest of the codebase already
expects: {r,g,b,a} colour arrays, default fg/bg colours, the convenience
primitives (line, circle), blit with table options, and send/display
helpers that hand the pixels to the Kitty protocol.
Use canvas:get(x, y) to read a pixel back.
| Name | Signature |
|---|---|
new_canvas | new_canvas(config) -> canvas |
new_canvas(
config) ->canvas
Create a new pixel canvas for drawing and displaying images
Returns a canvas object with drawing and display methods.
drawing methods
fill, clear, pixel, line, circle, rect, blit
display methods:
send, display
Config fields:
width (default 800),
height (default 600),
colors.bg (RGBA background, default transparent {0,0,0,0}),
colors.main (RGBA foreground, default near-white {252,252,252,255}).
The canvas is pre-filled with colors.bg on creation.