| Flutter Impeller |

color_filter.cc
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 #include "impeller/toolkit/interop/color_filter.h"
6
7 namespace impeller::interop {
8
9 ScopedObject<ColorFilter> ColorFilter::MakeBlend(Color color, BlendMode mode) {
10 auto filter = flutter::DlBlendColorFilter::Make(ToDisplayListType(color),
11 ToDisplayListType(mode));
12 if (!filter) {
13 return nullptr;
14 }
15 return Create<ColorFilter>(std::move(filter));
16 }
17
18 ScopedObject<ColorFilter> ColorFilter::MakeMatrix(const float matrix[20]) {
19 auto filter = flutter::DlMatrixColorFilter::Make(matrix);
20 if (!filter) {
21 return nullptr;
22 }
23 return Create<ColorFilter>(std::move(filter));
24 }
25
26 ColorFilter::ColorFilter(std::shared_ptr<flutter::DlColorFilter> filter)
27 : filter_(std::move(filter)) {}
28
29 ColorFilter::~ColorFilter() = default;
30
31 const std::shared_ptr<flutter::DlColorFilter>& ColorFilter::GetColorFilter()
32 const {
33 return filter_;
34 }
35
36 } // namespace impeller::interop
impeller::interop::ColorFilter::ColorFilter
ColorFilter(std::shared_ptr< flutter::DlColorFilter > filter)
Definition: color_filter.cc:26
impeller::interop::ToDisplayListType
constexpr flutter::DlColor ToDisplayListType(Color color)
Definition: formats.h:73
impeller::interop::ScopedObject
Definition: object.h:67
color_filter.h
impeller::BlendMode
BlendMode
Definition: color.h:58
impeller::Color
Definition: color.h:123
impeller::interop
Definition: color_filter.cc:7
impeller::interop::ColorFilter::~ColorFilter
~ColorFilter() override
impeller::interop::ColorFilter::MakeBlend
static ScopedObject< ColorFilter > MakeBlend(Color color, BlendMode mode)
Definition: color_filter.cc:9
std
Definition: comparable.h:95
impeller::interop::ColorFilter::GetColorFilter
const std::shared_ptr< flutter::DlColorFilter > & GetColorFilter() const
Definition: color_filter.cc:31
color
DlColor color
Definition: dl_golden_blur_unittests.cc:24
impeller::interop::ColorFilter::MakeMatrix
static ScopedObject< ColorFilter > MakeMatrix(const float matrix[20])
Definition: color_filter.cc:18