| Flutter Impeller |

Public Member Functions | List of all members
impeller::EllipsePathSource Class Reference

A PathSource object that provides path iteration for any ellipse inscribed within a Rect bounds. More...

`#include <path_source.h>`

Inheritance diagram for impeller::EllipsePathSource:

## Public Member Functions
| EllipsePathSource (const Rect &bounds)
| ~EllipsePathSource ()
FillType | GetFillType () const override
Rect | GetBounds () const override
bool | IsConvex () const override
void | Dispatch (PathReceiver &receiver) const override
Public Member Functions inherited from impeller::PathSource
virtual | ~PathSource ()=default

## Detailed Description

A PathSource object that provides path iteration for any ellipse inscribed within a Rect bounds.

Definition at line 90 of file path_source.h.

## Constructor & Destructor Documentation

## ◆ EllipsePathSource()

impeller::EllipsePathSource::EllipsePathSource | ( | const Rect & | bounds | ) |
| explicit

Definition at line 32 of file path_source.cc.

32 : bounds_(bounds) {}

## ◆ ~EllipsePathSource()

impeller::EllipsePathSource::~EllipsePathSource | ( |  | ) |
| default

## Member Function Documentation

## ◆ Dispatch()

void impeller::EllipsePathSource::Dispatch | ( | PathReceiver & | receiver | ) | const
| override virtual

Implements impeller::PathSource.

Definition at line 48 of file path_source.cc.

48 {
49 Scalar left = bounds_.GetLeft();
50 Scalar right = bounds_.GetRight();
51 Scalar top = bounds_.GetTop();
52 Scalar bottom = bounds_.GetBottom();
53 Point center = bounds_.GetCenter();
54
55 receiver.MoveTo(Point(left, center.y), true);
56 receiver.ConicTo(Point(left, top), Point(center.x, top), kSqrt2Over2);
57 receiver.ConicTo(Point(right, top), Point(right, center.y), kSqrt2Over2);
58 receiver.ConicTo(Point(right, bottom), Point(center.x, bottom), kSqrt2Over2);
59 receiver.ConicTo(Point(left, bottom), Point(left, center.y), kSqrt2Over2);
60
61 receiver.Close();
62 }
impeller::Scalar
float Scalar
Definition: scalar.h:19
impeller::kSqrt2Over2
constexpr float kSqrt2Over2
Definition: constants.h:51
impeller::Point
TPoint< Scalar > Point
Definition: point.h:327
impeller::TRect::GetBottom
constexpr auto GetBottom() const
Definition: rect.h:361
impeller::TRect::GetTop
constexpr auto GetTop() const
Definition: rect.h:357
impeller::TRect::GetLeft
constexpr auto GetLeft() const
Definition: rect.h:355
impeller::TRect::GetRight
constexpr auto GetRight() const
Definition: rect.h:359
impeller::TRect::GetCenter
constexpr Point GetCenter() const
Get the center point as a |Point|.
Definition: rect.h:386

References impeller::PathReceiver::Close(), impeller::PathReceiver::ConicTo(), impeller::TRect< T >::GetBottom(), impeller::TRect< T >::GetCenter(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetTop(), impeller::kSqrt2Over2, impeller::PathReceiver::MoveTo(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## ◆ GetBounds()

Rect impeller::EllipsePathSource::GetBounds | ( |  | ) | const
| override virtual

Implements impeller::PathSource.

Definition at line 40 of file path_source.cc.

40 {
41 return bounds_;
42 }

Referenced by impeller::testing::TEST().

## ◆ GetFillType()

FillType impeller::EllipsePathSource::GetFillType | ( |  | ) | const
| override virtual

Implements impeller::PathSource.

Definition at line 36 of file path_source.cc.

36 {
37 return FillType::kNonZero;
38 }
impeller::FillType::kNonZero
@ kNonZero

References impeller::kNonZero.

Referenced by impeller::testing::TEST().

## ◆ IsConvex()

bool impeller::EllipsePathSource::IsConvex | ( |  | ) | const
| override virtual

Implements impeller::PathSource.

Definition at line 44 of file path_source.cc.

44 {
45 return true;
46 }

Referenced by impeller::testing::TEST().

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

- impeller/geometry/path_source.h
- impeller/geometry/path_source.cc