Flutter Impeller
impeller::Geometry Class Referenceabstract

#include <geometry.h>

Inheritance diagram for impeller::Geometry:
impeller::CoverGeometry impeller::FillPathGeometry impeller::PointFieldGeometry impeller::RectGeometry impeller::StrokePathGeometry impeller::VerticesGeometry

Public Member Functions

 Geometry ()
 
virtual ~Geometry ()
 
virtual GeometryResult GetPositionBuffer (const ContentContext &renderer, const Entity &entity, RenderPass &pass)=0
 
virtual GeometryResult GetPositionUVBuffer (Rect texture_coverage, Matrix effect_transform, const ContentContext &renderer, const Entity &entity, RenderPass &pass)
 
virtual GeometryVertexType GetVertexType () const =0
 
virtual std::optional< RectGetCoverage (const Matrix &transform) const =0
 
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. More...
 

Static Public Member Functions

static std::unique_ptr< GeometryMakeFillPath (const Path &path, std::optional< Rect > inner_rect=std::nullopt)
 
static std::unique_ptr< GeometryMakeStrokePath (const Path &path, Scalar stroke_width=0.0, Scalar miter_limit=4.0, Cap stroke_cap=Cap::kButt, Join stroke_join=Join::kMiter)
 
static std::unique_ptr< GeometryMakeCover ()
 
static std::unique_ptr< GeometryMakeRect (Rect rect)
 
static std::unique_ptr< GeometryMakePointField (std::vector< Point > points, Scalar radius, bool round)
 

Detailed Description

Definition at line 54 of file geometry.h.

Constructor & Destructor Documentation

◆ Geometry()

impeller::Geometry::Geometry ( )
default

◆ ~Geometry()

impeller::Geometry::~Geometry ( )
virtualdefault

Member Function Documentation

◆ CoversArea()

bool impeller::Geometry::CoversArea ( const Matrix transform,
const Rect rect 
) const
virtual

Determines if this geometry, transformed by the given transform, will completely cover all surface area of the given rect.

This is a conservative estimate useful for certain optimizations.

Returns
true if the transformed geometry is guaranteed to cover the given rect. May return false in many undetected cases where the transformed geometry does in fact cover the rect.

Reimplemented in impeller::FillPathGeometry, impeller::CoverGeometry, and impeller::RectGeometry.

Definition at line 146 of file geometry.cc.

146  {
147  return false;
148 }

◆ GetCoverage()

virtual std::optional<Rect> impeller::Geometry::GetCoverage ( const Matrix transform) const
pure virtual

Implemented in impeller::VerticesGeometry.

◆ GetPositionBuffer()

virtual GeometryResult impeller::Geometry::GetPositionBuffer ( const ContentContext renderer,
const Entity entity,
RenderPass pass 
)
pure virtual

Implemented in impeller::VerticesGeometry.

◆ GetPositionUVBuffer()

GeometryResult impeller::Geometry::GetPositionUVBuffer ( Rect  texture_coverage,
Matrix  effect_transform,
const ContentContext renderer,
const Entity entity,
RenderPass pass 
)
virtual

Reimplemented in impeller::VerticesGeometry.

Definition at line 105 of file geometry.cc.

109  {
110  return {};
111 }

◆ GetVertexType()

virtual GeometryVertexType impeller::Geometry::GetVertexType ( ) const
pure virtual

Implemented in impeller::VerticesGeometry.

◆ MakeCover()

std::unique_ptr< Geometry > impeller::Geometry::MakeCover ( )
static

Definition at line 138 of file geometry.cc.

138  {
139  return std::make_unique<CoverGeometry>();
140 }

Referenced by impeller::Paint::CreateContentsForEntity(), and impeller::testing::TEST_P().

◆ MakeFillPath()

std::unique_ptr< Geometry > impeller::Geometry::MakeFillPath ( const Path path,
std::optional< Rect inner_rect = std::nullopt 
)
static

◆ MakePointField()

std::unique_ptr< Geometry > impeller::Geometry::MakePointField ( std::vector< Point points,
Scalar  radius,
bool  round 
)
static

Definition at line 119 of file geometry.cc.

121  {
122  return std::make_unique<PointFieldGeometry>(std::move(points), radius, round);
123 }

Referenced by impeller::Canvas::DrawPoints(), and impeller::testing::TEST_P().

◆ MakeRect()

std::unique_ptr< Geometry > impeller::Geometry::MakeRect ( Rect  rect)
static

◆ MakeStrokePath()

std::unique_ptr< Geometry > impeller::Geometry::MakeStrokePath ( const Path path,
Scalar  stroke_width = 0.0,
Scalar  miter_limit = 4.0,
Cap  stroke_cap = Cap::kButt,
Join  stroke_join = Join::kMiter 
)
static

Definition at line 125 of file geometry.cc.

129  {
130  // Skia behaves like this.
131  if (miter_limit < 0) {
132  miter_limit = 4.0;
133  }
134  return std::make_unique<StrokePathGeometry>(path, stroke_width, miter_limit,
135  stroke_cap, stroke_join);
136 }

Referenced by impeller::Paint::CreateContentsForEntity(), and impeller::testing::TEST_P().


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