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