Explorar el Código

add svg-from-png back

Getty Ritter hace 10 meses
padre
commit
0e483483ca
Se han modificado 2 ficheros con 7 adiciones y 5 borrados
  1. 3 3
      Cargo.toml
  2. 4 2
      tools/svg-from-png/main.rs

+ 3 - 3
Cargo.toml

@@ -22,9 +22,9 @@ zip = "*"
 name = "thyme-from-png"
 path = "tools/thyme-from-png/main.rs"
 
-# [[bin]]
-# name = "svg-from-png"
-# path = "tools/svg-from-png/main.rs"
+[[bin]]
+name = "svg-from-png"
+path = "tools/svg-from-png/main.rs"
 
 [[bin]]
 name = "svg-from-thyme"

+ 4 - 2
tools/svg-from-png/main.rs

@@ -5,6 +5,7 @@ use clap::Parser;
 use thyme::{
     data::{Config, Mapping},
     draw::Pattern,
+    file::ThymeFile,
     image::Image,
 };
 
@@ -17,6 +18,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
     // load the color map file
     let mapping = Mapping::load(opts.mapping, &image)?;
 
+    let thyme = ThymeFile::from_image_and_config(&image, &mapping);
+
     let config = Config {
         grid_every: opts.grid,
         line_weight: opts.line_weight,
@@ -32,9 +35,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
     )?;
 
     Pattern {
-        image,
+        thyme,
         config,
-        mapping,
     }
     .draw(cairo::Context::new(&surf)?)?;