site-donate.rs
946 B · rust · 38 lines
1use mrlycore::errors::Result;2use mrlyfig::{grid, ink, save, Board, Frame, Grid};34const CELL: f64 = 70.0;56const HEART: [&str; 10] = [7 "01100000110",8 "11110001111",9 "11111111111",10 "11111111111",11 "11111111111",12 "01111111110",13 "00111111100",14 "00011111000",15 "00001110000",16 "00000100000",17];1819fn main() -> Result<()> {20 let mut board = Board::square();21 let cols = HEART[0].len();22 let rows = HEART.len();23 let w = CELL * cols as f64;24 let h = CELL * rows as f64;25 let frame = Frame::new(26 ((board.width as f64 - w) / 2.0).round(),27 ((board.height as f64 - h) / 2.0).round(),28 w,29 h,30 );31 let cells = Grid::new(frame, cols, rows, 0.0);32 cells.carpet(&mut board, &grid::mask(&HEART, 1), ink::fg());33 for (col, row) in [(2, 2), (3, 2), (2, 3)] {34 cells.fill(&mut board, col, row, ink::red());35 }36 save("site-donate", &board)?;37 Ok(())38}