Skip to main content

rasterize

Function rasterize 

Source
pub fn rasterize<T: Trace + ?Sized>(
    scene: &T,
    camera: &Camera,
    cols: u16,
    rows: u16,
    put: impl FnMut(u16, u16, char, Color),
)
Expand description

Traces scene through camera into a cols × rows grid of braille cells with 2× supersampling.

put runs once per lit cell as (column, row, glyph, color). Cells with no dot over the coverage threshold are skipped, so whatever sits behind them shows through.

Examples found in repository?
examples/chat/welcome.rs (lines 747-749)
743fn logo_cells(elapsed: f32, pointer: (f32, f32)) -> LogoGrid {
744	let mut platter = Platter::new(pointer);
745	let camera = platter.advance(Duration::from_secs_f32(elapsed));
746	let mut grid: LogoGrid = [[None; LOGO_COLS]; LOGO_ROWS];
747	scene::rasterize(&platter, &camera, LOGO_COLS as u16, LOGO_ROWS as u16, |x, y, glyph, color| {
748		grid[y as usize][x as usize] = Some((glyph, color));
749	});
750	grid
751}