Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
impeller::MatrixColorFilter Class Referencefinal

#include <color_filter.h>

Inheritance diagram for impeller::MatrixColorFilter:
impeller::ColorFilter

Public Member Functions

 MatrixColorFilter (ColorMatrix color_matrix)
 
 ~MatrixColorFilter () override
 
std::shared_ptr< ColorFilterContentsWrapWithGPUColorFilter (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.
 
ColorFilterProc GetCPUColorFilterProc () const override
 Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU.
 
std::shared_ptr< ColorFilterClone () 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< ColorFilterMakeBlend (BlendMode blend_mode, Color color)
 
static std::shared_ptr< ColorFilterMakeMatrix (ColorMatrix color_matrix)
 
static std::shared_ptr< ColorFilterMakeSrgbToLinear ()
 
static std::shared_ptr< ColorFilterMakeLinearToSrgb ()
 
static std::shared_ptr< ColorFilterMakeComposed (const std::shared_ptr< ColorFilter > &outer, const std::shared_ptr< ColorFilter > &inner)
 

Detailed Description

Definition at line 90 of file color_filter.h.

Constructor & Destructor Documentation

◆ MatrixColorFilter()

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

Definition at line 78 of file color_filter.cc.

79 : color_matrix_(color_matrix) {}

◆ ~MatrixColorFilter()

impeller::MatrixColorFilter::~MatrixColorFilter ( )
overridedefault

Member Function Documentation

◆ Clone()

std::shared_ptr< ColorFilter > impeller::MatrixColorFilter::Clone ( ) const
overridevirtual

Implements impeller::ColorFilter.

Definition at line 98 of file color_filter.cc.

98 {
99 return std::make_shared<MatrixColorFilter>(*this);
100}

◆ GetCPUColorFilterProc()

ColorFilter::ColorFilterProc impeller::MatrixColorFilter::GetCPUColorFilterProc ( ) const
overridevirtual

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

Implements impeller::ColorFilter.

Definition at line 92 of file color_filter.cc.

92 {
93 return [color_matrix = color_matrix_](Color color) {
94 return color.ApplyColorMatrix(color_matrix);
95 };
96}
SkColor4f color

◆ WrapWithGPUColorFilter()

std::shared_ptr< ColorFilterContents > impeller::MatrixColorFilter::WrapWithGPUColorFilter ( std::shared_ptr< FilterInput input,
ColorFilterContents::AbsorbOpacity  absorb_opacity 
) const
overridevirtual

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 83 of file color_filter.cc.

85 {
86 auto filter =
87 ColorFilterContents::MakeColorMatrix({std::move(input)}, color_matrix_);
88 filter->SetAbsorbOpacity(absorb_opacity);
89 return filter;
90}
static std::shared_ptr< ColorFilterContents > MakeColorMatrix(FilterInput::Ref input, const ColorMatrix &color_matrix)

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