use super::matrix::Matrix;
use crate::pbm::Bitmap;
pub fn render_to_bitmap(matrix: &Matrix, scale: usize, quiet: usize) -> Bitmap {
let n = matrix.size;
let dim_modules = n + 2 * quiet;
let dim_pixels = dim_modules * scale;
let mut bm = Bitmap::new(dim_pixels, dim_pixels);
for r in 0..n {
for c in 0..n {
let v = matrix.get(r, c);
if !v {
continue; }
let y0 = (quiet + r) * scale;
let x0 = (quiet + c) * scale;
for dy in 0..scale {
for dx in 0..scale {
bm.set(x0 + dx, y0 + dy, true);
}
}
}
}
bm
}