| Flutter Impeller |

color_source.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_TOOLKIT_INTEROP_COLOR_SOURCE_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_COLOR_SOURCE_H_
7
8 #include <vector>
9
10 #include "flutter/display_list/effects/dl_color_source.h"
11 #include "impeller/geometry/color.h"
12 #include "impeller/geometry/matrix.h"
13 #include "impeller/geometry/point.h"
14 #include "impeller/toolkit/interop/formats.h"
15 #include "impeller/toolkit/interop/impeller.h"
16 #include "impeller/toolkit/interop/object.h"
17
18 namespace impeller::interop {
19
20 class ColorSource final
21 : public Object<ColorSource,
22 IMPELLER_INTERNAL_HANDLE_NAME(ImpellerColorSource)> {
23 public:
24 static ScopedObject<ColorSource> MakeLinearGradient(
25 const Point& start_point,
26 const Point& end_point,
27 const std::vector<flutter::DlColor>& colors,
28 const std::vector<Scalar>& stops,
29 flutter::DlTileMode tile_mode,
30 const Matrix& transformation);
31
32 static ScopedObject<ColorSource> MakeRadialGradient(
33 const Point& center,
34 Scalar radius,
35 const std::vector<flutter::DlColor>& colors,
36 const std::vector<Scalar>& stops,
37 flutter::DlTileMode tile_mode,
38 const Matrix& transformation);
39
40 static ScopedObject<ColorSource> MakeConicalGradient(
41 const Point& start_center,
42 Scalar start_radius,
43 const Point& end_center,
44 Scalar end_radius,
45 const std::vector<flutter::DlColor>& colors,
46 const std::vector<Scalar>& stops,
47 flutter::DlTileMode tile_mode,
48 const Matrix& transformation);
49
50 static ScopedObject<ColorSource> MakeSweepGradient(
51 const Point& center,
52 Scalar start,
53 Scalar end,
54 const std::vector<flutter::DlColor>& colors,
55 const std::vector<Scalar>& stops,
56 flutter::DlTileMode tile_mode,
57 const Matrix& transformation);
58
59 explicit ColorSource(std::shared_ptr<flutter::DlColorSource> source);
60
61 ~ColorSource() override;
62
63 ColorSource(const ColorSource&) = delete;
64
65 ColorSource& operator=(const ColorSource&) = delete;
66
67 bool IsValid() const;
68
69 const std::shared_ptr<flutter::DlColorSource>& GetColorSource() const;
70
71 private:
72 std::shared_ptr<flutter::DlColorSource> color_source_;
73 };
74
75 } // namespace impeller::interop
76
77 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_COLOR_SOURCE_H_
impeller.h
impeller::interop::Object
Definition: object.h:56
point.h
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::interop::ColorSource
Definition: color_source.h:20
impeller::interop::ScopedObject
Definition: object.h:67
impeller::interop::ColorSource::ColorSource
ColorSource(std::shared_ptr< flutter::DlColorSource > source)
Definition: color_source.cc:105
impeller::interop::ColorSource::operator=
ColorSource & operator=(const ColorSource &)=delete
impeller::interop::ColorSource::~ColorSource
~ColorSource() override
impeller::interop::ColorSource::MakeRadialGradient
static ScopedObject< ColorSource > MakeRadialGradient(const Point &center, Scalar radius, const std::vector< flutter::DlColor > &colors, const std::vector< Scalar > &stops, flutter::DlTileMode tile_mode, const Matrix &transformation)
Definition: color_source.cc:32
impeller::interop
Definition: color_filter.cc:7
matrix.h
formats.h
impeller::interop::ColorSource::MakeSweepGradient
static ScopedObject< ColorSource > MakeSweepGradient(const Point &center, Scalar start, Scalar end, const std::vector< flutter::DlColor > &colors, const std::vector< Scalar > &stops, flutter::DlTileMode tile_mode, const Matrix &transformation)
Definition: color_source.cc:81
impeller::interop::ColorSource::MakeConicalGradient
static ScopedObject< ColorSource > MakeConicalGradient(const Point &start_center, Scalar start_radius, const Point &end_center, Scalar end_radius, const std::vector< flutter::DlColor > &colors, const std::vector< Scalar > &stops, flutter::DlTileMode tile_mode, const Matrix &transformation)
Definition: color_source.cc:54
impeller::interop::ColorSource::GetColorSource
const std::shared_ptr< flutter::DlColorSource > & GetColorSource() const
Definition: color_source.cc:114
impeller::TPoint< Scalar >
impeller::interop::ColorSource::IsValid
bool IsValid() const
Definition: color_source.cc:110
color.h
impeller::interop::ColorSource::MakeLinearGradient
static ScopedObject< ColorSource > MakeLinearGradient(const Point &start_point, const Point &end_point, const std::vector< flutter::DlColor > &colors, const std::vector< Scalar > &stops, flutter::DlTileMode tile_mode, const Matrix &transformation)
Definition: color_source.cc:9
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
object.h