Skip to main content

preview_rect

Function preview_rect 

Source
pub fn preview_rect(output: (u32, u32), console: (u32, u32)) -> Option<Rect>
Expand description

Where to draw the program preview inside a console surface, letterboxed.

The aspect comes from output — the render target — and from nothing else (ADR-0037). The console window’s own aspect and the slot’s are both containers: the returned rectangle fits inside the slot and keeps the output’s shape, so a 16:9 show in a square slot gets bars above and below rather than a stretch. This project has shipped the other reading twice, and both times the tests were written where the two sources agree.

None when either size is degenerate or the slot comes out too small to be worth drawing.