| Flutter Impeller |

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

`#include <color_filter.h>`

Inheritance diagram for impeller::ColorFilter:

## Public Types
using | ColorFilterProc = std::function< Color(Color)>

## Public Member Functions
| ColorFilter ()
virtual | ~ColorFilter ()
virtual std::shared_ptr< ColorFilterContents > | WrapWithGPUColorFilter (std::shared_ptr< FilterInput > input, ColorFilterContents::AbsorbOpacity absorb_opacity) const =0
| 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...
virtual ColorFilterProc | GetCPUColorFilterProc () const =0
| Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU. More...
virtual std::shared_ptr< ColorFilter > | Clone () const =0

## Static Public Member Functions
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 18 of file color_filter.h.

## Member Typedef Documentation

## ◆ ColorFilterProc

using impeller::ColorFilter::ColorFilterProc = std::function<Color(Color)>

A procedure that filters a given unpremultiplied color to produce a new unpremultiplied color.

Definition at line 24 of file color_filter.h.

## Constructor & Destructor Documentation

## ◆ ColorFilter()

impeller::ColorFilter::ColorFilter | ( |  | ) |
| default

## ◆ ~ColorFilter()

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

## Member Function Documentation

## ◆ Clone()

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

Implemented in impeller::LinearToSrgbColorFilter, impeller::SrgbToLinearColorFilter, impeller::MatrixColorFilter, and impeller::BlendColorFilter.

## ◆ GetCPUColorFilterProc()

virtual ColorFilterProc impeller::ColorFilter::GetCPUColorFilterProc | ( |  | ) | const
| pure virtual

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

Implemented in impeller::LinearToSrgbColorFilter, impeller::SrgbToLinearColorFilter, impeller::MatrixColorFilter, and impeller::BlendColorFilter.

## ◆ MakeBlend()

std::shared_ptr< ColorFilter > impeller::ColorFilter::MakeBlend | ( | BlendMode | blend_mode,
|  | Color | color
| ) |  |
| static

Definition at line 20 of file color_filter.cc.

21 {
22 return std::make_shared<BlendColorFilter>(blend_mode, color);
23 }

Referenced by impeller::testing::TEST_P(), and impeller::ToColorFilter().

## ◆ MakeLinearToSrgb()

std::shared_ptr< ColorFilter > impeller::ColorFilter::MakeLinearToSrgb | ( |  | ) |
| static

Definition at line 33 of file color_filter.cc.

33 {
34 return std::make_shared<LinearToSrgbColorFilter>();
35 }

Referenced by impeller::ToColorFilter().

## ◆ MakeMatrix()

std::shared_ptr< ColorFilter > impeller::ColorFilter::MakeMatrix | ( | ColorMatrix | color_matrix | ) |
| static

Definition at line 25 of file color_filter.cc.

25 {
26 return std::make_shared<MatrixColorFilter>(color_matrix);
27 }

Referenced by impeller::ToColorFilter().

## ◆ MakeSrgbToLinear()

std::shared_ptr< ColorFilter > impeller::ColorFilter::MakeSrgbToLinear | ( |  | ) |
| static

Definition at line 29 of file color_filter.cc.

29 {
30 return std::make_shared<SrgbToLinearColorFilter>();
31 }

Referenced by impeller::ToColorFilter().

## ◆ WrapWithGPUColorFilter()

virtual std::shared_ptr<ColorFilterContents> impeller::ColorFilter::WrapWithGPUColorFilter | ( | std::shared_ptr< FilterInput > | input,
|  | ColorFilterContents::AbsorbOpacity | absorb_opacity
| ) |  | const
| pure 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.

Implemented in impeller::LinearToSrgbColorFilter, impeller::SrgbToLinearColorFilter, impeller::MatrixColorFilter, and impeller::BlendColorFilter.

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

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