Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
CanvasLinePoint Class Reference
Inheritance diagram for CanvasLinePoint:
MMObject CanvasBezierSegment CanvasQuadraticSegment

Public Member Functions

 CanvasLinePoint (SkRandom *random, SkSize size, SkPoint *prev)
 
 ~CanvasLinePoint () override=default
 
virtual void append (SkPath *path)
 
void draw (SkCanvas *) override
 
void animate (double) override
 
SkColor getColor ()
 
float getWidth ()
 
SkPoint getPoint ()
 
SkPoint getCoord ()
 
bool isSplit ()
 
void toggleIsSplit ()
 
- Public Member Functions inherited from MMObject
virtual ~MMObject ()=default
 
virtual void draw (SkCanvas *canvas)=0
 
virtual void animate (double)=0
 

Protected Member Functions

void setEndPoint (SkRandom *random, SkSize size, SkPoint *prevCoord)
 

Detailed Description

Definition at line 432 of file MotionMarkSlide.cpp.

Constructor & Destructor Documentation

◆ CanvasLinePoint()

CanvasLinePoint::CanvasLinePoint ( SkRandom random,
SkSize  size,
SkPoint prev 
)
inline

Definition at line 460 of file MotionMarkSlide.cpp.

460 {
461 const SkColor kColors[7] = {
462 0xff101010, 0xff808080, 0xffc0c0c0, 0xff101010, 0xff808080, 0xffc0c0c0, 0xffe01040
463 };
464 fColor = kColors[random->nextRangeU(0, 6)];
465
466 fWidth = std::pow(random->nextF(), 5) * 20 + 1;
467 fIsSplit = random->nextBool();
468
469 this->setEndPoint(random, size, prev);
470 }
static float prev(float f)
uint32_t SkColor
Definition: SkColor.h:37
void setEndPoint(SkRandom *random, SkSize size, SkPoint *prevCoord)
float nextF()
Definition: SkRandom.h:55
bool nextBool()
Definition: SkRandom.h:117
uint32_t nextRangeU(uint32_t min, uint32_t max)
Definition: SkRandom.h:80
const DlColor kColors[]
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ ~CanvasLinePoint()

CanvasLinePoint::~CanvasLinePoint ( )
overridedefault

Member Function Documentation

◆ animate()

void CanvasLinePoint::animate ( double  )
inlineoverridevirtual

Implements MMObject.

Definition at line 480 of file MotionMarkSlide.cpp.

480{}

◆ append()

virtual void CanvasLinePoint::append ( SkPath path)
inlinevirtual

Reimplemented in CanvasQuadraticSegment, and CanvasBezierSegment.

Definition at line 474 of file MotionMarkSlide.cpp.

474 {
475 path->lineTo(fPoint);
476 }
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

◆ draw()

void CanvasLinePoint::draw ( SkCanvas )
inlineoverridevirtual

Implements MMObject.

Definition at line 479 of file MotionMarkSlide.cpp.

479{}

◆ getColor()

SkColor CanvasLinePoint::getColor ( )
inline

Definition at line 482 of file MotionMarkSlide.cpp.

482{ return fColor; }

◆ getCoord()

SkPoint CanvasLinePoint::getCoord ( )
inline

Definition at line 485 of file MotionMarkSlide.cpp.

485{ return fCoordinate; }

◆ getPoint()

SkPoint CanvasLinePoint::getPoint ( )
inline

Definition at line 484 of file MotionMarkSlide.cpp.

484{ return fPoint; }

◆ getWidth()

float CanvasLinePoint::getWidth ( )
inline

Definition at line 483 of file MotionMarkSlide.cpp.

483{ return fWidth; }

◆ isSplit()

bool CanvasLinePoint::isSplit ( )
inline

Definition at line 486 of file MotionMarkSlide.cpp.

486{ return fIsSplit; }

◆ setEndPoint()

void CanvasLinePoint::setEndPoint ( SkRandom random,
SkSize  size,
SkPoint prevCoord 
)
inlineprotected

Definition at line 434 of file MotionMarkSlide.cpp.

434 {
435 const SkSize kGridSize = { 80, 40 };
436 const SkPoint kGridCenter = { 40, 20 };
437 const SkPoint kOffsets[4] = {
438 {-4, 0},
439 {2, 0},
440 {1, -2},
441 {1, 2}
442 };
443
444 SkPoint coordinate = prevCoord ? *prevCoord : kGridCenter;
445 if (prevCoord) {
446 SkPoint offset = kOffsets[random->nextRangeU(0, 3)];
447 coordinate += offset;
448 if (coordinate.fX < 0 || coordinate.fX > kGridSize.width())
449 coordinate.fX -= offset.fX * 2;
450 if (coordinate.fY < 0 || coordinate.fY > kGridSize.height())
451 coordinate.fY -= offset.fY * 2;
452 }
453
454 fPoint = SkPoint::Make((coordinate.fX + 0.5f) * size.width() / (kGridSize.width() + 1),
455 (coordinate.fY + 0.5f) * size.height() / (kGridSize.height() + 1));
456 fCoordinate = coordinate;
457 }
SeparatedVector2 offset
float fX
x-axis value
Definition: SkPoint_impl.h:164
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
float fY
y-axis value
Definition: SkPoint_impl.h:165
Definition: SkSize.h:52
SkScalar width() const
Definition: SkSize.h:76
SkScalar height() const
Definition: SkSize.h:77

◆ toggleIsSplit()

void CanvasLinePoint::toggleIsSplit ( )
inline

Definition at line 487 of file MotionMarkSlide.cpp.

487{ fIsSplit = !fIsSplit; }

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