| Flutter Impeller |

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

`#include <shadow_path_geometry.h>`

## Public Member Functions
| ShadowPathGeometry (Tessellator &tessellator, const Matrix &matrix, const PathSource &source, Scalar occluder_height)
bool | CanRender () const
bool | IsEmpty () const
| Returns true if this shadow has no effect, is not visible. More...
const std::shared_ptr< ShadowVertices > & | GetShadowVertices () const
const std::shared_ptr< ShadowVertices > | TakeShadowVertices ()

## Static Public Member Functions
static std::shared_ptr< ShadowVertices > | MakeAmbientShadowVertices (Tessellator &tessellator, const PathSource &source, Scalar occluder_height, const Matrix &matrix)

## Detailed Description

A class to compute and return the |ShadowVertices| for a path source viewed under a given transform. The |occluder_height| is measured in device pixels. The geometry of the |PathSource| is transformed by the indicated matrix to produce a device space set of vertices, and the shadow mesh is inset and outset by the indicated |occluder_height| without any adjustment for the matrix. The results are un-transformed and returned back iin the |ShadowVertices| in the original coordinate system.

Definition at line 80 of file shadow_path_geometry.h.

## Constructor & Destructor Documentation

## ◆ ShadowPathGeometry()

impeller::ShadowPathGeometry::ShadowPathGeometry | ( | Tessellator & | tessellator,
|  | const Matrix & | matrix,
|  | const PathSource & | source,
|  | Scalar | occluder_height
| ) |  |

Definition at line 1392 of file shadow_path_geometry.cc.

1396 : shadow_vertices_(MakeAmbientShadowVertices(tessellator,
1397 source,
1398 occluder_height,
1399 matrix)) {}
impeller::ShadowPathGeometry::MakeAmbientShadowVertices
static std::shared_ptr< ShadowVertices > MakeAmbientShadowVertices(Tessellator &tessellator, const PathSource &source, Scalar occluder_height, const Matrix &matrix)
Definition: shadow_path_geometry.cc:1457

## Member Function Documentation

## ◆ CanRender()

bool impeller::ShadowPathGeometry::CanRender | ( |  | ) | const

Definition at line 1401 of file shadow_path_geometry.cc.

1401 {
1402 return shadow_vertices_ != nullptr;
1403 }

## ◆ GetShadowVertices()

const std::shared_ptr< ShadowVertices > & impeller::ShadowPathGeometry::GetShadowVertices | ( |  | ) | const

Returns a reference to the generated vertices, or null if the algorithm failed to produce a mesh.

Definition at line 1409 of file shadow_path_geometry.cc.

1410 {
1411 return shadow_vertices_;
1412 }

## ◆ IsEmpty()

bool impeller::ShadowPathGeometry::IsEmpty | ( |  | ) | const

Returns true if this shadow has no effect, is not visible.

Definition at line 1405 of file shadow_path_geometry.cc.

1405 {
1406 return shadow_vertices_ != nullptr && shadow_vertices_->IsEmpty();
1407 }

## ◆ MakeAmbientShadowVertices()

std::shared_ptr< ShadowVertices > impeller::ShadowPathGeometry::MakeAmbientShadowVertices | ( | Tessellator & | tessellator,
|  | const PathSource & | source,
|  | Scalar | occluder_height,
|  | const Matrix & | matrix
| ) |  |
| static

Constructs a shadow mesh for the given |PathSource| at the given |matrix| and with the indicated device-space |occluder_height|. The tessellator is used to get a cached set of |Trigs| for the radii associated with the mesh around various corners in the path.

Definition at line 1457 of file shadow_path_geometry.cc.

1461 {
1462 Scalar trig_radius = PolygonInfo::GetTrigRadiusForHeight(occluder_height);
1463 Tessellator::Trigs trigs = tessellator.GetTrigsForDeviceRadius(trig_radius);
1464
1465 PolygonInfo polygon(occluder_height);
1466
1467 return polygon.CalculateConvexShadowMesh(source, matrix, trigs);
1468 }
impeller::Scalar
float Scalar
Definition: scalar.h:19

References impeller::Tessellator::GetTrigsForDeviceRadius().

Referenced by impeller::BM_ShadowPathVerticesImpeller(), and impeller::testing::TEST().

## ◆ TakeShadowVertices()

const std::shared_ptr< ShadowVertices > impeller::ShadowPathGeometry::TakeShadowVertices | ( |  | ) |

Takes (returns the only copy of via std::move) the shadow vertices or null if the algorithm failed to produce a mesh.

Definition at line 1414 of file shadow_path_geometry.cc.

1414 {
1415 return std::move(shadow_vertices_);
1416 }

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

- impeller/entity/geometry/shadow_path_geometry.h
- impeller/entity/geometry/shadow_path_geometry.cc