| Flutter Impeller |

Public Types | Public Member Functions | Static Public Member Functions | List of all members
impeller::FilterInput Class Referenceabstract

`#include <filter_input.h>`

Inheritance diagram for impeller::FilterInput:

## 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 Variant | GetInput () const =0
virtual std::optional< Snapshot > | GetSnapshot (const std::string &label, const ContentContext &renderer, const Entity &entity, std::optional< Rect > coverage_limit=std::nullopt) 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 | PopulateGlyphAtlas (const std::shared_ptr< LazyGlyphAtlas > &lazy_glyph_atlas, Scalar scale)
virtual bool | IsTranslationOnly () const
virtual bool | IsLeaf () const
| Returns `true` unless this input is a `FilterInput`, which may take other inputs. More...
virtual void | SetLeafInputs (const FilterInput::Vector &inputs)
| Replaces the inputs of all leaf `FilterContents` with a new set of `inputs`. 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)

## Detailed Description

`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.

## Member Typedef Documentation

## ◆ Ref

using impeller::FilterInput::Ref = std::shared_ptr<FilterInput>

Definition at line 32 of file filter_input.h.

## ◆ Variant

using impeller::FilterInput::Variant = std::variant<std::shared_ptr<FilterContents>, std::shared_ptr<Contents>, std::shared_ptr<Texture>, Rect>

Definition at line 37 of file filter_input.h.

## ◆ Vector

using impeller::FilterInput::Vector = std::vector<FilterInput::Ref>

Definition at line 33 of file filter_input.h.

## Constructor & Destructor Documentation

## ◆ ~FilterInput()

impeller::FilterInput::~FilterInput | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ GetCoverage()

virtual std::optional<Rect> impeller::FilterInput::GetCoverage | ( | const Entity & | entity | ) | const
| pure virtual

Implemented in impeller::PlaceholderFilterInput, impeller::TextureFilterInput, impeller::ContentsFilterInput, and impeller::FilterContentsFilterInput.

Referenced by GetLocalCoverage().

## ◆ GetInput()

virtual Variant impeller::FilterInput::GetInput | ( |  | ) | const
| pure virtual

Implemented in impeller::PlaceholderFilterInput, impeller::TextureFilterInput, impeller::ContentsFilterInput, and impeller::FilterContentsFilterInput.

## ◆ GetLocalCoverage()

std::optional< Rect > impeller::FilterInput::GetLocalCoverage | ( | const Entity & | entity | ) | const

Definition at line 63 of file filter_input.cc.

63 {
64 Entity local_entity = entity.Clone();
65 local_entity.SetTransform(GetLocalTransform(entity));
66 return GetCoverage(local_entity);
67 }

References impeller::Entity::Clone(), GetCoverage(), GetLocalTransform(), and impeller::Entity::SetTransform().

## ◆ GetLocalTransform()

Matrix impeller::FilterInput::GetLocalTransform | ( | const Entity & | entity | ) | const
| virtual

Get the local transform of this filter input. This transform is relative to the `Entity` transform space.

Reimplemented in impeller::FilterContentsFilterInput, and impeller::TextureFilterInput.

Definition at line 59 of file filter_input.cc.

59 {
60 return Matrix();
61 }

Referenced by GetLocalCoverage(), and GetTransform().

## ◆ GetSnapshot()

virtual std::optional<Snapshot> impeller::FilterInput::GetSnapshot | ( | const std::string & | label,
|  | const ContentContext & | renderer,
|  | const Entity & | entity,
|  | std::optional< Rect > | coverage_limit = `std::nullopt`
| ) |  | const
| pure virtual

Implemented in impeller::PlaceholderFilterInput, impeller::TextureFilterInput, impeller::ContentsFilterInput, and impeller::FilterContentsFilterInput.

## ◆ GetSourceCoverage()

std::optional< Rect > impeller::FilterInput::GetSourceCoverage | ( | const Matrix & | effect_transform,
|  | const Rect & | output_limit
| ) |  | const
| virtual

Reimplemented in impeller::FilterContentsFilterInput.

Definition at line 69 of file filter_input.cc.

71 {
72 return output_limit;
73 }

## ◆ GetTransform()

Matrix impeller::FilterInput::GetTransform | ( | const Entity & | entity | ) | const
| virtual

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.

75 {
76 return entity.GetTransform() * GetLocalTransform(entity);
77 }

References GetLocalTransform(), and impeller::Entity::GetTransform().

Referenced by impeller::TextureFilterInput::GetCoverage(), and impeller::TextureFilterInput::GetSnapshot().

## ◆ IsLeaf()

bool impeller::FilterInput::IsLeaf | ( |  | ) | const
| virtual

Returns `true` unless this input is a `FilterInput`, which may take other inputs.

Reimplemented in impeller::FilterContentsFilterInput.

Definition at line 89 of file filter_input.cc.

89 {
90 return true;
91 }

## ◆ IsTranslationOnly()

bool impeller::FilterInput::IsTranslationOnly | ( |  | ) | const
| virtual

See also
  `FilterContents::HasBasisTransforms`

Reimplemented in impeller::FilterContentsFilterInput.

Definition at line 85 of file filter_input.cc.

85 {
86 return true;
87 }

## ◆ Make() [1/3]

FilterInput::Vector impeller::FilterInput::Make | ( | std::initializer_list< Variant > | inputs | ) |
| static

Definition at line 50 of file filter_input.cc.

50 {
51 FilterInput::Vector result;
52 result.reserve(inputs.size());
53 for (const auto& input : inputs) {
54 result.push_back(Make(input));
55 }
56 return result;
57 }

References Make().

## ◆ Make() [2/3]

FilterInput::Ref impeller::FilterInput::Make | ( | std::shared_ptr< Texture > | input,
|  | Matrix | local_transform
| ) |  |
| static

Definition at line 44 of file filter_input.cc.

45 {
46 return std::shared_ptr<TextureFilterInput>(
47 new TextureFilterInput(std::move(texture), local_transform));
48 }

## ◆ Make() [3/3]

FilterInput::Ref impeller::FilterInput::Make | ( | Variant | input,
|  | bool | msaa_enabled = `true`
| ) |  |
| static

Definition at line 19 of file filter_input.cc.

19 {
20 if (auto filter = std::get_if<std::shared_ptr<FilterContents>>(&input)) {
21 return std::static_pointer_cast<FilterInput>(
22 std::shared_ptr<FilterContentsFilterInput>(
23 new FilterContentsFilterInput(*filter)));
24 }
25
26 if (auto contents = std::get_if<std::shared_ptr<Contents>>(&input)) {
27 return std::static_pointer_cast<FilterInput>(
28 std::shared_ptr<ContentsFilterInput>(
29 new ContentsFilterInput(*contents, msaa_enabled)));
30 }
31
32 if (auto texture = std::get_if<std::shared_ptr<Texture>>(&input)) {
33 return Make(*texture, Matrix());
34 }
35
36 if (auto rect = std::get_if<Rect>(&input)) {
37 return std::shared_ptr<PlaceholderFilterInput>(
38 new PlaceholderFilterInput(*rect));
39 }
40
41 FML_UNREACHABLE();
42 }

Referenced by impeller::Paint::MaskBlurDescriptor::CreateMaskBlur(), impeller::EntityPass::GetElementsCoverage(), impeller::ImageFilter::GetFilterContents(), Make(), impeller::ColorFilterContents::MakeBlend(), impeller::FilterContents::MakeGaussianBlur(), impeller::FilterContents::MakeMorphology(), impeller::FilterContents::MakeYUVToRGBFilter(), impeller::VerticesContents::Render(), impeller::AtlasContents::Render(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::Paint::WithImageFilter(), impeller::Paint::WithMaskBlur(), impeller::ComposeImageFilter::WrapInput(), impeller::LocalMatrixImageFilter::WrapInput(), and impeller::ComposedColorFilter::WrapWithGPUColorFilter().

## ◆ PopulateGlyphAtlas()

void impeller::FilterInput::PopulateGlyphAtlas | ( | const std::shared_ptr< LazyGlyphAtlas > & | lazy_glyph_atlas,
|  | Scalar | scale
| ) |  |
| virtual

See also
  `Contents::PopulateGlyphAtlas`

Reimplemented in impeller::FilterContentsFilterInput, impeller::PlaceholderFilterInput, and impeller::ContentsFilterInput.

Definition at line 79 of file filter_input.cc.

81 {}

## ◆ SetEffectTransform()

void impeller::FilterInput::SetEffectTransform | ( | const Matrix & | matrix | ) |
| virtual

Sets the effect transform of filter inputs.

Reimplemented in impeller::FilterContentsFilterInput.

Definition at line 95 of file filter_input.cc.

95 {}

## ◆ SetLeafInputs()

void impeller::FilterInput::SetLeafInputs | ( | const FilterInput::Vector & | inputs | ) |
| virtual

Replaces the inputs of all leaf `FilterContents` with a new set of `inputs`.

See also
  `FilterInput::IsLeaf`

Reimplemented in impeller::FilterContentsFilterInput.

Definition at line 93 of file filter_input.cc.

93 {}

## ◆ SetRenderingMode()

void impeller::FilterInput::SetRenderingMode | ( | Entity::RenderingMode | rendering_mode | ) |
| virtual

Turns on subpass mode for filter inputs.

Reimplemented in impeller::FilterContentsFilterInput.

Definition at line 97 of file filter_input.cc.

97 {}

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

- impeller/entity/contents/filters/inputs/filter_input.h
- impeller/entity/contents/filters/inputs/filter_input.cc

impeller::FilterInput::Make
static FilterInput::Ref Make(Variant input, bool msaa_enabled=true)
Definition: filter_input.cc:19
impeller::FilterInput::GetCoverage
virtual std::optional< Rect > GetCoverage(const Entity &entity) const =0
impeller::FilterInput::Vector
std::vector< FilterInput::Ref > Vector
Definition: filter_input.h:33
impeller::FilterInput::GetLocalTransform
virtual Matrix GetLocalTransform(const Entity &entity) const
Get the local transform of this filter input. This transform is relative to the Entity transform spac...
Definition: filter_input.cc:59