site-contact.rs
1.0 kB · rust · 39 lines
1use mrlycore::errors::Result;2use mrlyfig::{grid, ink, save, Board, Frame, Grid};34const CELL: f64 = 55.0;56const LETTER: [&str; 10] = [7 "11111111111111",8 "10000000000001",9 "10000000000001",10 "10000000000001",11 "10000000000001",12 "10000000000001",13 "10000000000001",14 "10000000000001",15 "10000000000001",16 "11111111111111",17];1819fn main() -> Result<()> {20 let mut board = Board::square();21 let cols = LETTER[0].len();22 let rows = LETTER.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(&LETTER, 1), ink::fg());33 for step in 0..6 {34 cells.fill(&mut board, 1 + step, 1 + step, ink::blue());35 cells.fill(&mut board, 12 - step, 1 + step, ink::blue());36 }37 save("site-contact", &board)?;38 Ok(())39}