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