Getty Ritter 10 ヶ月 前
コミット
6ecddf1e14
3 ファイル変更6 行追加18 行削除
  1. 3 3
      src/file.rs
  2. 1 5
      tools/svg-from-png/main.rs
  3. 2 10
      tools/svg-from-thyme/main.rs

+ 3 - 3
src/file.rs

@@ -266,9 +266,9 @@ impl<'a> Iterator for ThymeImageIterator<'a> {
     fn next(&mut self) -> Option<Self::Item> {
         let px = self.values.next();
         if let Some(px) = px {
-            let r = px.as_ref().map(|stitch| {
-                (stitch.typ, &self.palette[stitch.color.idx as usize])
-            });
+            let r = px
+                .as_ref()
+                .map(|stitch| (stitch.typ, &self.palette[stitch.color.idx as usize]));
             let ret = ((self.x, self.y), r);
             self.x += 1;
             if self.x == self.width {

+ 1 - 5
tools/svg-from-png/main.rs

@@ -34,11 +34,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
         Some(opts.output.unwrap_or_else(|| "output.svg".to_string())),
     )?;
 
-    Pattern {
-        thyme,
-        config,
-    }
-    .draw(cairo::Context::new(&surf)?)?;
+    Pattern { thyme, config }.draw(cairo::Context::new(&surf)?)?;
 
     surf.finish();
 

+ 2 - 10
tools/svg-from-thyme/main.rs

@@ -2,12 +2,8 @@ mod opts;
 
 use crate::opts::Options;
 use clap::Parser;
-use thyme::{
-    file::ThymeFile,
-    data::Config,
-    draw::Pattern,
-};
 use std::fs::File;
+use thyme::{data::Config, draw::Pattern, file::ThymeFile};
 
 fn main() -> Result<(), Box<dyn std::error::Error>> {
     // read the command-line options
@@ -33,11 +29,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
         Some(opts.output.unwrap_or_else(|| "output.svg".to_string())),
     )?;
 
-    Pattern {
-        thyme,
-        config,
-    }
-    .draw(cairo::Context::new(&surf)?)?;
+    Pattern { thyme, config }.draw(cairo::Context::new(&surf)?)?;
 
     surf.finish();