1 | /* |
2 | * Copyright 2019 Google LLC. |
3 | * |
4 | * Use of this source code is governed by a BSD-style license that can be |
5 | * found in the LICENSE file. |
6 | */ |
7 | |
8 | #ifndef SkPathTypes_DEFINED |
9 | #define SkPathTypes_DEFINED |
10 | |
11 | #include "include/core/SkTypes.h" |
12 | |
13 | enum class SkPathFillType { |
14 | /** Specifies that "inside" is computed by a non-zero sum of signed edge crossings */ |
15 | kWinding, |
16 | /** Specifies that "inside" is computed by an odd number of edge crossings */ |
17 | kEvenOdd, |
18 | /** Same as Winding, but draws outside of the path, rather than inside */ |
19 | kInverseWinding, |
20 | /** Same as EvenOdd, but draws outside of the path, rather than inside */ |
21 | kInverseEvenOdd |
22 | }; |
23 | |
24 | static inline bool SkPathFillType_IsEvenOdd(SkPathFillType ft) { |
25 | return (static_cast<int>(ft) & 1) != 0; |
26 | } |
27 | |
28 | static inline bool SkPathFillType_IsInverse(SkPathFillType ft) { |
29 | return (static_cast<int>(ft) & 2) != 0; |
30 | } |
31 | |
32 | static inline SkPathFillType SkPathFillType_ConvertToNonInverse(SkPathFillType ft) { |
33 | return static_cast<SkPathFillType>(static_cast<int>(ft) & 1); |
34 | } |
35 | |
36 | enum class SkPathConvexityType { |
37 | kUnknown, |
38 | kConvex, |
39 | kConcave |
40 | }; |
41 | |
42 | enum class SkPathDirection { |
43 | /** clockwise direction for adding closed contours */ |
44 | kCW, |
45 | /** counter-clockwise direction for adding closed contours */ |
46 | kCCW, |
47 | }; |
48 | |
49 | enum SkPathSegmentMask { |
50 | kLine_SkPathSegmentMask = 1 << 0, |
51 | kQuad_SkPathSegmentMask = 1 << 1, |
52 | kConic_SkPathSegmentMask = 1 << 2, |
53 | kCubic_SkPathSegmentMask = 1 << 3, |
54 | }; |
55 | |
56 | enum class SkPathVerb { |
57 | kMove, //!< iter.next returns 1 point |
58 | kLine, //!< iter.next returns 2 points |
59 | kQuad, //!< iter.next returns 3 points |
60 | kConic, //!< iter.next returns 3 points + iter.conicWeight() |
61 | kCubic, //!< iter.next returns 4 points |
62 | kClose, //!< iter.next returns 1 point (contour's moveTo pt) |
63 | kDone, //!< iter.next returns 0 points |
64 | }; |
65 | |
66 | #endif |
67 | |