Skip to main content

path_kit/
path_op.rs

1//! 路径布尔运算类型。Path boolean operation type.
2
3use crate::pathkit;
4
5/// 并集、交集、差集、异或等路径集合运算。Union, intersect, difference, xor, reverse difference.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum PathOp {
8    /// 差集:path1 - path2 / Difference
9    Difference,
10    /// 交集:path1 ∩ path2 / Intersection
11    Intersect,
12    /// 并集:path1 ∪ path2 / Union
13    Union,
14    /// 异或:path1 ⊕ path2 / XOR
15    Xor,
16    /// 反向差集:path2 - path1 / Reverse difference
17    ReverseDifference,
18}
19
20impl From<PathOp> for pathkit::SkPathOp::Type {
21    fn from(op: PathOp) -> Self {
22        match op {
23            PathOp::Difference => pathkit::SkPathOp::kDifference_SkPathOp,
24            PathOp::Intersect => pathkit::SkPathOp::kIntersect_SkPathOp,
25            PathOp::Union => pathkit::SkPathOp::kUnion_SkPathOp,
26            PathOp::Xor => pathkit::SkPathOp::kXOR_SkPathOp,
27            PathOp::ReverseDifference => pathkit::SkPathOp::kReverseDifference_SkPathOp,
28        }
29    }
30}