Flutter Engine
The Flutter Engine
Functions
Canvas_saveLayer_2.cpp File Reference
#include "tools/fiddle/examples.h"
#include "include/effects/SkImageFilters.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_saveLayer_2, 256, 128, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_saveLayer_2  ,
256  ,
128  ,
false  ,
 
)

Definition at line 4 of file Canvas_saveLayer_2.cpp.

4 {
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
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