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

Public Member Functions

 ArcsSlide ()
 
void load (SkScalar w, SkScalar h) override
 
void draw (SkCanvas *canvas) override
 
bool animate (double nanos) 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 29 of file ArcSlide.cpp.

Constructor & Destructor Documentation

◆ ArcsSlide()

ArcsSlide::ArcsSlide ( )
inline

Definition at line 150 of file ArcSlide.cpp.

150{ fName = "Arcs"; }
SkString fName
Definition: Slide.h:54

Member Function Documentation

◆ animate()

bool ArcsSlide::animate ( double  nanos)
inlineoverridevirtual

Reimplemented from Slide.

Definition at line 165 of file ArcSlide.cpp.

165 {
166 SkScalar angle = SkDoubleToScalar(fmod(1e-9 * nanos * 360 / 24, 360));
167 if (fAnimatingDrawable) {
168 fAnimatingDrawable->setSweep(angle);
169 }
170 return true;
171 }
#define SkDoubleToScalar(x)
Definition: SkScalar.h:64
float SkScalar
Definition: extension.cpp:12

◆ draw()

void ArcsSlide::draw ( SkCanvas canvas)
inlineoverridevirtual

Implements Slide.

Definition at line 160 of file ArcSlide.cpp.

160 {
161 canvas->clear(0xFFDDDDDD);
162 canvas->drawDrawable(fRootDrawable.get());
163 }
void drawDrawable(SkDrawable *drawable, const SkMatrix *matrix=nullptr)
Definition: SkCanvas.cpp:2574
void clear(SkColor color)
Definition: SkCanvas.h:1199
T * get() const
Definition: SkRefCnt.h:303

◆ load()

void ArcsSlide::load ( SkScalar  w,
SkScalar  h 
)
inlineoverridevirtual

Reimplemented from Slide.

Definition at line 152 of file ArcSlide.cpp.

152 {
153 fAnimatingDrawable = sk_make_sp<MyDrawable>(fRect);
154
155 SkPictureRecorder recorder;
156 this->drawRoot(recorder.beginRecording(SkRect::MakeWH(800, 500)));
157 fRootDrawable = recorder.finishRecordingAsDrawable();
158 }
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkDrawable > finishRecordingAsDrawable()
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

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