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

#include <color_filter.h>

Inheritance diagram for impeller::BlendColorFilter:
impeller::ColorFilter

Public Member Functions

 BlendColorFilter (BlendMode blend_mode, Color color)
 
 ~BlendColorFilter () 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 64 of file color_filter.h.

Constructor & Destructor Documentation

◆ BlendColorFilter()

impeller::BlendColorFilter::BlendColorFilter ( BlendMode  blend_mode,
Color  color 
)

Definition at line 50 of file color_filter.cc.

51 : blend_mode_(blend_mode), color_(color) {}
SkColor4f color

◆ ~BlendColorFilter()

impeller::BlendColorFilter::~BlendColorFilter ( )
overridedefault

Member Function Documentation

◆ Clone()

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

Implements impeller::ColorFilter.

Definition at line 70 of file color_filter.cc.

70 {
71 return std::make_shared<BlendColorFilter>(*this);
72}

◆ GetCPUColorFilterProc()

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

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

Implements impeller::ColorFilter.

Definition at line 64 of file color_filter.cc.

64 {
65 return [filter_blend_mode = blend_mode_, filter_color = color_](Color color) {
66 return color.Blend(filter_color, filter_blend_mode);
67 };
68}

◆ WrapWithGPUColorFilter()

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

57 {
58 auto filter =
59 ColorFilterContents::MakeBlend(blend_mode_, {std::move(input)}, color_);
60 filter->SetAbsorbOpacity(absorb_opacity);
61 return filter;
62}
static std::shared_ptr< ColorFilterContents > MakeBlend(BlendMode blend_mode, FilterInput::Vector inputs, std::optional< Color > foreground_color=std::nullopt)
the [inputs] are expected to be in the order of dst, src.

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