| 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 ScopedObject< ColorSource > | MakeImage (const Texture &image, flutter::DlTileMode horizontal_tile_mode, flutter::DlTileMode vertical_tile_mode, flutter::DlImageSampling sampling, const Matrix &transformation)
static ScopedObject< ColorSource > | MakeFragmentProgram (const Context &context, const FragmentProgram &program, std::vector< std::shared_ptr< flutter::DlColorSource >> samplers, std::shared_ptr< std::vector< uint8_t >> uniform_data)
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 22 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 144 of file color_source.cc.

145 : 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 153 of file color_source.cc.

154 {
155 return color_source_;
156 }

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

## ◆ IsValid()

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

Definition at line 149 of file color_source.cc.

149 {
150 return !!color_source_;
151 }

## ◆ 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 51 of file color_source.cc.

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

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

## ◆ MakeFragmentProgram()

ScopedObject< ColorSource > impeller::interop::ColorSource::MakeFragmentProgram | ( | const Context & | context,
|  | const FragmentProgram & | program,
|  | std::vector< std::shared_ptr< flutter::DlColorSource >> | samplers,
|  | std::shared_ptr< std::vector< uint8_t >> | uniform_data
| ) |  |
| static

Definition at line 114 of file color_source.cc.

118 {
119 auto runtime_stage =
120 program.FindRuntimeStage(context.GetContext()->GetRuntimeStageBackend());
121 if (!runtime_stage) {
122 VALIDATION_LOG << "Could not find runtime stage for backend.";
123 return nullptr;
124 }
125 auto runtime_effect =
126 flutter::DlRuntimeEffect::MakeImpeller(std::move(runtime_stage));
127 if (!runtime_effect) {
128 VALIDATION_LOG << "Could not make runtime effect.";
129 return nullptr;
130 }
131
132 auto dl_filter =
133 flutter::DlColorSource::MakeRuntimeEffect(std::move(runtime_effect), //
134 std::move(samplers), //
135 std::move(uniform_data) //
136 );
137 if (!dl_filter) {
138 VALIDATION_LOG << "Could not create runtime effect color source.";
139 return nullptr;
140 }
141 return Create<ColorSource>(std::move(dl_filter));
142 }
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::interop::FragmentProgram::FindRuntimeStage(), impeller::interop::Context::GetContext(), and VALIDATION_LOG.

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

## ◆ MakeImage()

ScopedObject< ColorSource > impeller::interop::ColorSource::MakeImage | ( | const Texture & | image,
|  | flutter::DlTileMode | horizontal_tile_mode,
|  | flutter::DlTileMode | vertical_tile_mode,
|  | flutter::DlImageSampling | sampling,
|  | const Matrix & | transformation
| ) |  |
| static

Definition at line 99 of file color_source.cc.

104 {
105 auto dl_filter = flutter::DlColorSource::MakeImage(image.MakeImage(), //
106 horizontal_tile_mode, //
107 vertical_tile_mode, //
108 sampling, //
109 &transformation //
110 );
111 return Create<ColorSource>(std::move(dl_filter));
112 }

References impeller::interop::Texture::MakeImage().

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

## ◆ 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 auto dl_filter = flutter::DlColorSource::MakeLinear(start_point, //
17 end_point, //
18 stops.size(), //
19 colors.data(), //
20 stops.data(), //
21 tile_mode, //
22 &transformation //
23 );
24 if (!dl_filter) {
25 return nullptr;
26 }
27 return Create<ColorSource>(std::move(dl_filter));
28 }

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 30 of file color_source.cc.

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

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 76 of file color_source.cc.

83 {
84 auto dl_filter = flutter::DlColorSource::MakeSweep(center, //
85 start, //
86 end, //
87 stops.size(), //
88 colors.data(), //
89 stops.data(), //
90 tile_mode, //
91 &transformation //
92 );
93 if (!dl_filter) {
94 return nullptr;
95 }
96 return Create<ColorSource>(std::move(dl_filter));
97 }
start
const size_t start
Definition: tessellator_libtess.cc:62
end
const size_t end
Definition: tessellator_libtess.cc:63

References end, and start.

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