Flutter Engine
The Flutter Engine
Canvas_saveLayer_2.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(Canvas_saveLayer_2, 256, 128, false, 0) {
6
7void draw(SkCanvas* canvas) {
8 SkPaint paint, blur;
9 blur.setImageFilter(SkImageFilters::Blur(3, 3, nullptr));
10 canvas->saveLayer(SkRect::MakeWH(90, 90), &blur);
11 SkRect rect = { 25, 25, 50, 50};
12 canvas->drawRect(rect, paint);
13 canvas->translate(50, 50);
14 paint.setColor(SK_ColorRED);
15 canvas->drawRect(rect, paint);
16 canvas->restore();
17}
18} // END FIDDLE
REG_FIDDLE(Canvas_saveLayer_2, 256, 128, false, 0)
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
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 drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609