Flutter Engine
 
Loading...
Searching...
No Matches
impeller::interop::ColorSource Class Referencefinal

#include <color_source.h>

Inheritance diagram for impeller::interop::ColorSource:
impeller::interop::Object< ColorSource, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerColorSource)> impeller::interop::ObjectBase

Public Member Functions

 ColorSource (std::shared_ptr< flutter::DlColorSource > source)
 
 ~ColorSource () override
 
 ColorSource (const ColorSource &)=delete
 
ColorSourceoperator= (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
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
ObjectBaseoperator= (ObjectBase &&)=delete
 
void Retain ()
 
void Release ()
 
uint64_t GetRefCountForTests () const
 

Static Public Member Functions

static ScopedObject< ColorSourceMakeLinearGradient (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< ColorSourceMakeRadialGradient (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< ColorSourceMakeConicalGradient (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< ColorSourceMakeSweepGradient (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< ColorSourceMakeImage (const Texture &image, flutter::DlTileMode horizontal_tile_mode, flutter::DlTileMode vertical_tile_mode, flutter::DlImageSampling sampling, const Matrix &transformation)
 
static ScopedObject< ColorSourceMakeFragmentProgram (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}
static std::shared_ptr< DlColorSource > MakeConical(DlPoint start_center, DlScalar start_radius, DlPoint end_center, DlScalar end_radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)

References flutter::DlColorSource::MakeConical().

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}
static std::shared_ptr< DlColorSource > MakeRuntimeEffect(sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
static sk_sp< DlRuntimeEffect > Make(std::shared_ptr< impeller::RuntimeStage > runtime_stage)
#define VALIDATION_LOG
Definition validation.h:91

References impeller::interop::FragmentProgram::FindRuntimeStage(), impeller::interop::Context::GetContext(), flutter::DlRuntimeEffectImpeller::Make(), flutter::DlColorSource::MakeRuntimeEffect(), 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}
static std::shared_ptr< DlColorSource > MakeImage(const sk_sp< const DlImage > &image, DlTileMode horizontal_tile_mode, DlTileMode vertical_tile_mode, DlImageSampling sampling=DlImageSampling::kLinear, const DlMatrix *matrix=nullptr)
FlutterVulkanImage * image

References image, and flutter::DlColorSource::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}
static std::shared_ptr< DlColorSource > MakeLinear(const DlPoint start_point, const DlPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)

References flutter::DlColorSource::MakeLinear().

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}
static std::shared_ptr< DlColorSource > MakeRadial(DlPoint center, DlScalar radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)

References flutter::DlColorSource::MakeRadial().

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}
static std::shared_ptr< DlColorSource > MakeSweep(DlPoint center, DlScalar start, DlScalar end, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
const size_t end

References end, flutter::DlColorSource::MakeSweep(), 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: