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

Go to the source code of this file.

Functions

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

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_kInitWithPrevious_SaveLayerFlag  ,
256  ,
160  ,
false  ,
 
)

Definition at line 4 of file Canvas_kInitWithPrevious_SaveLayerFlag.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 SkPaint redPaint, bluePaint, scalePaint;
7 redPaint.setColor(SK_ColorRED);
8 canvas->drawCircle(21, 21, 8, redPaint);
9 bluePaint.setColor(SK_ColorBLUE);
10 canvas->drawCircle(31, 21, 8, bluePaint);
12 matrix.setScale(4, 4);
13 scalePaint.setAlpha(0x40);
14 scalePaint.setImageFilter(
16 SkCanvas::SaveLayerRec saveLayerRec(nullptr, &scalePaint,
18 canvas->saveLayer(saveLayerRec);
19 canvas->restore();
20}
21} // 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
@ kInitWithPrevious_SaveLayerFlag
initializes with previous contents
Definition: SkCanvas.h:672
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 setImageFilter(sk_sp< SkImageFilter > imageFilter)
void setAlpha(U8CPU a)
Definition: SkPaint.h:279
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
SkSamplingOptions(SkFilterMode::kLinear))