25 SkPoint pts[] = { { 0, 0 }, { size.width(), size.height() } };
48 : fProc(proc), fName(
name), fDither(dither) {}
62 const SkColor colors[] = { 0xFF555555, 0xFF444444 };
63 const int colorCount = std::size(colors);
69 paint.setShader(
fProc(colors, colorCount, size));
70 paint.setDither(fDither);
77#define M(PROC, DITHER) DEF_GM( return new ShallowGradientGM(shader_ ## PROC, #PROC, DITHER); )
SK_API SkString static SkString SkStringPrintf()
static SkScalar center(float pos0, float pos1)
SkString getName() const override
ShallowGradientGM(MakeShaderProc proc, const char name[], bool dither)
void onDraw(SkCanvas *canvas) override
SkISize getISize() override
void drawRect(const SkRect &rect, const SkPaint &paint)
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)
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)
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)
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)
static sk_sp< SkShader > shader_linear(const SkColor colors[], int count, const SkSize &size)
static sk_sp< SkShader > shader_conical(const SkColor colors[], int count, const SkSize &size)
static sk_sp< SkShader > shader_radial(const SkColor colors[], int count, const SkSize &size)
static sk_sp< SkShader > shader_sweep(const SkColor colors[], int count, const SkSize &size)
sk_sp< SkShader >(* MakeShaderProc)(const SkColor[], int count, const SkSize &)
constexpr float height() const
constexpr float width() const
static constexpr SkSize Make(SkScalar w, SkScalar h)
static sk_sp< SkShader > linear(sk_sp< SkShader > shader)