1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use lyon::tessellation::FillOptions;
pub trait SetFill: Sized {
fn fill_options_mut(&mut self) -> &mut FillOptions;
fn fill_opts(mut self, opts: FillOptions) -> Self {
*self.fill_options_mut() = opts;
self
}
fn fill_tolerance(mut self, tolerance: f32) -> Self {
self.fill_options_mut().tolerance = tolerance;
self
}
fn fill_rule(mut self, rule: lyon::tessellation::FillRule) -> Self {
self.fill_options_mut().fill_rule = rule;
self
}
fn fill_sweep_orientation(mut self, orientation: lyon::tessellation::Orientation) -> Self {
self.fill_options_mut().sweep_orientation = orientation;
self
}
fn handle_intersections(mut self, handle: bool) -> Self {
self.fill_options_mut().handle_intersections = handle;
self
}
}
impl SetFill for Option<FillOptions> {
fn fill_options_mut(&mut self) -> &mut FillOptions {
self.get_or_insert_with(Default::default)
}
}