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

147 : 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 155 of file color_source.cc.

156 {
157 return color_source_;
158 }

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

## ◆ IsValid()

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

Definition at line 151 of file color_source.cc.

151 {
152 return !!color_source_;
153 }

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

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

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

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

References impeller::interop::FragmentProgram::FindRuntimeStage(), impeller::interop::Context::GetContext(), flutter::DlRuntimeEffectImpeller::Make(), 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 101 of file color_source.cc.

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

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

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

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 auto dl_filter = flutter::DlColorSource::MakeRadial(center, //
40 radius, //
41 stops.size(), //
42 colors.data(), //
43 stops.data(), //
44 tile_mode, //
45 &transformation //
46 );
47 if (!dl_filter) {
48 return nullptr;
49 }
50 return Create<ColorSource>(std::move(dl_filter));
51 }

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

85 {
86 auto dl_filter = flutter::DlColorSource::MakeSweep(center, //
87 start, //
88 end, //
89 stops.size(), //
90 colors.data(), //
91 stops.data(), //
92 tile_mode, //
93 &transformation //
94 );
95 if (!dl_filter) {
96 return nullptr;
97 }
98 return Create<ColorSource>(std::move(dl_filter));
99 }
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