8 #ifndef SkGradientShader_DEFINED
9 #define SkGradientShader_DEFINED
18 #include "include/private/base/SkAPI.h"
68 kInterpolateColorsInPremul_Flag = 1 << 0,
88 kLastColorSpace = kHWB,
90 static constexpr
int kColorSpaceCount =
static_cast<int>(ColorSpace::kLastColorSpace) + 1;
99 kLastHueMethod = kDecreasing,
101 static constexpr
int kHueMethodCount =
static_cast<int>(HueMethod::kLastHueMethod) + 1;
108 return {flags & kInterpolateColorsInPremul_Flag ? InPremul::kYes : InPremul::kNo,
109 ColorSpace::kDestination,
110 HueMethod::kShorter};
134 uint32_t flags = 0,
const SkMatrix* localMatrix =
nullptr);
161 uint32_t flags = 0,
const SkMatrix* localMatrix =
nullptr) {
162 return MakeLinear(pts, colors, std::move(colorSpace), pos, count, mode,
163 Interpolation::FromFlags(flags), localMatrix);
185 uint32_t flags = 0,
const SkMatrix* localMatrix =
nullptr);
211 uint32_t flags = 0,
const SkMatrix* localMatrix =
nullptr) {
212 return MakeRadial(center, radius, colors, std::move(colorSpace), pos, count, mode,
213 Interpolation::FromFlags(flags), localMatrix);
223 const SkPoint& end,
SkScalar endRadius,
227 const SkMatrix* localMatrix =
nullptr);
236 const SkPoint& end,
SkScalar endRadius,
243 const SkPoint& end,
SkScalar endRadius,
248 const SkMatrix* localMatrix =
nullptr) {
249 return MakeTwoPointConical(start, startRadius, end, endRadius, colors,
250 std::move(colorSpace), pos, count, mode,
251 Interpolation::FromFlags(flags), localMatrix);
285 uint32_t flags,
const SkMatrix* localMatrix);
288 uint32_t flags = 0,
const SkMatrix* localMatrix =
nullptr) {
332 uint32_t flags,
const SkMatrix* localMatrix) {
333 return MakeSweep(cx, cy, colors, std::move(colorSpace), pos, count, mode, startAngle,
334 endAngle, Interpolation::FromFlags(flags), localMatrix);
339 uint32_t flags = 0,
const SkMatrix* localMatrix =
nullptr) {
340 return MakeSweep(cx, cy, colors, std::move(colorSpace), pos, count,
SkTileMode::kClamp,
341 0, 360, flags, localMatrix);
Types, consts, functions, and macros for colors.
uint32_t SkColor
32-bit ARGB color value, unpremultiplied.
Definition: SkColor.h:37
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
float SkScalar
Definition: SkScalar.h:14
SkTileMode
Definition: SkTileMode.h:13
@ kClamp
Replicate the edge color if the shader draws outside of its original bounds.
SkGradientShader hosts factories for creating subclasses of SkShader that render linear and radial gr...
Definition: SkGradientShader.h:59
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Definition: SkGradientShader.h:208
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Returns a shader that generates a linear gradient between the two specified points.
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Returns a shader that generates a radial gradient given the center and radius.
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, uint32_t flags, const SkMatrix *localMatrix)
Definition: SkGradientShader.h:327
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Definition: SkGradientShader.h:242
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, SkTileMode mode, const Interpolation &interpolation, const SkMatrix *localMatrix)
Returns a shader that generates a radial gradient given the center and radius.
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, SkTileMode mode, const Interpolation &interpolation, const SkMatrix *localMatrix)
Returns a shader that generates a linear gradient between the two specified points.
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Returns a shader that generates a conical gradient given two circles, or returns NULL if the inputs a...
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, const Interpolation &interpolation, const SkMatrix *localMatrix)
Returns a shader that generates a sweep gradient given a center.
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, uint32_t flags, const SkMatrix *localMatrix)
Returns a shader that generates a sweep gradient given a center.
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Definition: SkGradientShader.h:336
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Definition: SkGradientShader.h:158
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor4f colors[], sk_sp< SkColorSpace > colorSpace, const SkScalar pos[], int count, SkTileMode mode, const Interpolation &interpolation, const SkMatrix *localMatrix)
Returns a shader that generates a conical gradient given two circles, or returns NULL if the inputs a...
Flags
Definition: SkGradientShader.h:61
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor colors[], const SkScalar pos[], int count, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
Definition: SkGradientShader.h:286
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
RGBA color value, holding four floating point components.
Definition: SkGradientShader.h:71
InPremul
Definition: SkGradientShader.h:72
HueMethod
Definition: SkGradientShader.h:92
static Interpolation FromFlags(uint32_t flags)
Definition: SkGradientShader.h:107
ColorSpace
Definition: SkGradientShader.h:74