Flutter Engine
 
Loading...
Searching...
No Matches
flutter::DlColorSource Class Referenceabstract

#include <dl_color_source.h>

Inheritance diagram for flutter::DlColorSource:
flutter::DlAttribute< DlColorSource, DlColorSourceType > flutter::DlMatrixColorSourceBase flutter::DlRuntimeEffectColorSource flutter::DlGradientColorSourceBase flutter::DlImageColorSource flutter::DlConicalGradientColorSource flutter::DlLinearGradientColorSource flutter::DlRadialGradientColorSource flutter::DlSweepGradientColorSource

Public Member Functions

virtual bool is_opaque () const =0
 
virtual bool isUIThreadSafe () const =0
 If the underlying platform data held by this object is held in a way that it can be stored and potentially released from the UI thread, this method returns true.
 
virtual bool isGradient () const
 If the underlying platform data represents a gradient.
 
virtual const DlImageColorSourceasImage () const
 
virtual const DlLinearGradientColorSourceasLinearGradient () const
 
virtual const DlRadialGradientColorSourceasRadialGradient () const
 
virtual const DlConicalGradientColorSourceasConicalGradient () const
 
virtual const DlSweepGradientColorSourceasSweepGradient () const
 
virtual const DlRuntimeEffectColorSourceasRuntimeEffect () const
 
- Public Member Functions inherited from flutter::DlAttribute< DlColorSource, DlColorSourceType >
virtual DlColorSourceType type () const=0
 
virtual size_t size () const=0
 
virtual std::shared_ptr< DlColorSourceshared () const=0
 
bool operator== (DlColorSource const &other) const
 
bool operator!= (DlColorSource const &other) const
 
virtual ~DlAttribute ()=default
 

Static Public Member Functions

static std::shared_ptr< DlColorSourceMakeImage (const sk_sp< const DlImage > &image, DlTileMode horizontal_tile_mode, DlTileMode vertical_tile_mode, DlImageSampling sampling=DlImageSampling::kLinear, const DlMatrix *matrix=nullptr)
 
static std::shared_ptr< DlColorSourceMakeLinear (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)
 
