| 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 #include "impeller/toolkit/interop/texture.h"
18
19 namespace impeller::interop {
20
21 class ColorSource final
22 : public Object<ColorSource,
23 IMPELLER_INTERNAL_HANDLE_NAME(ImpellerColorSource)> {
24 public:
25 static ScopedObject<ColorSource> MakeLinearGradient(
26 const Point& start_point,
27 const Point& end_point,
28 const std::vector<flutter::DlColor>& colors,
29 const std::vector<Scalar>& stops,
30 flutter::DlTileMode tile_mode,
31 const Matrix& transformation);
32
33 static ScopedObject<ColorSource> MakeRadialGradient(
34 const Point& center,
35 Scalar radius,
36 const std::vector<flutter::DlColor>& colors,
37 const std::vector<Scalar>& stops,
38 flutter::DlTileMode tile_mode,
39 const Matrix& transformation);
40
41 static ScopedObject<ColorSource> MakeConicalGradient(
42 const Point& start_center,
43 Scalar start_radius,
44 const Point& end_center,
45 Scalar end_radius,
46 const std::vector<flutter::DlColor>& colors,
47 const std::vector<Scalar>& stops,
48 flutter::DlTileMode tile_mode,
49 const Matrix& transformation);
50
51 static ScopedObject<ColorSource> MakeSweepGradient(
52 const Point& center,
53 Scalar start,
54 Scalar end,
55 const std::vector<flutter::DlColor>& colors,
56 const std::vector<Scalar>& stops,
57 flutter::DlTileMode tile_mode,
58 const Matrix& transformation);
59
60 static ScopedObject<ColorSource> MakeImage(
61 const Texture& image,
62 flutter::DlTileMode horizontal_tile_mode,
63 flutter::DlTileMode vertical_tile_mode,
64 flutter::DlImageSampling sampling,
65 const Matrix& transformation);
66
67 explicit ColorSource(std::shared_ptr<flutter::DlColorSource> source);
68
69 ~ColorSource() override;
70
71 ColorSource(const ColorSource&) = delete;
72
73 ColorSource& operator=(const ColorSource&) = delete;
74
75 bool IsValid() const;
76
77 const std::shared_ptr<flutter::DlColorSource>& GetColorSource() const;
78
79 private:
80 std::shared_ptr<flutter::DlColorSource> color_source_;
81 };
82
83 } // namespace impeller::interop
84
85 #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:21
impeller::interop::ScopedObject
Definition: object.h:67
impeller::interop::ColorSource::ColorSource
ColorSource(std::shared_ptr< flutter::DlColorSource > source)
Definition: color_source.cc:114
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:30
impeller::interop
Definition: color_filter.cc:7
matrix.h
impeller::interop::ColorSource::MakeImage
static ScopedObject< ColorSource > MakeImage(const Texture &image, flutter::DlTileMode horizontal_tile_mode, flutter::DlTileMode vertical_tile_mode, flutter::DlImageSampling sampling, const Matrix &transformation)
Definition: color_source.cc:99
formats.h
texture.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:76
impeller::interop::Texture
Definition: texture.h:16
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:51
impeller::interop::ColorSource::GetColorSource
const std::shared_ptr< flutter::DlColorSource > & GetColorSource() const
Definition: color_source.cc:123
impeller::TPoint< Scalar >
impeller::interop::ColorSource::IsValid
bool IsValid() const
Definition: color_source.cc:119
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