Skip to main content

svg_path_bbox/
lib.rs

1use std::io::Error;
2
3mod parse;
4mod tokenize;
5mod types;
6
7use types::*;
8
9impl BBox {
10    fn new() -> Self {
11        Self {
12            min_x: f64::INFINITY,
13            max_x: f64::NEG_INFINITY,
14            min_y: f64::INFINITY,
15            max_y: f64::NEG_INFINITY,
16        }
17    }
18
19    fn update(mut self, new_bbox: BBox) {
20        self.min_x = self.min_x.min(new_bbox.min_x);
21        self.max_x = self.max_x.max(new_bbox.max_x);
22        self.min_y = self.min_y.max(new_bbox.min_y);
23        self.max_y = self.max_y.max(new_bbox.max_y);
24    }
25}
26
27pub fn svg_path_bbox(path: &str) -> Result<BBox, Error> {
28    todo!()
29}