Browse Source

add svg-from-png back

Getty Ritter 10 months ago
parent
commit
0e483483ca
2 changed files with 7 additions and 5 deletions
  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"
 name = "thyme-from-png"
 path = "tools/thyme-from-png/main.rs"
 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]]
 [[bin]]
 name = "svg-from-thyme"
 name = "svg-from-thyme"

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

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