Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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:
impeller::ColorFilter

Public Member Functions

 ComposedColorFilter (const std::shared_ptr< ColorFilter > &outer, const std::shared_ptr< ColorFilter > &inner)
 
 ~ComposedColorFilter () 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

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 ( )
overridedefault

Member Function Documentation

◆ Clone()

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

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
overridevirtual

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}
SkColor4f color

◆ WrapWithGPUColorFilter()

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

168 {
169 std::shared_ptr<FilterContents> inner = inner_->WrapWithGPUColorFilter(
171 return outer_->WrapWithGPUColorFilter(FilterInput::Make(inner),
172 absorb_opacity);
173}
static FilterInput::Ref Make(Variant input, bool msaa_enabled=true)

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