Flutter Engine
The Flutter Engine
Src.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.
4REG_FIDDLE(Src, 256, 256, false, 3) {
5void draw(SkCanvas* canvas) {
6 canvas->drawImage(image, 0, 0);
7 canvas->clipRect({50, 50, 200, 200});
8 SkPaint srcBlend;
10 canvas->saveLayer(nullptr, &srcBlend);
11 canvas->drawColor(0);
12 SkPaint transRed;
13 transRed.setColor(SkColorSetA(SK_ColorRED, 127));
14 canvas->drawCircle(125, 125, 75, transRed);
15 canvas->restore();
16}
17} // END FIDDLE
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
Definition: SkColor.h:82
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
REG_FIDDLE(Src, 256, 256, false, 3)
Definition: Src.cpp:4
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setBlendMode(SkBlendMode mode)
Definition: SkPaint.cpp:151
sk_sp< const SkImage > image
Definition: SkRecords.h:269