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

Public Member Functions

 HalfPlaneSlide ()
 
void load (SkScalar w, SkScalar h) override
 
void draw (SkCanvas *canvas) override
 
ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey modi) override
 
bool onClick (Click *click) 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
 

Additional Inherited Members

virtual ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey modi)=0
 
virtual bool onClick (Click *)=0
 
- Protected Attributes inherited from Slide
SkString fName
 

Detailed Description

Definition at line 304 of file ClipSlide.cpp.

Constructor & Destructor Documentation

◆ HalfPlaneSlide()

HalfPlaneSlide::HalfPlaneSlide ( )
inline

Definition at line 309 of file ClipSlide.cpp.

309{ fName = "halfplane"; }
SkString fName
Definition: Slide.h:54

Member Function Documentation

◆ draw()

void HalfPlaneSlide::draw ( SkCanvas canvas)
inlineoverridevirtual

Implements Slide.

Definition at line 317 of file ClipSlide.cpp.

317 {
319
320 paint.setColor({0.5f, 0.5f, 0.5f, 1.0f}, nullptr);
321 canvas->drawPath(fPath, paint);
322
323 paint.setColor({0, 0, 0, 1}, nullptr);
324
325 canvas->drawPath(clip(fPath, fPts[0], fPts[1]), paint);
326
327 draw_halfplane(canvas, fPts[0], fPts[1], SK_ColorRED);
328 }
static void draw_halfplane(SkCanvas *canvas, SkPoint p0, SkPoint p1, SkColor c)
Definition: ClipSlide.cpp:275
static SkPath clip(const SkPath &path, SkPoint p0, SkPoint p1)
Definition: ClipSlide.cpp:216
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
const Paint & paint
Definition: color_source.cc:38

◆ load()

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

Reimplemented from Slide.

Definition at line 311 of file ClipSlide.cpp.

311 {
312 fPts[0] = {0, 0};
313 fPts[1] = {3, 2};
314 fPath = make_path();
315 }
static SkPath make_path()
Definition: ClipSlide.cpp:285

◆ onClick()

bool HalfPlaneSlide::onClick ( Click )
inlineoverridevirtual

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

Implements ClickHandlerSlide.

Definition at line 334 of file ClipSlide.cpp.

334 {
335 fPts[0] = click->fCurr;
336 fPts[1] = fPts[0] + SkPoint{3, 2};
337 return true;
338 }

◆ onFindClickHandler()

Click * HalfPlaneSlide::onFindClickHandler ( SkScalar  x,
SkScalar  y,
skui::ModifierKey  modi 
)
inlineoverridevirtual

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 330 of file ClipSlide.cpp.

330 {
331 return new Click;
332 }

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