static std::shared_ptr< DlColorSourceMakeLinear (const DlPoint start_point, const DlPoint end_point, uint32_t stop_count, const DlScalar *colors_argb, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 Make a linear gradient.
 
static std::shared_ptr< DlColorSourceMakeRadial (DlPoint center, DlScalar radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 
static std::shared_ptr< DlColorSourceMakeRadial (DlPoint center, DlScalar radius, uint32_t stop_count, const DlScalar *colors_argb, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 Make a radial gradient.
 
static std::shared_ptr< DlColorSourceMakeConical (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)
 
static std::shared_ptr< DlColorSourceMakeConical (DlPoint start_center, DlScalar start_radius, DlPoint end_center, DlScalar end_radius, uint32_t stop_count, const DlScalar *colors_argb, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 Make a conical gradient.
 
static std::shared_ptr< DlColorSourceMakeSweep (DlPoint center, DlScalar start, DlScalar end, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 
static std::shared_ptr< DlColorSourceMakeSweep (DlPoint center, DlScalar start, DlScalar end, uint32_t stop_count, const DlScalar *colors_argb, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
 Make a sweep gradient.
 
static std::shared_ptr< DlColorSourceMakeRuntimeEffect (sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
 

Protected Member Functions

 DlColorSource ()=default
 
- Protected Member Functions inherited from flutter::DlAttribute< DlColorSource, DlColorSourceType >
virtual bool equals_ (DlColorSource const &other) const=0
 

Detailed Description

Definition at line 44 of file dl_color_source.h.

Constructor & Destructor Documentation

◆ DlColorSource()

flutter::DlColorSource::DlColorSource ( )
protecteddefault

Member Function Documentation

◆ asConicalGradient()

virtual const DlConicalGradientColorSource * flutter::DlColorSource::asConicalGradient ( ) const
inlinevirtual

◆ asImage()

virtual const DlImageColorSource * flutter::DlColorSource::asImage ( ) const
inlinevirtual

◆ asLinearGradient()

virtual const DlLinearGradientColorSource * flutter::DlColorSource::asLinearGradient ( ) const
inlinevirtual

◆ asRadialGradient()

virtual const DlRadialGradientColorSource * flutter::DlColorSource::asRadialGradient ( ) const
inlinevirtual

◆ asRuntimeEffect()

virtual const DlRuntimeEffectColorSource * flutter::DlColorSource::asRuntimeEffect ( ) const
inlinevirtual

Reimplemented in flutter::DlRuntimeEffectColorSource.

Definition at line 198 of file dl_color_source.h.

198 {
199 return nullptr;
200 }

Referenced by impeller::Paint::CreateContents(), flutter::testing::TEST(), and flutter::ToSk().

◆ asSweepGradient()

virtual const DlSweepGradientColorSource * flutter::DlColorSource::asSweepGradient ( ) const
inlinevirtual

◆ is_opaque()

virtual bool flutter::DlColorSource::is_opaque ( ) const
pure virtual

◆ isGradient()

virtual bool flutter::DlColorSource::isGradient ( ) const
inlinevirtual

If the underlying platform data represents a gradient.

        TODO(matanl): Remove this flag when the Skia backend is
        removed, https://github.com/flutter/flutter/issues/112498.
Returns
True if the class represents the output of a gradient.

Reimplemented in flutter::DlGradientColorSourceBase.

Definition at line 168 of file dl_color_source.h.

168{ return false; }

Referenced by flutter::DlSkPaintDispatchHelper::setColorSource().

◆ isUIThreadSafe()

virtual bool flutter::DlColorSource::isUIThreadSafe ( ) const
pure virtual

If the underlying platform data held by this object is held in a way that it can be stored and potentially released from the UI thread, this method returns true.

Returns
True if the class has no GPU related resources or if any that it holds are held in a thread-safe manner.

Implemented in flutter::DlConicalGradientColorSource, flutter::DlImageColorSource, flutter::DlLinearGradientColorSource, flutter::DlRadialGradientColorSource, flutter::DlRuntimeEffectColorSource, and flutter::DlSweepGradientColorSource.

◆ MakeConical() [1/2]

std::shared_ptr< DlColorSource > flutter::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 
)
static

Definition at line 120 of file dl_color_source.cc.

129 {
130 size_t needed =
131 CalculateGradientSize<DlConicalGradientColorSource>(stop_count);
132 void* storage = ::operator new(needed);
133
134 std::shared_ptr<DlConicalGradientColorSource> ret;
135 ret.reset(new (storage) DlConicalGradientColorSource(
136 start_center, start_radius, end_center, end_radius, stop_count,
137 colors, stops, tile_mode, matrix),
139 return ret;
140}
static void DlGradientDeleter(void *p)

References flutter::DlGradientDeleter().

Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), flutter::CanvasGradient::initTwoPointConical(), impeller::interop::ColorSource::MakeConicalGradient(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), impeller::testing::TEST_F(), and impeller::testing::TEST_P().

◆ MakeConical() [2/2]

std::shared_ptr< DlColorSource > flutter::DlColorSource::MakeConical ( DlPoint  start_center,
DlScalar  start_radius,
DlPoint  end_center,
DlScalar  end_radius,
uint32_t  stop_count,
const DlScalar colors_argb,
const float *  stops,
DlTileMode  tile_mode,
const DlMatrix matrix = nullptr 
)
static

Make a conical gradient.

Parameters
colors_argbcolors_argb Array of DlScalars that represents colors in the ARGB format, in the extended srgb colorspace.

Definition at line 142 of file dl_color_source.cc.

151 {
152 size_t needed =
153 CalculateGradientSize<DlConicalGradientColorSource>(stop_count);
154
155 void* storage = ::operator new(needed);
156
157 std::shared_ptr<DlConicalGradientColorSource> ret;
158 ret.reset(new (storage) DlConicalGradientColorSource(
159 start_center, start_radius, end_center, end_radius, stop_count,
160 colors_argb, stops, tile_mode, matrix),
162 return ret;
163}

References flutter::DlGradientDeleter().

◆ MakeImage()

◆ MakeLinear() [1/2]

std::shared_ptr< DlColorSource > flutter::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 
)
static

Definition at line 41 of file dl_color_source.cc.

48 {
49 size_t needed =
50 CalculateGradientSize<DlLinearGradientColorSource>(stop_count);
51 void* storage = ::operator new(needed);
52
53 std::shared_ptr<DlLinearGradientColorSource> ret;
54 ret.reset(new (storage)
55 DlLinearGradientColorSource(start_point, end_point, stop_count,
56 colors, stops, tile_mode, matrix),
58 return ret;
59}

References flutter::DlGradientDeleter().

Referenced by impeller::testing::CanRenderLinearGradientWithDithering(), impeller::testing::DoGradientOvalStrokeMaskBlur(), flutter::CanvasGradient::initLinear(), flutter::testing::MakeFilter(), impeller::interop::ColorSource::MakeLinearGradient(), flutter::testing::CanvasCompareTester::RenderWithAttributes(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), and impeller::testing::TEST_P().

◆ MakeLinear() [2/2]

std::shared_ptr< DlColorSource > flutter::DlColorSource::MakeLinear ( const DlPoint  start_point,
const DlPoint  end_point,
uint32_t  stop_count,
const DlScalar colors_argb,
const float *  stops,
DlTileMode  tile_mode,
const DlMatrix matrix = nullptr 
)
static

Make a linear gradient.

Parameters
colors_argbArray of DlScalars that represents colors in the ARGB format, in the extended srgb colorspace.

Definition at line 61 of file dl_color_source.cc.

68 {
69 size_t needed =
70 CalculateGradientSize<DlLinearGradientColorSource>(stop_count);
71 void* storage = ::operator new(needed);
72
73 std::shared_ptr<DlLinearGradientColorSource> ret;
74 ret.reset(new (storage) DlLinearGradientColorSource(start_point, end_point,
75 stop_count, colors_argb,
76 stops, tile_mode, matrix),
78 return ret;
79}

References flutter::DlGradientDeleter().

◆ MakeRadial() [1/2]

std::shared_ptr< DlColorSource > flutter::DlColorSource::MakeRadial ( DlPoint  center,
DlScalar  radius,
uint32_t  stop_count,
const DlColor colors,
const float *  stops,
DlTileMode  tile_mode,
const DlMatrix matrix = nullptr 
)
static

◆ MakeRadial() [2/2]

std::shared_ptr< DlColorSource > flutter::DlColorSource::MakeRadial ( DlPoint  center,
DlScalar  radius,
uint32_t  stop_count,
const DlScalar colors_argb,
const float *  stops,
DlTileMode  tile_mode,
const DlMatrix matrix = nullptr 
)
static

Make a radial gradient.

Parameters
colors_argbArray of DlScalars that represents colors in the ARGB format, in the extended srgb colorspace.

Definition at line 100 of file dl_color_source.cc.

107 {
108 size_t needed =
109 CalculateGradientSize<DlRadialGradientColorSource>(stop_count);
110 void* storage = ::operator new(needed);
111
112 std::shared_ptr<DlRadialGradientColorSource> ret;
113 ret.reset(
114 new (storage) DlRadialGradientColorSource(
115 center, radius, stop_count, colors_argb, stops, tile_mode, matrix),
117 return ret;
118}

References flutter::DlGradientDeleter().

◆ MakeRuntimeEffect()

std::shared_ptr< DlColorSource > flutter::DlColorSource::MakeRuntimeEffect ( sk_sp< DlRuntimeEffect runtime_effect,
std::vector< std::shared_ptr< DlColorSource > >  samplers,
std::shared_ptr< std::vector< uint8_t > >  uniform_data 
)
static

Definition at line 205 of file dl_color_source.cc.

208 {
209 FML_DCHECK(uniform_data != nullptr);
210 return std::make_shared<DlRuntimeEffectColorSource>(
211 std::move(runtime_effect), std::move(samplers), std::move(uniform_data));
212}
#define FML_DCHECK(condition)
Definition logging.h:122

References FML_DCHECK.

Referenced by flutter::FragmentProgram::MakeDlColorSource(), impeller::interop::ColorSource::MakeFragmentProgram(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), and impeller::testing::TEST_P().

◆ MakeSweep() [1/2]

std::shared_ptr< DlColorSource > flutter::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 
)
static

Definition at line 165 of file dl_color_source.cc.

173 {
174 size_t needed = CalculateGradientSize<DlSweepGradientColorSource>(stop_count);
175 void* storage = ::operator new(needed);
176
177 std::shared_ptr<DlSweepGradientColorSource> ret;
178 ret.reset(new (storage)
179 DlSweepGradientColorSource(center, start, end, stop_count,
180 colors, stops, tile_mode, matrix),
182 return ret;
183}
const size_t end

References flutter::DlGradientDeleter(), end, and start.

Referenced by impeller::testing::CanRenderSweepGradientWithDithering(), flutter::CanvasGradient::initSweep(), impeller::interop::ColorSource::MakeSweepGradient(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), flutter::testing::TEST(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), and impeller::testing::TEST_P().

◆ MakeSweep() [2/2]

std::shared_ptr< DlColorSource > flutter::DlColorSource::MakeSweep ( DlPoint  center,
DlScalar  start,
DlScalar  end,
uint32_t  stop_count,
const DlScalar colors_argb,
const float *  stops,
DlTileMode  tile_mode,
const DlMatrix matrix = nullptr 
)
static

Make a sweep gradient.

Parameters
colors_argbArray of DlScalars that represents colors in the ARGB format, in the extended srgb colorspace.

Definition at line 185 of file dl_color_source.cc.

193 {
194 size_t needed = CalculateGradientSize<DlSweepGradientColorSource>(stop_count);
195 void* storage = ::operator new(needed);
196
197 std::shared_ptr<DlSweepGradientColorSource> ret;
198 ret.reset(new (storage) DlSweepGradientColorSource(center, start, end,
199 stop_count, colors_argb,
200 stops, tile_mode, matrix),
202 return ret;
203}

References flutter::DlGradientDeleter(), end, and start.


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