mod opts; use clap::Parser; use thyme::{data::{Config, Mapping}, draw::Pattern, image::Image}; use crate::opts::Options; fn main() -> Result<(), Box> { // read the command-line options let opts = Options::parse(); // load the PNG image for the pattern let image = Image::load(opts.image)?; // load the color map file let mapping = Mapping::load(opts.mapping, &image)?; let config = Config { grid_every: opts.grid, line_weight: opts.line_weight, major_line_weight: opts.major_line_weight, grid_size: opts.size, font: opts.font.clone(), }; let surf = cairo::SvgSurface::new( config.scale(image.width), config.scale(image.height), Some(opts.output.unwrap_or_else(|| "output.svg".to_string())), )?; Pattern { image, config, mapping, } .draw(cairo::Context::new(&surf)?)?; surf.finish(); Ok(()) }