From e98ff143a14d5b5e8d2eff39d129b2c1a9647f96 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Mon, 30 Mar 2026 00:30:51 +0200 Subject: [PATCH] cargo fmt --- rustitch/src/pes/palette.rs | 130 ++++++++++++++++++------------------ rustitch/src/pes/pec.rs | 6 +- stitch-peek/src/main.rs | 4 +- 3 files changed, 68 insertions(+), 72 deletions(-) diff --git a/rustitch/src/pes/palette.rs b/rustitch/src/pes/palette.rs index 23b17ca..ea6002b 100644 --- a/rustitch/src/pes/palette.rs +++ b/rustitch/src/pes/palette.rs @@ -1,69 +1,69 @@ /// Brother PEC thread color palette (65 entries). /// Index 0 is a fallback; indices 1–64 correspond to standard Brother thread colors. pub const PEC_PALETTE: [(u8, u8, u8); 65] = [ - (0, 0, 0), // 0: Unknown - (14, 31, 124), // 1: Prussian Blue - (10, 85, 163), // 2: Blue - (0, 135, 119), // 3: Teal Green - (75, 107, 175), // 4: Cornflower Blue - (237, 23, 31), // 5: Red - (209, 92, 0), // 6: Reddish Brown - (145, 54, 151), // 7: Magenta - (228, 154, 203), // 8: Light Lilac - (145, 95, 172), // 9: Lilac - (158, 214, 125), // 10: Mint Green - (232, 169, 0), // 11: Deep Gold - (254, 186, 53), // 12: Orange - (255, 255, 0), // 13: Yellow - (112, 188, 31), // 14: Lime Green - (186, 152, 0), // 15: Brass - (168, 168, 168), // 16: Silver - (125, 111, 0), // 17: Russet Brown - (255, 255, 179), // 18: Cream Brown - (79, 85, 86), // 19: Pewter - (0, 0, 0), // 20: Black - (11, 61, 145), // 21: Ultramarine - (119, 1, 118), // 22: Royal Purple - (41, 49, 51), // 23: Dark Gray - (42, 19, 1), // 24: Dark Brown - (246, 74, 138), // 25: Deep Rose - (178, 118, 36), // 26: Light Brown - (252, 187, 197), // 27: Salmon Pink - (254, 55, 15), // 28: Vermilion - (240, 240, 240), // 29: White - (106, 28, 138), // 30: Violet - (168, 221, 196), // 31: Seacrest - (37, 132, 187), // 32: Sky Blue - (254, 179, 67), // 33: Pumpkin - (255, 243, 107), // 34: Cream Yellow - (208, 166, 96), // 35: Khaki - (209, 84, 0), // 36: Clay Brown - (102, 186, 73), // 37: Leaf Green - (19, 74, 70), // 38: Peacock Blue - (135, 135, 135), // 39: Gray - (216, 204, 198), // 40: Warm Gray - (67, 86, 7), // 41: Dark Olive - (253, 217, 222), // 42: Flesh Pink - (249, 147, 188), // 43: Pink - (0, 56, 34), // 44: Deep Green - (178, 175, 212), // 45: Lavender - (104, 106, 176), // 46: Wisteria Violet - (239, 227, 185), // 47: Beige - (247, 56, 102), // 48: Carmine - (181, 75, 100), // 49: Amber Red - (19, 43, 26), // 50: Olive Green - (199, 1, 86), // 51: Dark Fuchsia - (254, 158, 50), // 52: Tangerine - (168, 222, 235), // 53: Light Blue - (0, 103, 62), // 54: Emerald Green - (78, 41, 144), // 55: Purple - (47, 126, 32), // 56: Moss Green - (255, 204, 204), // 57: Flesh Pink - (255, 217, 17), // 58: Harvest Gold - (9, 91, 166), // 59: Electric Blue - (240, 249, 112), // 60: Lemon Yellow - (227, 243, 91), // 61: Fresh Green - (255, 153, 0), // 62: Orange - (255, 240, 141), // 63: Cream Yellow - (255, 200, 200), // 64: Applique + (0, 0, 0), // 0: Unknown + (14, 31, 124), // 1: Prussian Blue + (10, 85, 163), // 2: Blue + (0, 135, 119), // 3: Teal Green + (75, 107, 175), // 4: Cornflower Blue + (237, 23, 31), // 5: Red + (209, 92, 0), // 6: Reddish Brown + (145, 54, 151), // 7: Magenta + (228, 154, 203), // 8: Light Lilac + (145, 95, 172), // 9: Lilac + (158, 214, 125), // 10: Mint Green + (232, 169, 0), // 11: Deep Gold + (254, 186, 53), // 12: Orange + (255, 255, 0), // 13: Yellow + (112, 188, 31), // 14: Lime Green + (186, 152, 0), // 15: Brass + (168, 168, 168), // 16: Silver + (125, 111, 0), // 17: Russet Brown + (255, 255, 179), // 18: Cream Brown + (79, 85, 86), // 19: Pewter + (0, 0, 0), // 20: Black + (11, 61, 145), // 21: Ultramarine + (119, 1, 118), // 22: Royal Purple + (41, 49, 51), // 23: Dark Gray + (42, 19, 1), // 24: Dark Brown + (246, 74, 138), // 25: Deep Rose + (178, 118, 36), // 26: Light Brown + (252, 187, 197), // 27: Salmon Pink + (254, 55, 15), // 28: Vermilion + (240, 240, 240), // 29: White + (106, 28, 138), // 30: Violet + (168, 221, 196), // 31: Seacrest + (37, 132, 187), // 32: Sky Blue + (254, 179, 67), // 33: Pumpkin + (255, 243, 107), // 34: Cream Yellow + (208, 166, 96), // 35: Khaki + (209, 84, 0), // 36: Clay Brown + (102, 186, 73), // 37: Leaf Green + (19, 74, 70), // 38: Peacock Blue + (135, 135, 135), // 39: Gray + (216, 204, 198), // 40: Warm Gray + (67, 86, 7), // 41: Dark Olive + (253, 217, 222), // 42: Flesh Pink + (249, 147, 188), // 43: Pink + (0, 56, 34), // 44: Deep Green + (178, 175, 212), // 45: Lavender + (104, 106, 176), // 46: Wisteria Violet + (239, 227, 185), // 47: Beige + (247, 56, 102), // 48: Carmine + (181, 75, 100), // 49: Amber Red + (19, 43, 26), // 50: Olive Green + (199, 1, 86), // 51: Dark Fuchsia + (254, 158, 50), // 52: Tangerine + (168, 222, 235), // 53: Light Blue + (0, 103, 62), // 54: Emerald Green + (78, 41, 144), // 55: Purple + (47, 126, 32), // 56: Moss Green + (255, 204, 204), // 57: Flesh Pink + (255, 217, 17), // 58: Harvest Gold + (9, 91, 166), // 59: Electric Blue + (240, 249, 112), // 60: Lemon Yellow + (227, 243, 91), // 61: Fresh Green + (255, 153, 0), // 62: Orange + (255, 240, 141), // 63: Cream Yellow + (255, 200, 200), // 64: Applique ]; diff --git a/rustitch/src/pes/pec.rs b/rustitch/src/pes/pec.rs index 7d3be98..b3c95d1 100644 --- a/rustitch/src/pes/pec.rs +++ b/rustitch/src/pes/pec.rs @@ -173,11 +173,7 @@ fn decode_coordinate(data: &[u8], pos: usize) -> Result<(i16, u8, usize), Error> Ok((value, flags, 2)) } else { // 7-bit encoding (1 byte) - let value = if b > 0x3F { - b as i16 - 0x80 - } else { - b as i16 - }; + let value = if b > 0x3F { b as i16 - 0x80 } else { b as i16 }; Ok((value, 0, 1)) } } diff --git a/stitch-peek/src/main.rs b/stitch-peek/src/main.rs index 490c7ae..a2dba8f 100644 --- a/stitch-peek/src/main.rs +++ b/stitch-peek/src/main.rs @@ -24,8 +24,8 @@ fn main() -> Result<()> { let data = fs::read(&args.input) .with_context(|| format!("failed to read {}", args.input.display()))?; - let png = rustitch::thumbnail(&data, args.size) - .with_context(|| "failed to generate thumbnail")?; + let png = + rustitch::thumbnail(&data, args.size).with_context(|| "failed to generate thumbnail")?; fs::write(&args.output, &png) .with_context(|| format!("failed to write {}", args.output.display()))?;