Use builder pattern for BezPath
Currently creating bezpaths (rect in this example) and applying transform looks like this:
```rust
let mut path = BezPath::new();
path.move_to((0.,0.));
path.line_to((10.,0.));
path.line_to((10.,10.));
path.line_to((0.,10.));
path.close();
path.apply_affine(Affine::IDENTITY);
```
but using builder pattern one could do:
```rust
let path = BezPath::new()
.move_to((0.,0.))
.line_to((10.,0.))
.line_to((10.,10.))
.line_to((0.,10.))
.close()
.apply_affine(Affine::IDENTITY);
```
signature of methods would be `move_to(&mut self, pt: impl Point) -> &mut Self`.
My main motivation is to make applying affine easier.
关闭于 2025-07-31 3 条评论