| Flutter Impeller |

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

`#include <color_filter.h>`

Inheritance diagram for impeller::MatrixColorFilter:

## Public Member Functions
| MatrixColorFilter (ColorMatrix color_matrix)
| ~MatrixColorFilter () 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 ()

## Detailed Description

Definition at line 85 of file color_filter.h.

## Constructor & Destructor Documentation

## ◆ MatrixColorFilter()

impeller::MatrixColorFilter::MatrixColorFilter | ( | ColorMatrix | color_matrix | ) |
| explicit

Definition at line 69 of file color_filter.cc.

70 : color_matrix_(color_matrix) {}

## ◆ ~MatrixColorFilter()

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

## Member Function Documentation

## ◆ Clone()

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

Implements impeller::ColorFilter.

Definition at line 89 of file color_filter.cc.

89 {
90 return std::make_shared<MatrixColorFilter>(*this);
91 }

## ◆ GetCPUColorFilterProc()

ColorFilter::ColorFilterProc impeller::MatrixColorFilter::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 83 of file color_filter.cc.

83 {
84 return [color_matrix = color_matrix_](Color color) {
85 return color.ApplyColorMatrix(color_matrix);
86 };
87 }

## ◆ WrapWithGPUColorFilter()

std::shared_ptr< ColorFilterContents > impeller::MatrixColorFilter::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 74 of file color_filter.cc.

76 {
77 auto filter =
78 ColorFilterContents::MakeColorMatrix({std::move(input)}, color_matrix_);
79 filter->SetAbsorbOpacity(absorb_opacity);
80 return filter;
81 }

References impeller::ColorFilterContents::MakeColorMatrix().

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

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

impeller::ColorFilterContents::MakeColorMatrix
static std::shared_ptr< ColorFilterContents > MakeColorMatrix(FilterInput::Ref input, const ColorMatrix &color_matrix)
Definition: color_filter_contents.cc:58