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

Public Member Functions

 StringArtSlide ()
 
void load (SkScalar w, SkScalar h) override
 
void resize (SkScalar w, SkScalar h) override
 
void draw (SkCanvas *canvas) override
 
- Public Member Functions inherited from ClickHandlerSlide
bool onMouse (SkScalar x, SkScalar y, skui::InputState clickState, skui::ModifierKey modifierKeys) final
 
- 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
 

Protected Member Functions

ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey) override
 
bool onClick (ClickHandlerSlide::Click *) override
 
virtual ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey modi)=0
 
virtual bool onClick (Click *)=0
 

Additional Inherited Members

- Protected Attributes inherited from Slide
SkString fName
 

Detailed Description

Definition at line 18 of file StringArtSlide.cpp.

Constructor & Destructor Documentation

◆ StringArtSlide()

StringArtSlide::StringArtSlide ( )
inline

Definition at line 20 of file StringArtSlide.cpp.

20: fAngle(0.305f) { fName = "StringArt"; }
SkString fName
Definition: Slide.h:54

Member Function Documentation

◆ draw()

void StringArtSlide::draw ( SkCanvas canvas)
inlineoverridevirtual

Implements Slide.

Definition at line 26 of file StringArtSlide.cpp.

26 {
28
29 SkPoint center = SkPoint::Make(fSize.width()/2, fSize.height()/2);
30 SkScalar length = 5;
31 SkScalar step = angle;
32
34 path.moveTo(center);
35
36 while (length < (std::min(fSize.width(), fSize.height())/2 - 10.f))
37 {
40 path.lineTo(rp);
42 step += angle;
43 }
44 path.close();
45
47 paint.setAntiAlias(true);
49 paint.setColor(0xFF007700);
50
51 canvas->drawPath(path, paint);
52 }
static int step(int x, SkScalar min, SkScalar max)
Definition: BlurTest.cpp:215
#define SkScalarSin(radians)
Definition: SkScalar.h:45
#define SkScalarHalf(a)
Definition: SkScalar.h:75
#define SkScalarCos(radians)
Definition: SkScalar.h:46
#define SK_ScalarPI
Definition: SkScalar.h:21
static SkScalar center(float pos0, float pos1)
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
static float min(float r, float g, float b)
Definition: hsl.cpp:48
size_t length
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
SkScalar width() const
Definition: SkSize.h:76
SkScalar height() const
Definition: SkSize.h:77

◆ load()

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

Reimplemented from Slide.

Definition at line 22 of file StringArtSlide.cpp.

22{ fSize = {w, h}; }
SkScalar w
SkScalar h

◆ onClick()

bool StringArtSlide::onClick ( ClickHandlerSlide::Click )
inlineoverrideprotectedvirtual

Override to track clicks. Return true as long as you want to track the pen/mouse.

Implements ClickHandlerSlide.

Definition at line 60 of file StringArtSlide.cpp.

60{ return false; }

◆ onFindClickHandler()

Click * StringArtSlide::onFindClickHandler ( SkScalar  x,
SkScalar  y,
skui::ModifierKey  modi 
)
inlineoverrideprotectedvirtual

Return a Click object to handle the click. onClick will be called repeatedly with the latest mouse state tracked on the Click object until it returns false.

Implements ClickHandlerSlide.

Definition at line 55 of file StringArtSlide.cpp.

55 {
56 fAngle = x/fSize.width();
57 return nullptr;
58 }
double x

◆ resize()

void StringArtSlide::resize ( SkScalar  w,
SkScalar  h 
)
inlineoverridevirtual

Reimplemented from Slide.

Definition at line 24 of file StringArtSlide.cpp.

24{ fSize = {w, h}; }

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