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

Public Member Functions

 PathClipSlide ()
 
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
 

Public Attributes

SkRect fOval
 
SkPoint fCenter
 

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 24 of file PathClipSlide.cpp.

Constructor & Destructor Documentation

◆ PathClipSlide()

PathClipSlide::PathClipSlide ( )
inline

Definition at line 29 of file PathClipSlide.cpp.

29 : fOval(SkRect::MakeWH(200, 50)), fCenter(SkPoint::Make(250, 250)) {
30 fName = "PathClip";
31 }
SkString fName
Definition: Slide.h:54
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

Member Function Documentation

◆ draw()

void PathClipSlide::draw ( SkCanvas canvas)
inlineoverridevirtual

Implements Slide.

Definition at line 33 of file PathClipSlide.cpp.

33 {
36
37 SkPaint p;
38 p.setAntiAlias(true);
39
40 p.setStyle(SkPaint::kStroke_Style);
41 canvas->drawOval(oval, p);
42
43 const SkRect r = SkRect::MakeLTRB(200, 200, 300, 300);
44 canvas->clipRect(r);
45
46 p.setStyle(SkPaint::kFill_Style);
47 p.setColor(SK_ColorRED);
48 canvas->drawRect(r, p);
49
50 p.setColor(0x800000FF);
51 canvas->drawOval(oval, p);
52 }
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawOval(const SkRect &oval, const SkPaint &paint)
Definition: SkCanvas.cpp:1698
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
SkRect oval
Definition: SkRecords.h:249
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
constexpr SkRect makeOffset(float dx, float dy) const
Definition: SkRect.h:965
constexpr float centerX() const
Definition: SkRect.h:776
constexpr float centerY() const
Definition: SkRect.h:785
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ onClick()

bool PathClipSlide::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 62 of file PathClipSlide.cpp.

62{ return false; }

◆ onFindClickHandler()

Click * PathClipSlide::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 PathClipSlide.cpp.

55 {
56 return new Click([&](Click* c) {
57 fCenter = c->fCurr;
58 return false;
59 });
60 }

Member Data Documentation

◆ fCenter

SkPoint PathClipSlide::fCenter

Definition at line 27 of file PathClipSlide.cpp.

◆ fOval

SkRect PathClipSlide::fOval

Definition at line 26 of file PathClipSlide.cpp.


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