Skip to main content

background_geometry

Function background_geometry 

Source
fn background_geometry(
    width: u32,
    height: u32,
    padding: u32,
    corner_radius: u32,
) -> (Rect, f32, (f64, f64))
Expand description

Derive the rounded-corner frame window + corner radius (both NDC) and the per-axis padding shrink factor from the canvas dims and the config’s pixel padding / corner radius (ED.18). Pure — unit-tested without a GPU.

padding px → NDC margin 2·padding/axis (NDC spans [-1, 1] = 2 units per axis), so the screen shrinks to [-k, k] with k = 1 − 2·padding/axis. The window rect is that [-k, k]² region; corner_radius px → NDC 2·corner_radius/width (isotropic in NDC).