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 enum class SkPathFillType {
12 /** Specifies that "inside" is computed by a non-zero sum of signed edge crossings */
13 kWinding,
14 /** Specifies that "inside" is computed by an odd number of edge crossings */
15 kEvenOdd,
16 /** Same as Winding, but draws outside of the path, rather than inside */
17 kInverseWinding,
18 /** Same as EvenOdd, but draws outside of the path, rather than inside */
19 kInverseEvenOdd
20 };
21
SkPathFillType_IsEvenOdd(SkPathFillType ft)22 static inline bool SkPathFillType_IsEvenOdd(SkPathFillType ft) {
23 return (static_cast<int>(ft) & 1) != 0;
24 }
25
SkPathFillType_IsInverse(SkPathFillType ft)26 static inline bool SkPathFillType_IsInverse(SkPathFillType ft) {
27 return (static_cast<int>(ft) & 2) != 0;
28 }
29
SkPathFillType_ConvertToNonInverse(SkPathFillType ft)30 static inline SkPathFillType SkPathFillType_ConvertToNonInverse(SkPathFillType ft) {
31 return static_cast<SkPathFillType>(static_cast<int>(ft) & 1);
32 }
33
34 enum class SkPathDirection {
35 /** clockwise direction for adding closed contours */
36 kCW,
37 /** counter-clockwise direction for adding closed contours */
38 kCCW,
39 };
40
41 enum SkPathSegmentMask {
42 kLine_SkPathSegmentMask = 1 << 0,
43 kQuad_SkPathSegmentMask = 1 << 1,
44 kConic_SkPathSegmentMask = 1 << 2,
45 kCubic_SkPathSegmentMask = 1 << 3,
46 };
47
48 enum class SkPathVerb {
49 kMove, //!< SkPath::RawIter returns 1 point
50 kLine, //!< SkPath::RawIter returns 2 points
51 kQuad, //!< SkPath::RawIter returns 3 points
52 kConic, //!< SkPath::RawIter returns 3 points + 1 weight
53 kCubic, //!< SkPath::RawIter returns 4 points
54 kClose //!< SkPath::RawIter returns 0 points
55 };
56
57 #endif
58