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
SkPathFillType_IsEvenOdd(SkPathFillType ft)24 static inline bool SkPathFillType_IsEvenOdd(SkPathFillType ft) {
25 return (static_cast<int>(ft) & 1) != 0;
26 }
27
SkPathFillType_IsInverse(SkPathFillType ft)28 static inline bool SkPathFillType_IsInverse(SkPathFillType ft) {
29 return (static_cast<int>(ft) & 2) != 0;
30 }
31
SkPathFillType_ConvertToNonInverse(SkPathFillType ft)32 static inline SkPathFillType SkPathFillType_ConvertToNonInverse(SkPathFillType ft) {
33 return static_cast<SkPathFillType>(static_cast<int>(ft) & 1);
34 }
35
36 enum class SkPathDirection {
37 /** clockwise direction for adding closed contours */
38 kCW,
39 /** counter-clockwise direction for adding closed contours */
40 kCCW,
41 };
42
43 enum SkPathSegmentMask {
44 kLine_SkPathSegmentMask = 1 << 0,
45 kQuad_SkPathSegmentMask = 1 << 1,
46 kConic_SkPathSegmentMask = 1 << 2,
47 kCubic_SkPathSegmentMask = 1 << 3,
48 };
49
50 enum class SkPathVerb {
51 kMove, //!< SkPath::RawIter returns 1 point
52 kLine, //!< SkPath::RawIter returns 2 points
53 kQuad, //!< SkPath::RawIter returns 3 points
54 kConic, //!< SkPath::RawIter returns 3 points + 1 weight
55 kCubic, //!< SkPath::RawIter returns 4 points
56 kClose //!< SkPath::RawIter returns 0 points
57 };
58
59 #endif
60