| Flutter Impeller |

Public Member Functions | Static Public Member Functions | List of all members
impeller::interop::ColorSource Class Referencefinal

`#include <color_source.h>`

Inheritance diagram for impeller::interop::ColorSource:

## Public Member Functions
| ColorSource (std::shared_ptr< flutter::DlColorSource > source)
| ~ColorSource () override
| ColorSource (const ColorSource &)=delete
ColorSource & | operator= (const ColorSource &)=delete
bool | IsValid () const
const std::shared_ptr< flutter::DlColorSource > & | GetColorSource () const
Public Member Functions inherited from impeller::interop::ObjectBase
| ObjectBase ()=default
virtual | ~ObjectBase ()=default
| ObjectBase (const ObjectBase &)=delete
| ObjectBase (ObjectBase &&)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
ObjectBase & | operator= (ObjectBase &&)=delete
void | Retain ()
void | Release ()
uint64_t | GetRefCountForTests () const

## Static Public Member Functions
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)
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)
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)
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)
Static Public Member Functions inherited from impeller::interop::ObjectBase
static void | SafeRetain (void *ptr)
static void | SafeRelease (void *ptr)

## Additional Inherited Members
Public Types inherited from impeller::interop::Object< ColorSource, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerColorSource)>
using | InteropClass = ColorSource
using | InteropCSibling = IMPELLER_INTERNAL_HANDLE_NAME(ImpellerColorSource)

## Detailed Description

Definition at line 20 of file color_source.h.

## Constructor & Destructor Documentation

## ◆ ColorSource() [1/2]

impeller::interop::ColorSource::ColorSource | ( | std::shared_ptr< flutter::DlColorSource > | source | ) |
| explicit

Definition at line 105 of file color_source.cc.

106 : color_source_(std::move(source)) {}

## ◆ ~ColorSource()

impeller::interop::ColorSource::~ColorSource | ( |  | ) |
| overridedefault

## ◆ ColorSource() [2/2]

impeller::interop::ColorSource::ColorSource | ( | const ColorSource & |  | ) |
| delete

## Member Function Documentation

## ◆ GetColorSource()

const std::shared_ptr< flutter::DlColorSource > & impeller::interop::ColorSource::GetColorSource | ( |  | ) | const

Definition at line 114 of file color_source.cc.

115 {
116 return color_source_;
117 }

Referenced by impeller::interop::Paint::SetColorSource().

## ◆ IsValid()

bool impeller::interop::ColorSource::IsValid | ( |  | ) | const

Definition at line 110 of file color_source.cc.

110 {
111 return !!color_source_;
112 }

## ◆ MakeConicalGradient()

ScopedObject< ColorSource > impeller::interop::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
| ) |  |
| static

Definition at line 54 of file color_source.cc.

62 {
63 const auto sk_transformation = ToSkMatrix(transformation);
64 auto dl_filter =
65 flutter::DlColorSource::MakeConical(ToSkiaType(start_center), //
66 start_radius, //
67 ToSkiaType(end_center), //
68 end_radius, //
69 stops.size(), //
70 colors.data(), //
71 stops.data(), //
72 tile_mode, //
73 &sk_transformation //
74 );
75 if (!dl_filter) {
76 return nullptr;
77 }
78 return Create<ColorSource>(std::move(dl_filter));
79 }

References impeller::interop::ToSkiaType(), and impeller::interop::ToSkMatrix().

Referenced by impeller::interop::ImpellerColorSourceCreateConicalGradientNew().

## ◆ MakeLinearGradient()

ScopedObject< ColorSource > impeller::interop::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
| ) |  |
| static

Definition at line 9 of file color_source.cc.

15 {
16 const auto sk_transformation = ToSkMatrix(transformation);
17 auto dl_filter =
18 flutter::DlColorSource::MakeLinear(ToSkiaType(start_point), //
19 ToSkiaType(end_point), //
20 stops.size(), //
21 colors.data(), //
22 stops.data(), //
23 tile_mode, //
24 &sk_transformation //
25 );
26 if (!dl_filter) {
27 return nullptr;
28 }
29 return Create<ColorSource>(std::move(dl_filter));
30 }

References impeller::interop::ToSkiaType(), and impeller::interop::ToSkMatrix().

Referenced by impeller::interop::ImpellerColorSourceCreateLinearGradientNew().

## ◆ MakeRadialGradient()

ScopedObject< ColorSource > impeller::interop::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
| ) |  |
| static

Definition at line 32 of file color_source.cc.

38 {
39 const auto sk_transformation = ToSkMatrix(transformation);
40 auto dl_filter = flutter::DlColorSource::MakeRadial(ToSkiaType(center), //
41 radius, //
42 stops.size(), //
43 colors.data(), //
44 stops.data(), //
45 tile_mode, //
46 &sk_transformation //
47 );
48 if (!dl_filter) {
49 return nullptr;
50 }
51 return Create<ColorSource>(std::move(dl_filter));
52 }

References impeller::interop::ToSkiaType(), and impeller::interop::ToSkMatrix().

Referenced by impeller::interop::ImpellerColorSourceCreateRadialGradientNew().

## ◆ MakeSweepGradient()

ScopedObject< ColorSource > impeller::interop::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
| ) |  |
| static

Definition at line 81 of file color_source.cc.

88 {
89 const auto sk_transformation = ToSkMatrix(transformation);
90 auto dl_filter = flutter::DlColorSource::MakeSweep(ToSkiaType(center), //
91 start, //
92 end, //
93 stops.size(), //
94 colors.data(), //
95 stops.data(), //
96 tile_mode, //
97 &sk_transformation //
98 );
99 if (!dl_filter) {
100 return nullptr;
101 }
102 return Create<ColorSource>(std::move(dl_filter));
103 }

References impeller::interop::ToSkiaType(), and impeller::interop::ToSkMatrix().

Referenced by impeller::interop::ImpellerColorSourceCreateSweepGradientNew().

## ◆ operator=()

ColorSource& impeller::interop::ColorSource::operator= | ( | const ColorSource & |  | ) |
| delete

The documentation for this class was generated from the following files:

- impeller/toolkit/interop/color_source.h
- impeller/toolkit/interop/color_source.cc

impeller::interop::ToSkiaType
constexpr std::optional< SkRect > ToSkiaType(const ImpellerRect *rect)
Definition: formats.h:26
impeller::interop::ToSkMatrix
constexpr SkMatrix ToSkMatrix(const Matrix &matrix)
Definition: formats.h:81