Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Hard_Light.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4// HASH=ac2fe555e2196e15863ea4ce74db3d54
5REG_FIDDLE(Hard_Light, 256, 256, false, 3) {
6void draw(SkCanvas* canvas) {
7 canvas->drawImage(image, 0, 0);
8 const SkColor colors[] = { 0xFFFFFFFF, 0x00000000 };
10 paint.setBlendMode(SkBlendMode::kHardLight);
11 paint.setShader(SkGradientShader::MakeRadial({ 128, 128}, 100, colors,
12 nullptr, std::size(colors), SkTileMode::kClamp));
13 canvas->clipRect({0, 128, 256, 256});
14 canvas->drawPaint(paint);
15}
16} // END FIDDLE
@ kHardLight
multiply or screen, depending on source
uint32_t SkColor
Definition SkColor.h:37
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void drawPaint(const SkPaint &paint)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
static sk_sp< SkShader > MakeRadial(const SkPoint &center, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
const Paint & paint
sk_sp< SkImage > image
Definition examples.cpp:29
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60