Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
LayersSlide Class Reference
Inheritance diagram for LayersSlide:
Slide SkRefCnt SkRefCntBase

Public Member Functions

 LayersSlide ()
 
void draw (SkCanvas *canvas) override
 
- Public Member Functions inherited from Slide
virtual SkISize getDimensions () const
 
virtual void gpuTeardown ()
 
virtual void draw (SkCanvas *canvas)=0
 
virtual bool animate (double nanos)
 
virtual void load (SkScalar winWidth, SkScalar winHeight)
 
virtual void resize (SkScalar winWidth, SkScalar winHeight)
 
virtual void unload ()
 
virtual bool onChar (SkUnichar c)
 
virtual bool onMouse (SkScalar x, SkScalar y, skui::InputState state, skui::ModifierKey modifiers)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
const SkStringgetName ()
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Protected Attributes inherited from Slide
SkString fName
 

Detailed Description

Definition at line 94 of file LayersSlide.cpp.

Constructor & Destructor Documentation

◆ LayersSlide()

LayersSlide::LayersSlide ( )
inline

Definition at line 96 of file LayersSlide.cpp.

96{ fName = "Layers"; }
SkString fName
Definition: Slide.h:54

Member Function Documentation

◆ draw()

void LayersSlide::draw ( SkCanvas canvas)
inlineoverridevirtual

Implements Slide.

Definition at line 98 of file LayersSlide.cpp.

98 {
99 canvas->drawColor(SK_ColorGRAY);
100
101 if ((true)) {
102 SkRect r;
103 r.setWH(220, 120);
104 SkPaint p;
105 canvas->saveLayer(&r, &p);
106 canvas->drawColor(0xFFFF0000);
107 p.setAlpha(0); // or 0
108 p.setBlendMode(SkBlendMode::kSrc);
109 canvas->drawOval(r, p);
110 canvas->restore();
111 return;
112 }
113
114 if ((false)) {
115 SkRect r;
116 r.setWH(220, 120);
117 SkPaint p;
118 p.setAlpha(0x88);
119 p.setAntiAlias(true);
120
121 if (true) {
122 canvas->saveLayer(&r, &p);
123 p.setColor(0xFFFF0000);
124 canvas->drawOval(r, p);
125 canvas->restore();
126 }
127
128 p.setColor(0xFF0000FF);
130 canvas->drawOval(r, p);
131 }
132
133 if ((false)) {
134 SkPaint p;
135 p.setAlpha(0x88);
136 p.setAntiAlias(true);
137
138 canvas->translate(SkIntToScalar(300), 0);
139
140 SkRect r;
141 r.setWH(220, 60);
142
143 canvas->saveLayer(&r, &p);
144
145 r.setWH(220, 120);
146 p.setColor(SK_ColorBLUE);
147 canvas->drawOval(r, p);
148 canvas->restore();
149 return;
150 }
151
152 test_fade(canvas);
153 }
static void test_fade(SkCanvas *canvas)
Definition: LayersSlide.cpp:34
constexpr SkColor SK_ColorGRAY
Definition: SkColor.h:113
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
#define SkIntToScalar(x)
Definition: SkScalar.h:57
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496
void drawOval(const SkRect &oval, const SkPaint &paint)
Definition: SkCanvas.cpp:1698
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
void setWH(float width, float height)
Definition: SkRect.h:944
void offset(float dx, float dy)
Definition: SkRect.h:1016

The documentation for this class was generated from the following file: