gfx.display.layout

gfx.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 k at which a cw x ch canvas fits a dev_w x dev_h mode. Also returns the 0-indexed offsets dx, dy that centre it. Returns nil and an error when the mode is smaller than the canvas; the window's layout (gfx.x11) crops instead.