#include <entity.h>
Public Member Functions | |
| Entity () | |
| ~Entity () | |
| Entity (Entity &&) | |
| const Matrix & | GetTransform () const |
| Get the global transform matrix for this Entity. More... | |
| Matrix | GetShaderTransform (const RenderPass &pass) const |
| Get the vertex shader transform used for drawing this Entity. More... | |
| void | SetTransform (const Matrix &transform) |
| Set the global transform matrix for this Entity. More... | |
| std::optional< Rect > | GetCoverage () const |
| Contents::ClipCoverage | GetClipCoverage (const std::optional< Rect > ¤t_clip_coverage) const |
| bool | ShouldRender (const std::optional< Rect > &clip_coverage) const |
| void | SetContents (std::shared_ptr< Contents > contents) |
| const std::shared_ptr< Contents > & | GetContents () const |
| void | SetClipDepth (uint32_t clip_depth) |
| uint32_t | GetClipDepth () const |
| float | GetShaderClipDepth () const |
| void | SetBlendMode (BlendMode blend_mode) |
| BlendMode | GetBlendMode () const |
| bool | Render (const ContentContext &renderer, RenderPass &parent_pass) const |
| bool | CanInheritOpacity () const |
| bool | SetInheritedOpacity (Scalar alpha) |
| std::optional< Color > | AsBackgroundColor (ISize target_size) const |
| Scalar | DeriveTextScale () const |
| Entity | Clone () const |
Static Public Member Functions | |
| static Entity | FromSnapshot (const Snapshot &snapshot, BlendMode blend_mode=BlendMode::kSourceOver) |
| Create an entity that can be used to render a given snapshot. More... | |
| static Matrix | GetShaderTransform (Scalar clip_depth, const RenderPass &pass, const Matrix &transform) |
| Static utility that computes the vertex shader transform used for drawing an Entity with a given the clip depth and RenderPass size. More... | |
| static float | GetShaderClipDepth (uint32_t clip_depth) |
| static bool | IsBlendModeDestructive (BlendMode blend_mode) |
| Returns true if the blend mode is "destructive", meaning that even fully transparent source colors would result in the destination getting changed. More... | |
Static Public Attributes | |
| static constexpr BlendMode | kLastPipelineBlendMode = BlendMode::kModulate |
| static constexpr BlendMode | kLastAdvancedBlendMode = BlendMode::kLuminosity |
| static constexpr Scalar | kDepthEpsilon = 1.0f / 262144.0 |
|
strong |
|
strong |
| Enumerator | |
|---|---|
| kDirect | In direct mode, the Entity's transform is used as the current local-to-screen transform matrix. |
| kSubpassAppendSnapshotTransform | In subpass mode, the Entity passed through the filter is in screen space rather than local space, and so some filters (namely, MatrixFilterContents) need to interpret the given EffectTransform as the current transform matrix. |
| kSubpassPrependSnapshotTransform | |
Definition at line 27 of file entity.h.
|
strong |
An enum to define how to repeat, fold, or omit colors outside of the typically defined range of the source of the colors (such as the bounds of an image or the defining geometry of a gradient).
Definition at line 42 of file entity.h.
|
default |
Referenced by Clone().
|
default |
|
default |
| bool impeller::Entity::CanInheritOpacity | ( | ) | const |
Definition at line 123 of file entity.cc.
References impeller::kSource, and impeller::kSourceOver.
Referenced by SetInheritedOpacity().
| Entity impeller::Entity::Clone | ( | ) | const |
Definition at line 191 of file entity.cc.
References Entity().
Referenced by impeller::ColorSourceContents::DrawGeometry(), impeller::FilterContents::GetCoverage(), impeller::FilterContents::GetEntity(), impeller::FilterInput::GetLocalCoverage(), impeller::EntityPassClipStack::RecordEntity(), and impeller::testing::TEST_P().
| Scalar impeller::Entity::DeriveTextScale | ( | ) | const |
Definition at line 187 of file entity.cc.
References impeller::Matrix::GetMaxBasisLengthXY(), and GetTransform().
|
static |
Create an entity that can be used to render a given snapshot.
Definition at line 22 of file entity.cc.
References impeller::TextureContents::MakeRect(), impeller::TRect< Scalar >::MakeSize(), impeller::Snapshot::opacity, impeller::Snapshot::sampler_descriptor, SetBlendMode(), SetContents(), SetTransform(), impeller::Snapshot::texture, and impeller::Snapshot::transform.
Referenced by impeller::AdvancedBlend(), and impeller::PipelineBlend().
| BlendMode impeller::Entity::GetBlendMode | ( | ) | const |
Definition at line 119 of file entity.cc.
Referenced by impeller::EntityPass::AddEntity(), impeller::AdvancedBlend(), impeller::ColorSourceContents::DrawGeometry(), impeller::OptionsFromPassAndEntity(), impeller::PipelineBlend(), impeller::SolidRRectBlurContents::Render(), impeller::ExperimentalCanvas::Restore(), and impeller::testing::TEST_P().
| Contents::ClipCoverage impeller::Entity::GetClipCoverage | ( | const std::optional< Rect > & | current_clip_coverage | ) | const |
| uint32_t impeller::Entity::GetClipDepth | ( | ) | const |
Definition at line 102 of file entity.cc.
Referenced by impeller::GetShaderClipDepth(), and impeller::FilterContents::Render().
| const std::shared_ptr< Contents > & impeller::Entity::GetContents | ( | ) | const |
Definition at line 94 of file entity.cc.
Referenced by impeller::EntityPass::AddEntity(), impeller::AdvancedBlend(), impeller::EntityPassClipStack::ApplyClipState(), impeller::testing::GetCoverageOfFirstEntity(), impeller::ContentsFilterInput::GetSnapshot(), impeller::PipelineBlend(), impeller::EntityPass::Render(), and impeller::testing::TEST_P().
| std::optional< Rect > impeller::Entity::GetCoverage | ( | ) | const |
| Scalar impeller::Entity::GetShaderClipDepth | ( | ) | const |
Definition at line 106 of file entity.cc.
Referenced by impeller::ColorSourceContents::DrawGeometry(), impeller::GetShaderClipDepth(), GetShaderTransform(), impeller::SolidRRectBlurContents::Render(), and impeller::TextContents::Render().
|
static |
| Matrix impeller::Entity::GetShaderTransform | ( | const RenderPass & | pass | ) | const |
Get the vertex shader transform used for drawing this Entity.
Definition at line 50 of file entity.cc.
References GetShaderClipDepth().
Referenced by impeller::Geometry::ComputePositionGeometry(), impeller::RectGeometry::GetPositionBuffer(), impeller::VerticesGeometry::GetPositionBuffer(), impeller::VerticesGeometry::GetPositionUVColorBuffer(), impeller::SolidRRectBlurContents::Render(), impeller::AtlasContents::Render(), impeller::TextureContents::Render(), and impeller::TextContents::Render().
|
static |
Static utility that computes the vertex shader transform used for drawing an Entity with a given the clip depth and RenderPass size.
Definition at line 54 of file entity.cc.
References impeller::RenderPass::GetOrthographicTransform(), kDepthEpsilon, impeller::Matrix::MakeScale(), impeller::Matrix::MakeTranslation(), and transform.
| const Matrix & impeller::Entity::GetTransform | ( | ) | const |
Get the global transform matrix for this Entity.
Definition at line 46 of file entity.cc.
Referenced by impeller::SolidColorContents::AsBackgroundColor(), impeller::StrokePathGeometry::ComputeAlphaCoverage(), DeriveTextScale(), impeller::ClipContents::GetClipCoverage(), impeller::SolidColorContents::GetCoverage(), impeller::SolidRRectBlurContents::GetCoverage(), impeller::VerticesSimpleBlendContents::GetCoverage(), impeller::AtlasContents::GetCoverage(), impeller::TextureContents::GetCoverage(), impeller::TextContents::GetCoverage(), impeller::ColorSourceContents::GetCoverage(), impeller::FilterContents::GetCoverage(), impeller::FilterContents::GetEntity(), impeller::FilterContentsFilterInput::GetLocalTransform(), impeller::FilterContentsFilterInput::GetTransform(), impeller::FilterInput::GetTransform(), impeller::SceneContents::Render(), impeller::ClipContents::Render(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::TextureContents::RenderToSnapshot(), impeller::Contents::RenderToSnapshot(), and impeller::testing::TEST_P().
|
static |
Returns true if the blend mode is "destructive", meaning that even fully transparent source colors would result in the destination getting changed.
This is useful for determining if EntityPass textures can be shrinkwrapped to their Entities' coverage; they can be shrinkwrapped if all of the contained Entities have non-destructive blends.
Definition at line 156 of file entity.cc.
References impeller::kClear, impeller::kDestinationATop, impeller::kDestinationIn, impeller::kDestinationOut, impeller::kModulate, impeller::kSource, impeller::kSourceIn, impeller::kSourceOut, and impeller::kXor.
Referenced by impeller::EntityPass::SetBlendMode().
| bool impeller::Entity::Render | ( | const ContentContext & | renderer, |
| RenderPass & | parent_pass | ||
| ) | const |
Definition at line 173 of file entity.cc.
References impeller::RenderPass::GetRenderTargetSize(), and impeller::TRect< Scalar >::MakeSize().
Referenced by impeller::ColorSourceContents::DrawGeometry(), impeller::EntityPlayground::OpenPlaygroundHere(), impeller::PipelineBlend(), impeller::EntityPass::Render(), impeller::ExperimentalCanvas::Restore(), impeller::ExperimentalCanvas::SaveLayer(), and impeller::testing::TEST_P().
| void impeller::Entity::SetBlendMode | ( | BlendMode | blend_mode | ) |
Definition at line 115 of file entity.cc.
Referenced by impeller::EntityPass::AddEntity(), impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::ExperimentalCanvas::DrawTextFrame(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), FromSnapshot(), impeller::DlImageImpeller::MakeFromYUVTextures(), impeller::PipelineBlend(), impeller::EntityPass::Render(), impeller::Contents::RenderToSnapshot(), impeller::ExperimentalCanvas::Restore(), impeller::ExperimentalCanvas::SaveLayer(), and impeller::testing::TEST_P().
| void impeller::Entity::SetClipDepth | ( | uint32_t | clip_depth | ) |
Definition at line 98 of file entity.cc.
Referenced by impeller::ExperimentalCanvas::DrawTextFrame(), impeller::EntityPass::PopClips(), impeller::ExperimentalCanvas::Restore(), and impeller::ExperimentalCanvas::SaveLayer().
| void impeller::Entity::SetContents | ( | std::shared_ptr< Contents > | contents | ) |
Definition at line 90 of file entity.cc.
Referenced by impeller::testing::CreatePassWithRectPath(), impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::ExperimentalCanvas::DrawTextFrame(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), FromSnapshot(), impeller::PipelineBlend(), impeller::EntityPass::Render(), impeller::ExperimentalCanvas::Restore(), impeller::ExperimentalCanvas::SaveLayer(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| bool impeller::Entity::SetInheritedOpacity | ( | Scalar | alpha | ) |
Definition at line 134 of file entity.cc.
References CanInheritOpacity(), impeller::kSource, and impeller::kSourceOver.
| void impeller::Entity::SetTransform | ( | const Matrix & | transform | ) |
Set the global transform matrix for this Entity.
Definition at line 62 of file entity.cc.
References transform.
Referenced by impeller::Canvas::DrawAtlas(), impeller::Canvas::DrawCircle(), impeller::Canvas::DrawImageRect(), impeller::Canvas::DrawLine(), impeller::Canvas::DrawOval(), impeller::Canvas::DrawPaint(), impeller::Canvas::DrawPath(), impeller::Canvas::DrawPoints(), impeller::Canvas::DrawRect(), impeller::Canvas::DrawRRect(), impeller::ExperimentalCanvas::DrawTextFrame(), impeller::Canvas::DrawTextFrame(), impeller::Canvas::DrawVertices(), FromSnapshot(), impeller::FilterContents::GetCoverage(), impeller::EntityPass::GetElementsCoverage(), impeller::FilterContents::GetEntity(), impeller::FilterInput::GetLocalCoverage(), impeller::Contents::RenderToSnapshot(), impeller::ExperimentalCanvas::Restore(), impeller::ExperimentalCanvas::SaveLayer(), impeller::testing::TEST(), and impeller::testing::TEST_P().
| bool impeller::Entity::ShouldRender | ( | const std::optional< Rect > & | clip_coverage | ) | const |
|
staticconstexpr |
Definition at line 25 of file entity.h.
Referenced by GetShaderClipDepth(), and GetShaderTransform().
|
staticconstexpr |
Definition at line 23 of file entity.h.
Referenced by impeller::testing::GetBlendModeSelection(), impeller::ColorFilterContents::MakeBlend(), and impeller::BlendFilterContents::SetBlendMode().
|
staticconstexpr |
Definition at line 22 of file entity.h.
Referenced by impeller::EntityPass::AddEntity(), impeller::EntityPass::AddSubpass(), impeller::ContentContextOptions::ApplyToPipelineDescriptor(), impeller::ColorFilterContents::MakeBlend(), impeller::VerticesSimpleBlendContents::Render(), impeller::RequiresReadbackForBlends(), impeller::ExperimentalCanvas::Restore(), impeller::BlendFilterContents::SetBlendMode(), and impeller::testing::TEST_P().