Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkGradientShader.h
1 /*
2  * Copyright 2006 The Android Open Source Project
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 SkGradientShader_DEFINED
9 #define SkGradientShader_DEFINED
10 
11 #include "SkShader.h"
12 
18 class SK_API SkGradientShader {
19 public:
20  enum Flags {
26  kInterpolateColorsInPremul_Flag = 1 << 0,
27  };
28 
41  static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
42  const SkColor colors[], const SkScalar pos[], int count,
43  SkShader::TileMode mode,
44  uint32_t flags, const SkMatrix* localMatrix);
45  static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
46  const SkColor colors[], const SkScalar pos[], int count,
47  SkShader::TileMode mode) {
48  return MakeLinear(pts, colors, pos, count, mode, 0, NULL);
49  }
50 
63  static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
64  const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
65  const SkScalar pos[], int count, SkShader::TileMode mode,
66  uint32_t flags, const SkMatrix* localMatrix);
67  static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
68  const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
69  const SkScalar pos[], int count, SkShader::TileMode mode) {
70  return MakeLinear(pts, colors, std::move(colorSpace), pos, count, mode, 0, NULL);
71  }
72 
86  static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
87  const SkColor colors[], const SkScalar pos[], int count,
88  SkShader::TileMode mode,
89  uint32_t flags, const SkMatrix* localMatrix);
90  static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
91  const SkColor colors[], const SkScalar pos[], int count,
92  SkShader::TileMode mode) {
93  return MakeRadial(center, radius, colors, pos, count, mode, 0, NULL);
94  }
95 
109  static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
110  const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
111  const SkScalar pos[], int count, SkShader::TileMode mode,
112  uint32_t flags, const SkMatrix* localMatrix);
113  static sk_sp<SkShader> MakeRadial(const SkPoint& center, SkScalar radius,
114  const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
115  const SkScalar pos[], int count, SkShader::TileMode mode) {
116  return MakeRadial(center, radius, colors, std::move(colorSpace), pos, count, mode, 0, NULL);
117  }
118 
125  static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar startRadius,
126  const SkPoint& end, SkScalar endRadius,
127  const SkColor colors[], const SkScalar pos[],
128  int count, SkShader::TileMode mode,
129  uint32_t flags, const SkMatrix* localMatrix);
130  static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar startRadius,
131  const SkPoint& end, SkScalar endRadius,
132  const SkColor colors[], const SkScalar pos[],
133  int count, SkShader::TileMode mode) {
134  return MakeTwoPointConical(start, startRadius, end, endRadius, colors, pos, count, mode,
135  0, NULL);
136  }
137 
144  static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar startRadius,
145  const SkPoint& end, SkScalar endRadius,
146  const SkColor4f colors[],
147  sk_sp<SkColorSpace> colorSpace, const SkScalar pos[],
148  int count, SkShader::TileMode mode,
149  uint32_t flags, const SkMatrix* localMatrix);
150  static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar startRadius,
151  const SkPoint& end, SkScalar endRadius,
152  const SkColor4f colors[],
153  sk_sp<SkColorSpace> colorSpace, const SkScalar pos[],
154  int count, SkShader::TileMode mode) {
155  return MakeTwoPointConical(start, startRadius, end, endRadius, colors,
156  std::move(colorSpace), pos, count, mode, 0, NULL);
157  }
158 
171  static sk_sp<SkShader> MakeSweep(SkScalar cx, SkScalar cy,
172  const SkColor colors[], const SkScalar pos[], int count,
173  uint32_t flags, const SkMatrix* localMatrix);
174  static sk_sp<SkShader> MakeSweep(SkScalar cx, SkScalar cy,
175  const SkColor colors[], const SkScalar pos[], int count) {
176  return MakeSweep(cx, cy, colors, pos, count, 0, NULL);
177  }
178 
191  static sk_sp<SkShader> MakeSweep(SkScalar cx, SkScalar cy,
192  const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
193  const SkScalar pos[], int count,
194  uint32_t flags, const SkMatrix* localMatrix);
195  static sk_sp<SkShader> MakeSweep(SkScalar cx, SkScalar cy,
196  const SkColor4f colors[], sk_sp<SkColorSpace> colorSpace,
197  const SkScalar pos[], int count) {
198  return MakeSweep(cx, cy, colors, std::move(colorSpace), pos, count, 0, NULL);
199  }
200 
201  SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
202 };
203 
204 #endif
Definition: SkPoint.h:156
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:28
Definition: SkColor.h:179
Flags
Definition: SkGradientShader.h:20
SkGradientShader hosts factories for creating subclasses of SkShader that render linear and radial gr...
Definition: SkGradientShader.h:18
uint32_t SkColor
32 bit ARGB color value, not premultiplied.
Definition: SkColor.h:28
TileMode
Definition: SkShader.h:43