term.gfx.drm_display.layout

term.gfx.drm_display

layout(dev_w, dev_h, cw, ch) -> k, dx, dy

Compute the integer-upscale layout of a canvas on a display mode

Returns the largest integer scale factor k such that cw*k x ch*k fits inside dev_w x dev_h, plus the 0-indexed offsets dx, dy that center the scaled image. Returns nil, err when the mode is smaller than the canvas (k < 1).