| Flutter Impeller |

Public Member Functions | List of all members
impeller::ComposedColorFilter Class Referencefinal

Applies color filters as f(g(x)), where x is the input color. More...

`#include <color_filter.h>`

Inheritance diagram for impeller::ComposedColorFilter:

## Public Member Functions
| ComposedColorFilter (const std::shared_ptr< ColorFilter > &outer, const std::shared_ptr< ColorFilter > &inner)
| ~ComposedColorFilter () override
std::shared_ptr< ColorFilterContents > | WrapWithGPUColorFilter (std::shared_ptr< FilterInput > input, ColorFilterContents::AbsorbOpacity absorb_opacity) const override
| Wraps the given filter input with a GPU-based filter that will perform the color operation. The given input will first be rendered to a texture and then filtered. More...
ColorFilterProc | GetCPUColorFilterProc () const override
| Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU. More...
std::shared_ptr< ColorFilter > | Clone () const override
Public Member Functions inherited from impeller::ColorFilter
| ColorFilter ()
virtual | ~ColorFilter ()

## Additional Inherited Members
Public Types inherited from impeller::ColorFilter
using | ColorFilterProc = std::function< Color(Color)>
Static Public Member Functions inherited from impeller::ColorFilter
static std::shared_ptr< ColorFilter > | MakeBlend (BlendMode blend_mode, Color color)
static std::shared_ptr< ColorFilter > | MakeMatrix (ColorMatrix color_matrix)
static std::shared_ptr< ColorFilter > | MakeSrgbToLinear ()
static std::shared_ptr< ColorFilter > | MakeLinearToSrgb ()
static std::shared_ptr< ColorFilter > | MakeComposed (const std::shared_ptr< ColorFilter > &outer, const std::shared_ptr< ColorFilter > &inner)

## Detailed Description

Applies color filters as f(g(x)), where x is the input color.

Definition at line 156 of file color_filter.h.

## Constructor & Destructor Documentation

## ◆ ComposedColorFilter()

impeller::ComposedColorFilter::ComposedColorFilter | ( | const std::shared_ptr< ColorFilter > & | outer,
|  | const std::shared_ptr< ColorFilter > & | inner
| ) |  |

Definition at line 158 of file color_filter.cc.

161 : outer_(outer), inner_(inner) {}

## ◆ ~ComposedColorFilter()

impeller::ComposedColorFilter::~ComposedColorFilter | ( |  | ) |
| override default

## Member Function Documentation

## ◆ Clone()

std::shared_ptr< ColorFilter > impeller::ComposedColorFilter::Clone | ( |  | ) | const
| override virtual

Implements impeller::ColorFilter.

Definition at line 186 of file color_filter.cc.

186 {
187 return std::make_shared<ComposedColorFilter>(outer_, inner_);
188 }

## ◆ GetCPUColorFilterProc()

ColorFilter::ColorFilterProc impeller::ComposedColorFilter::GetCPUColorFilterProc | ( |  | ) | const
| override virtual

Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU.

Implements impeller::ColorFilter.

Definition at line 176 of file color_filter.cc.

177 {
178 return [inner = inner_, outer = outer_](Color color) {
179 auto inner_proc = inner->GetCPUColorFilterProc();
180 auto outer_proc = outer->GetCPUColorFilterProc();
181 return outer_proc(inner_proc(color));
182 };
183 }

## ◆ WrapWithGPUColorFilter()

std::shared_ptr< ColorFilterContents > impeller::ComposedColorFilter::WrapWithGPUColorFilter | ( | std::shared_ptr< FilterInput > | input,
|  | ColorFilterContents::AbsorbOpacity | absorb_opacity
| ) |  | const
| override virtual

Wraps the given filter input with a GPU-based filter that will perform the color operation. The given input will first be rendered to a texture and then filtered.

Note that this operation has no consideration for the original geometry mask of the filter input. And the entire input texture is treated as color information.

Implements impeller::ColorFilter.

Definition at line 166 of file color_filter.cc.

168 {
169 std::shared_ptr<FilterContents> inner = inner_->WrapWithGPUColorFilter(
170 input, ColorFilterContents::AbsorbOpacity::kNo);
171 return outer_->WrapWithGPUColorFilter(FilterInput::Make(inner),
172 absorb_opacity);
173 }

References impeller::ColorFilterContents::kNo, and impeller::FilterInput::Make().

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

- impeller/aiks/color_filter.h
- impeller/aiks/color_filter.cc

impeller::FilterInput::Make
static FilterInput::Ref Make(Variant input, bool msaa_enabled=true)
Definition: filter_input.cc:19
impeller::ColorFilterContents::AbsorbOpacity::kNo
@ kNo