| Flutter Impeller |

color_filter.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 #ifndef FLUTTER_IMPELLER_DISPLAY_LIST_COLOR_FILTER_H_
6 #define FLUTTER_IMPELLER_DISPLAY_LIST_COLOR_FILTER_H_
7
8 #include "display_list/effects/dl_color_filter.h"
9 #include "impeller/entity/contents/filters/color_filter_contents.h"
10 #include "impeller/geometry/color.h"
11
12 namespace impeller {
13
14 /// A color matrix which inverts colors.
15 // clang-format off
16 static const constexpr ColorMatrix kColorInversion = {
17 .array = {
18 -1.0, 0, 0, 1.0, 0, //
19 0, -1.0, 0, 1.0, 0, //
20 0, 0, -1.0, 1.0, 0, //
21 1.0, 1.0, 1.0, 1.0, 0 //
22 }
23 };
24
25 std::shared_ptr<ColorFilterContents> WrapWithInvertColors(
26 const std::shared_ptr<FilterInput>& input,
27 ColorFilterContents::AbsorbOpacity absorb_opacity);
28
29 std::shared_ptr<ColorFilterContents> WrapWithGPUColorFilter(
30 const flutter::DlColorFilter* filter,
31 const std::shared_ptr<FilterInput>& input,
32 ColorFilterContents::AbsorbOpacity absorb_opacity);
33
34 /// A procedure that filters a given unpremultiplied color to produce a new
35 /// unpremultiplied color.
36 using ColorFilterProc = std::function<Color(Color)>;
37
38 ColorFilterProc GetCPUColorFilterProc(const flutter::DlColorFilter* filter);
39
40 } // namespace impeller
41
42 #endif // FLUTTER_IMPELLER_DISPLAY_LIST_COLOR_FILTER_H_
impeller::ColorFilterContents::AbsorbOpacity
AbsorbOpacity
Definition: color_filter_contents.h:14
color.h
color_filter_contents.h
impeller
Definition: allocation.cc:12
impeller::WrapWithGPUColorFilter
std::shared_ptr< ColorFilterContents > WrapWithGPUColorFilter(const flutter::DlColorFilter *filter, const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
Definition: color_filter.cc:24
impeller::WrapWithInvertColors
std::shared_ptr< ColorFilterContents > WrapWithInvertColors(const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
Definition: color_filter.cc:16
impeller::GetCPUColorFilterProc
ColorFilterProc GetCPUColorFilterProc(const flutter::DlColorFilter *filter)
Definition: color_filter.cc:66
impeller::ColorFilterProc
std::function< Color(Color)> ColorFilterProc
Definition: color_filter.h:36
impeller::kColorInversion
static constexpr const ColorMatrix kColorInversion
A color matrix which inverts colors.
Definition: color_filter.h:16
impeller::Color
Definition: color.h:124
impeller::ColorMatrix
Definition: color.h:117
impeller::ColorMatrix::array
Scalar array[20]
Definition: color.h:118