25 return std::make_shared<BlendColorFilter>(blend_mode,
color);
29 return std::make_shared<MatrixColorFilter>(color_matrix);
33 return std::make_shared<SrgbToLinearColorFilter>();
37 return std::make_shared<LinearToSrgbColorFilter>();
41 const std::shared_ptr<ColorFilter>& outer,
42 const std::shared_ptr<ColorFilter>& inner) {
43 return std::make_shared<ComposedColorFilter>(outer, inner);
51 : blend_mode_(blend_mode), color_(
color) {}
56 std::shared_ptr<FilterInput> input,
60 filter->SetAbsorbOpacity(absorb_opacity);
65 return [filter_blend_mode = blend_mode_, filter_color = color_](
Color color) {
66 return color.Blend(filter_color, filter_blend_mode);
71 return std::make_shared<BlendColorFilter>(*
this);
79 : color_matrix_(color_matrix) {}
84 std::shared_ptr<FilterInput> input,
88 filter->SetAbsorbOpacity(absorb_opacity);
93 return [color_matrix = color_matrix_](
Color color) {
94 return color.ApplyColorMatrix(color_matrix);
99 return std::make_shared<MatrixColorFilter>(*
this);
110std::shared_ptr<ColorFilterContents>
112 std::shared_ptr<FilterInput> input,
115 filter->SetAbsorbOpacity(absorb_opacity);
125 return std::make_shared<SrgbToLinearColorFilter>(*
this);
136std::shared_ptr<ColorFilterContents>
138 std::shared_ptr<FilterInput> input,
141 filter->SetAbsorbOpacity(absorb_opacity);
151 return std::make_shared<LinearToSrgbColorFilter>(*
this);
159 const std::shared_ptr<ColorFilter>& outer,
160 const std::shared_ptr<ColorFilter>& inner)
161 : outer_(outer), inner_(inner) {}
165std::shared_ptr<ColorFilterContents>
167 std::shared_ptr<FilterInput> input,
169 std::shared_ptr<FilterContents> inner = inner_->WrapWithGPUColorFilter(
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));
187 return std::make_shared<ComposedColorFilter>(outer_, inner_);
ColorFilterProc GetCPUColorFilterProc() const override
Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU.
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....
~BlendColorFilter() override
BlendColorFilter(BlendMode blend_mode, Color color)
std::shared_ptr< ColorFilter > Clone() const override
static std::shared_ptr< ColorFilterContents > MakeColorMatrix(FilterInput::Ref input, const ColorMatrix &color_matrix)
static std::shared_ptr< ColorFilterContents > MakeSrgbToLinearFilter(FilterInput::Ref input)
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.
static std::shared_ptr< ColorFilter > MakeComposed(const std::shared_ptr< ColorFilter > &outer, const std::shared_ptr< ColorFilter > &inner)
std::function< Color(Color)> ColorFilterProc
static std::shared_ptr< ColorFilter > MakeMatrix(ColorMatrix color_matrix)
static std::shared_ptr< ColorFilter > MakeBlend(BlendMode blend_mode, Color color)
static std::shared_ptr< ColorFilter > MakeLinearToSrgb()
static std::shared_ptr< ColorFilter > MakeSrgbToLinear()
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....
~ComposedColorFilter() override
ComposedColorFilter(const std::shared_ptr< ColorFilter > &outer, const std::shared_ptr< ColorFilter > &inner)
std::shared_ptr< ColorFilter > Clone() const override
ColorFilterProc GetCPUColorFilterProc() const override
Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU.
~LinearToSrgbColorFilter() override
LinearToSrgbColorFilter()
ColorFilterProc GetCPUColorFilterProc() const override
Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU.
std::shared_ptr< ColorFilter > Clone() const 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....
ColorFilterProc GetCPUColorFilterProc() const override
Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU.
std::shared_ptr< ColorFilter > Clone() const override
~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....
MatrixColorFilter(ColorMatrix color_matrix)
SrgbToLinearColorFilter()
std::shared_ptr< ColorFilter > Clone() const override
ColorFilterProc GetCPUColorFilterProc() const override
Returns a function that can be used to filter unpremultiplied Impeller Colors on the CPU.
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....
~SrgbToLinearColorFilter() override