| Flutter Impeller |

color_filter_contents.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #pragma once
6
7 #include "impeller/entity/contents/filters/filter_contents.h"
8
9 namespace impeller {
10
11 class ColorFilterContents : public FilterContents {
12 public:
13 enum class AbsorbOpacity {
14 kYes,
15 kNo,
16 };
17
18 /// @brief the [inputs] are expected to be in the order of dst, src.
19 static std::shared_ptr<ColorFilterContents> MakeBlend(
20 BlendMode blend_mode,
21 FilterInput::Vector inputs,
22 std::optional<Color> foreground_color = std::nullopt);
23
24 static std::shared_ptr<ColorFilterContents> MakeColorMatrix(
25 FilterInput::Ref input,
26 const ColorMatrix& color_matrix);
27
28 static std::shared_ptr<ColorFilterContents> MakeLinearToSrgbFilter(
29 FilterInput::Ref input);
30
31 static std::shared_ptr<ColorFilterContents> MakeSrgbToLinearFilter(
32 FilterInput::Ref input);
33
34 ColorFilterContents();
35
36 ~ColorFilterContents() override;
37
38 void SetAbsorbOpacity(AbsorbOpacity absorb_opacity);
39
40 AbsorbOpacity GetAbsorbOpacity() const;
41
42 /// @brief Sets an alpha that is applied to the final blended result.
43 void SetAlpha(Scalar alpha);
44
45 std::optional<Scalar> GetAlpha() const;
46
47 private:
48 AbsorbOpacity absorb_opacity_ = AbsorbOpacity::kNo;
49 std::optional<Scalar> alpha_;
50
51 FML_DISALLOW_COPY_AND_ASSIGN(ColorFilterContents);
52 };
53
54 } // namespace impeller
impeller::BlendMode
BlendMode
Definition: color.h:57
impeller::Scalar
float Scalar
Definition: scalar.h:15
impeller::ColorFilterContents::ColorFilterContents
ColorFilterContents()
impeller::ColorFilterContents
Definition: color_filter_contents.h:11
impeller::ColorFilterContents::SetAbsorbOpacity
void SetAbsorbOpacity(AbsorbOpacity absorb_opacity)
Definition: color_filter_contents.cc:85
impeller::FilterInput::Ref
std::shared_ptr< FilterInput > Ref
Definition: filter_input.h:31
impeller::ColorFilterContents::AbsorbOpacity::kNo
@ kNo
impeller::ColorFilterContents::~ColorFilterContents
~ColorFilterContents() override
filter_contents.h
impeller::ColorFilterContents::GetAbsorbOpacity
AbsorbOpacity GetAbsorbOpacity() const
Definition: color_filter_contents.cc:89
impeller::ColorFilterContents::MakeSrgbToLinearFilter
static std::shared_ptr< ColorFilterContents > MakeSrgbToLinearFilter(FilterInput::Ref input)
Definition: color_filter_contents.cc:75
impeller::ColorFilterContents::SetAlpha
void SetAlpha(Scalar alpha)
Sets an alpha that is applied to the final blended result.
Definition: color_filter_contents.cc:94
impeller::ColorFilterContents::MakeLinearToSrgbFilter
static std::shared_ptr< ColorFilterContents > MakeLinearToSrgbFilter(FilterInput::Ref input)
Definition: color_filter_contents.cc:68
impeller::ColorFilterContents::MakeColorMatrix
static std::shared_ptr< ColorFilterContents > MakeColorMatrix(FilterInput::Ref input, const ColorMatrix &color_matrix)
Definition: color_filter_contents.cc:58
impeller::ColorFilterContents::AbsorbOpacity::kYes
@ kYes
impeller::FilterInput::Vector
std::vector< FilterInput::Ref > Vector
Definition: filter_input.h:32
impeller::ColorFilterContents::GetAlpha
std::optional< Scalar > GetAlpha() const
Definition: color_filter_contents.cc:98
impeller::ColorMatrix
Definition: color.h:115
impeller::ColorFilterContents::MakeBlend
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.
Definition: color_filter_contents.cc:17
impeller::ColorFilterContents::AbsorbOpacity
AbsorbOpacity
Definition: color_filter_contents.h:13
impeller
Definition: aiks_context.cc:10
impeller::FilterContents
Definition: filter_contents.h:19