Flutter Engine
 
Loading...
Searching...
No Matches
impeller::ArcStrokeGeometry Class Referencefinal

A Geometry that produces fillable vertices representing the stroked outline of an |Arc| object using the base class |StrokeSegmentsGeometry| and utilizing the special |RecordArc| extension method provided by the |PathAndArcSegmentReceiver|. More...

#include <stroke_path_geometry.h>

Inheritance diagram for impeller::ArcStrokeGeometry:
impeller::StrokeSegmentsGeometry impeller::Geometry

Public Member Functions

 ArcStrokeGeometry (const Arc &arc, const StrokeParameters &parameters)
 
- Public Member Functions inherited from impeller::StrokeSegmentsGeometry
 ~StrokeSegmentsGeometry () override
 
Scalar GetStrokeWidth () const
 
Scalar GetMiterLimit () const
 
Cap GetStrokeCap () const
 
Join GetStrokeJoin () const
 
Scalar ComputeAlphaCoverage (const Matrix &transform) const override
 
- Public Member Functions inherited from impeller::Geometry
virtual ~Geometry ()
 
virtual bool CoversArea (const Matrix &transform, const Rect &rect) const
 Determines if this geometry, transformed by the given transform, will completely cover all surface area of the given rect.
 
virtual bool IsAxisAlignedRect () const
 
virtual bool CanApplyMaskFilter () const
 

Protected Member Functions

std::optional< RectGetCoverage (const Matrix &transform) const override
 
void Dispatch (PathAndArcSegmentReceiver &receiver, Tessellator &tessellator, Scalar scale) const override
 
- Protected Member Functions inherited from impeller::StrokeSegmentsGeometry
 StrokeSegmentsGeometry (const StrokeParameters &parameters)
 
std::optional< RectGetStrokeCoverage (const Matrix &transform, const Rect &segment_bounds) const
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::Geometry
static std::unique_ptr< GeometryMakeFillPath (const flutter::DlPath &path, std::optional< Rect > inner_rect=std::nullopt)
 
static std::unique_ptr< GeometryMakeStrokePath (const flutter::DlPath &path, const StrokeParameters &stroke={})
 
static std::unique_ptr< GeometryMakeCover ()
 
static std::unique_ptr< GeometryMakeRect (const Rect &rect)
 
static std::unique_ptr< GeometryMakeOval (const Rect &rect)
 
static std::unique_ptr< GeometryMakeLine (const Point &p0, const Point &p1, const StrokeParameters &stroke)
 
static std::unique_ptr< GeometryMakeCircle (const Point &center, Scalar radius)
 
static std::unique_ptr< GeometryMakeStrokedCircle (const Point &center, Scalar radius, Scalar stroke_width)
 
static std::unique_ptr< GeometryMakeFilledArc (const Rect &oval_bounds, Degrees start, Degrees sweep, bool include_center)
 
static std::unique_ptr< GeometryMakeStrokedArc (const Rect &oval_bounds, Degrees start, Degrees sweep, const StrokeParameters &stroke)
 
static std::unique_ptr< GeometryMakeRoundRect (const Rect &rect, const Size &radii)
 
static std::unique_ptr< GeometryMakeRoundSuperellipse (const Rect &rect, Scalar corner_radius)
 
static Scalar ComputeStrokeAlphaCoverage (const Matrix &entity, Scalar stroke_width)
 Compute an alpha value to simulate lower coverage of fractional pixel strokes.
 
static GeometryResult ComputePositionGeometry (const ContentContext &renderer, const Tessellator::VertexGenerator &generator, const Entity &entity, RenderPass &pass)
 

Detailed Description

A Geometry that produces fillable vertices representing the stroked outline of an |Arc| object using the base class |StrokeSegmentsGeometry| and utilizing the special |RecordArc| extension method provided by the |PathAndArcSegmentReceiver|.

Definition at line 132 of file stroke_path_geometry.h.

Constructor & Destructor Documentation

◆ ArcStrokeGeometry()

impeller::ArcStrokeGeometry::ArcStrokeGeometry ( const Arc arc,
const StrokeParameters parameters 
)

Definition at line 862 of file stroke_path_geometry.cc.

864 : StrokeSegmentsGeometry(parameters), arc_(arc) {}
StrokeSegmentsGeometry(const StrokeParameters &parameters)

Member Function Documentation

◆ Dispatch()

void impeller::ArcStrokeGeometry::Dispatch ( PathAndArcSegmentReceiver receiver,
Tessellator tessellator,
Scalar  scale 
) const
overrideprotectedvirtual

Dispatch the path segments to the StrokePathSegmentReceiver for the provided transform scale.

Implements impeller::StrokeSegmentsGeometry.

Definition at line 871 of file stroke_path_geometry.cc.

873 {
874 Point center = arc_.GetOvalCenter();
875 Size radii = arc_.GetOvalSize() * 0.5f;
876
877 auto trigs =
878 tessellator.GetTrigsForDeviceRadius(scale * radii.MaxDimension());
879 Arc::Iteration iterator =
880 arc_.ComputeIterations(trigs.GetSteps(), /*simplify_360=*/false);
881 Point start = center + iterator.start * radii;
882 bool include_center = arc_.IncludeCenter();
883
884 receiver.BeginContour(start, include_center);
885 receiver.RecordArc(arc_, center, radii);
886 if (include_center) {
887 Point end = center + iterator.end * radii;
888 receiver.RecordLine(end, center);
889 receiver.RecordLine(center, start);
890 }
891 receiver.EndContour(start, include_center);
892}
TPoint< Scalar > Point
Definition point.h:327
TSize< Scalar > Size
Definition size.h:159
Iteration ComputeIterations(size_t step_count, bool simplify_360=true) const
Definition arc.cc:102
constexpr bool IncludeCenter() const
Definition arc.h:110
const Size GetOvalSize() const
Returns the size of the oval bounds.
Definition arc.h:100
const Point GetOvalCenter() const
Returns the center of the oval bounds.
Definition arc.h:97
const size_t start
const size_t end

References impeller::PathTessellator::SegmentReceiver::BeginContour(), impeller::Arc::ComputeIterations(), impeller::Arc::Iteration::end, end, impeller::PathTessellator::SegmentReceiver::EndContour(), impeller::Arc::GetOvalCenter(), impeller::Arc::GetOvalSize(), impeller::Tessellator::GetTrigsForDeviceRadius(), impeller::Arc::IncludeCenter(), impeller::TSize< T >::MaxDimension(), impeller::PathAndArcSegmentReceiver::RecordArc(), impeller::PathTessellator::SegmentReceiver::RecordLine(), impeller::Arc::Iteration::start, and start.

◆ GetCoverage()

std::optional< Rect > impeller::ArcStrokeGeometry::GetCoverage ( const Matrix transform) const
overrideprotectedvirtual

Implements impeller::Geometry.

Definition at line 866 of file stroke_path_geometry.cc.

867 {
869}
std::optional< Rect > GetStrokeCoverage(const Matrix &transform, const Rect &segment_bounds) const
Rect GetTightArcBounds() const
Definition arc.cc:59

References impeller::StrokeSegmentsGeometry::GetStrokeCoverage(), impeller::Arc::GetTightArcBounds(), and transform.


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