#include <filter_input.h>
Public Types | |
using | Ref = std::shared_ptr< FilterInput > |
using | Vector = std::vector< FilterInput::Ref > |
using | Variant = std::variant< std::shared_ptr< FilterContents >, std::shared_ptr< Contents >, std::shared_ptr< Texture >, Rect > |
Public Member Functions | |
virtual | ~FilterInput () |
virtual std::optional< Snapshot > | GetSnapshot (std::string_view label, const ContentContext &renderer, const Entity &entity, std::optional< Rect > coverage_limit=std::nullopt, int32_t mip_count=1) const =0 |
std::optional< Rect > | GetLocalCoverage (const Entity &entity) const |
virtual std::optional< Rect > | GetCoverage (const Entity &entity) const =0 |
virtual std::optional< Rect > | GetSourceCoverage (const Matrix &effect_transform, const Rect &output_limit) const |
virtual Matrix | GetLocalTransform (const Entity &entity) const |
Get the local transform of this filter input. This transform is relative to the Entity transform space. More... | |
virtual Matrix | GetTransform (const Entity &entity) const |
Get the transform of this FilterInput . This is equivalent to calling entity.GetTransform() * GetLocalTransform() . More... | |
virtual void | SetEffectTransform (const Matrix &matrix) |
Sets the effect transform of filter inputs. More... | |
virtual void | SetRenderingMode (Entity::RenderingMode rendering_mode) |
Turns on subpass mode for filter inputs. More... | |
Static Public Member Functions | |
static FilterInput::Ref | Make (Variant input, bool msaa_enabled=true) |
static FilterInput::Ref | Make (std::shared_ptr< Texture > input, Matrix local_transform) |
static FilterInput::Vector | Make (std::initializer_list< Variant > inputs) |
FilterInput
is a lazy/single eval Snapshot
which may be shared across filter parameters and used to evaluate input coverage.
A FilterInput
can be re-used for any filter inputs across an entity's filter graph without repeating subpasses unnecessarily.
Filters may decide to not evaluate inputs in situations where they won't contribute to the filter's output texture.
Definition at line 30 of file filter_input.h.
using impeller::FilterInput::Ref = std::shared_ptr<FilterInput> |
Definition at line 32 of file filter_input.h.
using impeller::FilterInput::Variant = std::variant<std::shared_ptr<FilterContents>, std::shared_ptr<Contents>, std::shared_ptr<Texture>, Rect> |
Definition at line 34 of file filter_input.h.
using impeller::FilterInput::Vector = std::vector<FilterInput::Ref> |
Definition at line 33 of file filter_input.h.
|
virtualdefault |
|
pure virtual |
Implemented in impeller::TextureFilterInput, impeller::PlaceholderFilterInput, impeller::FilterContentsFilterInput, and impeller::ContentsFilterInput.
Referenced by GetLocalCoverage().
Definition at line 63 of file filter_input.cc.
References impeller::Entity::Clone(), GetCoverage(), GetLocalTransform(), and impeller::Entity::SetTransform().
Get the local transform of this filter input. This transform is relative to the Entity
transform space.
Reimplemented in impeller::TextureFilterInput, and impeller::FilterContentsFilterInput.
Definition at line 59 of file filter_input.cc.
Referenced by GetLocalCoverage(), and GetTransform().
|
pure virtual |
Evaluates the filter input and returns a snapshot of the result.
This method renders the input (which could be another filter, contents, or a texture) into a Snapshot
object, which contains the resulting texture and its transform relative to the current render target.
Implementations are typically lazy and may cache the result, ensuring that the input is only rendered once even if GetSnapshot
is called multiple times.
[in] | label | A debug label for the rendering operation and the resulting snapshot texture. |
[in] | renderer | The content context providing rendering resources. |
[in] | entity | The entity associated with this filter input, providing transform and other contextual information. |
[in] | coverage_limit | An optional rectangle to limit the area of the input that needs to be rendered. This can be used as an optimization. |
[in] | mip_count | The number of mip levels to generate for the snapshot texture. Defaults to 1 (no mips). |
Snapshot
containing the rendered texture and its transform, or std::nullopt
if the input cannot be rendered or results in an empty output. Implemented in impeller::PlaceholderFilterInput, impeller::TextureFilterInput, impeller::FilterContentsFilterInput, and impeller::ContentsFilterInput.
|
virtual |
Reimplemented in impeller::FilterContentsFilterInput.
Definition at line 69 of file filter_input.cc.
Get the transform of this FilterInput
. This is equivalent to calling entity.GetTransform() * GetLocalTransform()
.
Reimplemented in impeller::FilterContentsFilterInput.
Definition at line 75 of file filter_input.cc.
References GetLocalTransform(), and impeller::Entity::GetTransform().
|
static |
Definition at line 50 of file filter_input.cc.
References Make().
|
static |
Definition at line 44 of file filter_input.cc.
|
static |
Definition at line 19 of file filter_input.cc.
Referenced by impeller::Paint::CreateContents(), Make(), impeller::ColorFilterContents::MakeBlend(), impeller::FilterContents::MakeMorphology(), impeller::FilterContents::MakeYUVToRGBFilter(), impeller::Canvas::Restore(), impeller::Canvas::SaveLayer(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::Paint::WithImageFilter(), impeller::Paint::WithMaskBlur(), and impeller::WrapInput().
|
virtual |
Sets the effect transform of filter inputs.
Reimplemented in impeller::FilterContentsFilterInput.
Definition at line 81 of file filter_input.cc.
|
virtual |
Turns on subpass mode for filter inputs.
Reimplemented in impeller::FilterContentsFilterInput.
Definition at line 83 of file filter_input.cc.