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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// Copyright (c) 2023 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
// Use of this source is governed by Lesser General Public License that can be found
// in the LICENSE file.
use cratePath;
use crateRect;
// TODO(Shaohua): move everything below into the PathBuilder
/// The logical operations that can be performed when combining two paths.
/// Set this path to the result of applying the Op to this path and the
/// specified path: this = (this op operand).
///
/// The resulting path will be constructed from non-overlapping contours.
/// The curve order is reduced where possible so that cubics may be turned
/// into quadratics, and quadratics maybe turned into lines.
///
/// # Parameters
/// Returns true if operation was able to produce a result;
/// otherwise, result is unmodified.
///
/// # Parameters
/// - `one` - The first operand (for difference, the minuend)
/// - `two` - The second operand (for difference, the subtrahend)
/// - `op` - The operator to apply.
/// - `result` - The product of the operands. The result may be one of the inputs.
///
/// Returns true if the operation succeeded.
/// Set this path to a set of non-overlapping contours that describe the
/// same area as the original path.
///
/// The curve order is reduced where possible so that cubics may
/// be turned into quadratics, and quadratics maybe turned into lines.
///
/// Returns true if operation was able to produce a result;
/// otherwise, result is unmodified.
///
/// # Parameters
/// - `path` - The path to simplify.
/// - `result` The simplified path. The result may be the input.
///
/// Returns true if simplification succeeded.
/// Set the resulting rectangle to the tight bounds of the path.
///
/// # Parameters
/// - `path` - The path measured.
/// - `result` - The tight bounds of the path.
///
/// Returns true if the bounds could be computed.
/// Set the result with fill type winding to area equivalent to path.
///
/// Returns true if successful. Does not detect if path contains contours which
/// contain self-crossings or cross other contours; in these cases, may return
/// true even though result does not fill same area as path.
///
/// Returns true if operation was able to produce a result;
/// otherwise, result is unmodified. The result may be the input.
///
/// # Parameters
/// - `path` - The path typically with fill type set to even odd.
/// - `result` - The equivalent path with fill type set to winding.
///
/// Returns true if winding path was set.
/// Perform a series of path operations, optimized for unioning many paths together.