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

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_SaveLayerRec, 256, 160, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_SaveLayerRec  ,
256  ,
160  ,
false  ,
 
)

Definition at line 4 of file Canvas_SaveLayerRec.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 SkPaint redPaint, bluePaint;
7 redPaint.setAntiAlias(true);
8 redPaint.setColor(SK_ColorRED);
9 canvas->drawCircle(21, 21, 8, redPaint);
10 bluePaint.setColor(SK_ColorBLUE);
11 canvas->drawCircle(31, 21, 8, bluePaint);
13 matrix.setScale(4, 4);
15 SkCanvas::SaveLayerRec saveLayerRec(nullptr, nullptr, scaler.get(), 0);
16 canvas->saveLayer(saveLayerRec);
17 canvas->drawCircle(125, 85, 8, redPaint);
18 canvas->restore();
19}
20} // END FIDDLE
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
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 restore()
Definition: SkCanvas.cpp:461
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
static sk_sp< SkImageFilter > MatrixTransform(const SkMatrix &matrix, const SkSamplingOptions &sampling, sk_sp< SkImageFilter > input)
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
SkSamplingOptions(SkFilterMode::kLinear))