Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
flutter::DlColorSource Class Referenceabstract

#include <dl_color_source.h>

Inheritance diagram for flutter::DlColorSource:
flutter::DlAttribute< DlColorSource, DlColorSourceType > flutter::DlColorColorSource 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. More...
 
virtual bool isGradient () const
 If the underlying platform data represents a gradient. More...
 
virtual const DlColorColorSourceasColor () const
 
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< DlLinearGradientColorSourceMakeLinear (const SkPoint start_point, const SkPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
 
static std::shared_ptr< DlRadialGradientColorSourceMakeRadial (SkPoint center, SkScalar radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
 
static std::shared_ptr< DlConicalGradientColorSourceMakeConical (SkPoint start_center, SkScalar start_radius, SkPoint end_center, SkScalar end_radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
 
static std::shared_ptr< DlSweepGradientColorSourceMakeSweep (SkPoint center, SkScalar start, SkScalar end, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
 
static std::shared_ptr< DlRuntimeEffectColorSourceMakeRuntimeEffect (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 64 of file dl_color_source.h.

Constructor & Destructor Documentation

◆ DlColorSource()

flutter::DlColorSource::DlColorSource ( )
protecteddefault

Member Function Documentation

◆ asColor()

virtual const DlColorColorSource * flutter::DlColorSource::asColor ( ) const
inlinevirtual

Reimplemented in flutter::DlColorColorSource.

Definition at line 134 of file dl_color_source.h.

134{ return nullptr; }

◆ asConicalGradient()

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

Reimplemented in flutter::DlConicalGradientColorSource.

Definition at line 154 of file dl_color_source.h.

154 {
155 return nullptr;
156 }

◆ asImage()

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

Reimplemented in flutter::DlImageColorSource.

Definition at line 138 of file dl_color_source.h.

138{ return nullptr; }

◆ asLinearGradient()

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

Reimplemented in flutter::DlLinearGradientColorSource.

Definition at line 142 of file dl_color_source.h.

142 {
143 return nullptr;
144 }

◆ asRadialGradient()

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

Reimplemented in flutter::DlRadialGradientColorSource.

Definition at line 148 of file dl_color_source.h.

148 {
149 return nullptr;
150 }

◆ asRuntimeEffect()

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

Reimplemented in flutter::DlRuntimeEffectColorSource.

Definition at line 164 of file dl_color_source.h.

164 {
165 return nullptr;
166 }

◆ asSweepGradient()

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

Reimplemented in flutter::DlSweepGradientColorSource.

Definition at line 160 of file dl_color_source.h.

160 {
161 return nullptr;
162 }

◆ 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 130 of file dl_color_source.h.

130{ return false; }

◆ 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::DlColorColorSource, flutter::DlImageColorSource, flutter::DlLinearGradientColorSource, flutter::DlRadialGradientColorSource, flutter::DlConicalGradientColorSource, flutter::DlSweepGradientColorSource, and flutter::DlRuntimeEffectColorSource.

◆ MakeConical()

std::shared_ptr< DlConicalGradientColorSource > flutter::DlColorSource::MakeConical ( SkPoint  start_center,
SkScalar  start_radius,
SkPoint  end_center,
SkScalar  end_radius,
uint32_t  stop_count,
const DlColor colors,
const float *  stops,
DlTileMode  tile_mode,
const SkMatrix matrix = nullptr 
)
static

Definition at line 63 of file dl_color_source.cc.

72 {
73 size_t needed = sizeof(DlConicalGradientColorSource) +
74 (stop_count * (sizeof(uint32_t) + sizeof(float)));
75
76 void* storage = ::operator new(needed);
77
78 std::shared_ptr<DlConicalGradientColorSource> ret;
79 ret.reset(new (storage) DlConicalGradientColorSource(
80 start_center, start_radius, end_center, end_radius, stop_count,
81 colors, stops, tile_mode, matrix),
83 return ret;
84}
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
PODArray< SkColor > colors
Definition: SkRecords.h:276
static void DlGradientDeleter(void *p)

◆ MakeLinear()

std::shared_ptr< DlLinearGradientColorSource > flutter::DlColorSource::MakeLinear ( const SkPoint  start_point,
const SkPoint  end_point,
uint32_t  stop_count,
const DlColor colors,
const float *  stops,
DlTileMode  tile_mode,
const SkMatrix matrix = nullptr 
)
static

Definition at line 22 of file dl_color_source.cc.

29 {
30 size_t needed = sizeof(DlLinearGradientColorSource) +
31 (stop_count * (sizeof(uint32_t) + sizeof(float)));
32
33 void* storage = ::operator new(needed);
34
35 std::shared_ptr<DlLinearGradientColorSource> ret;
36 ret.reset(new (storage)
37 DlLinearGradientColorSource(start_point, end_point, stop_count,
38 colors, stops, tile_mode, matrix),
40 return ret;
41}

◆ MakeRadial()

std::shared_ptr< DlRadialGradientColorSource > flutter::DlColorSource::MakeRadial ( SkPoint  center,
SkScalar  radius,
uint32_t  stop_count,
const DlColor colors,
const float *  stops,
DlTileMode  tile_mode,
const SkMatrix matrix = nullptr 
)
static

Definition at line 43 of file dl_color_source.cc.

50 {
51 size_t needed = sizeof(DlRadialGradientColorSource) +
52 (stop_count * (sizeof(uint32_t) + sizeof(float)));
53
54 void* storage = ::operator new(needed);
55
56 std::shared_ptr<DlRadialGradientColorSource> ret;
57 ret.reset(new (storage) DlRadialGradientColorSource(
58 center, radius, stop_count, colors, stops, tile_mode, matrix),
60 return ret;
61}

◆ MakeRuntimeEffect()

std::shared_ptr< DlRuntimeEffectColorSource > 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 108 of file dl_color_source.cc.

111 {
112 FML_DCHECK(uniform_data != nullptr);
113 return std::make_shared<DlRuntimeEffectColorSource>(
114 std::move(runtime_effect), std::move(samplers), std::move(uniform_data));
115}
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ MakeSweep()

std::shared_ptr< DlSweepGradientColorSource > flutter::DlColorSource::MakeSweep ( SkPoint  center,
SkScalar  start,
SkScalar  end,
uint32_t  stop_count,
const DlColor colors,
const float *  stops,
DlTileMode  tile_mode,
const SkMatrix matrix = nullptr 
)
static

Definition at line 86 of file dl_color_source.cc.

94 {
95 size_t needed = sizeof(DlSweepGradientColorSource) +
96 (stop_count * (sizeof(uint32_t) + sizeof(float)));
97
98 void* storage = ::operator new(needed);
99
100 std::shared_ptr<DlSweepGradientColorSource> ret;
101 ret.reset(new (storage)
102 DlSweepGradientColorSource(center, start, end, stop_count,
103 colors, stops, tile_mode, matrix),
105 return ret;
106}

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