diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-10-02 11:46:13 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-10-08 16:30:13 +0800 |
| commit | e80d212f564aaa8a14509ad7c6c2c22c460497e0 (patch) | |
| tree | c26ed94ebb5b2809b01d857fac2126831e8e7848 /src/image.rs | |
| parent | 0a617e895ea10c3d397d2875c2534480d77037e9 (diff) | |
internal(image): put create() as associated function
Diffstat (limited to 'src/image.rs')
| -rw-r--r-- | src/image.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/image.rs b/src/image.rs index c8f5d49..f5ad5e6 100644 --- a/src/image.rs +++ b/src/image.rs @@ -14,7 +14,7 @@ use crate::ast::DepthExpr; offset based mutation model, to avoid overflowing on previous image */ -struct FlowChart { +pub struct FlowChart { img: DynamicImage, offset: Offset, font: FontArc, @@ -47,7 +47,7 @@ impl FlowChart { const RESOLUTION_MULTIPLIER: u32 = 5; - fn new() -> Self { + pub fn new() -> Self { Self { img: DynamicImage::new(0, 0, ColorType::Rgba8), offset: Offset { @@ -59,6 +59,15 @@ impl FlowChart { } } + pub fn create(ast: &[DepthExpr], path: &Path) { + let mut chart = FlowChart::new(); + chart.build(ast); + chart + .img + .save(path) + .unwrap(); + } + fn get_system_font() -> FontArc { let mut db = Database::new(); db.load_system_fonts(); @@ -384,12 +393,3 @@ mod colors { 255, 255, 255, 255, ]); } - -pub fn create(ast: &[DepthExpr], path: &Path) { - let mut chart = FlowChart::new(); - chart.build(ast); - chart - .img - .save(path) - .unwrap(); -} |
