22 auto res = fml::MakeRefCounted<CanvasGradient>();
23 res->AssociateWithDartWrapper(wrapper);
27 const tonic::Float32List& colors,
28 const tonic::Float32List& color_stops,
30 const tonic::Float64List& matrix4) {
32 FML_DCHECK(colors.num_elements() == (color_stops.num_elements() * 4) ||
33 color_stops.data() ==
nullptr);
34 int num_colors = colors.num_elements() / 4;
36 static_assert(
sizeof(
DlPoint) ==
sizeof(
float) * 2,
37 "DlPoint doesn't use floats.");
40 bool has_matrix = matrix4.data() !=
nullptr;
48 color_stops.data(), tile_mode,
49 has_matrix ? &dl_matrix :
nullptr);
57 const tonic::Float32List& colors,
58 const tonic::Float32List& color_stops,
60 const tonic::Float64List& matrix4) {
61 FML_DCHECK(colors.num_elements() == (color_stops.num_elements() * 4) ||
62 color_stops.data() ==
nullptr);
63 int num_colors = colors.num_elements() / 4;
66 bool has_matrix = matrix4.data() !=
nullptr;
73 num_colors, colors.data(), color_stops.data(), tile_mode,
74 has_matrix ? &dl_matrix :
nullptr);
81 const tonic::Float32List& colors,
82 const tonic::Float32List& color_stops,
86 const tonic::Float64List& matrix4) {
87 FML_DCHECK(colors.num_elements() == (color_stops.num_elements() * 4) ||
88 color_stops.data() ==
nullptr);
89 int num_colors = colors.num_elements() / 4;
92 bool has_matrix = matrix4.data() !=
nullptr;
99 SafeNarrow(start_angle) * 180.0f /
static_cast<float>(M_PI),
100 SafeNarrow(end_angle) * 180.0f /
static_cast<float>(M_PI), num_colors,
101 colors.data(), color_stops.data(), tile_mode,
102 has_matrix ? &dl_matrix :
nullptr);
113 const tonic::Float32List& colors,
114 const tonic::Float32List& color_stops,
116 const tonic::Float64List& matrix4) {
117 FML_DCHECK(colors.num_elements() == (color_stops.num_elements() * 4) ||
118 color_stops.data() ==
nullptr);
119 int num_colors = colors.num_elements() / 4;
122 bool has_matrix = matrix4.data() !=
nullptr;
130 SafeNarrow(end_radius), num_colors, colors.data(), color_stops.data(),
131 tile_mode, has_matrix ? &dl_matrix :
nullptr);
136CanvasGradient::CanvasGradient() =
default;
void initLinear(const tonic::Float32List &end_points, const tonic::Float32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, const tonic::Float64List &matrix4)
static void Create(Dart_Handle wrapper)
void initSweep(double center_x, double center_y, const tonic::Float32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, double start_angle, double end_angle, const tonic::Float64List &matrix4)
void initTwoPointConical(double start_x, double start_y, double start_radius, double end_x, double end_y, double end_radius, const tonic::Float32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, const tonic::Float64List &matrix4)
~CanvasGradient() override
void initRadial(double center_x, double center_y, double radius, const tonic::Float32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, const tonic::Float64List &matrix4)
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)
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)
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)
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)
static void ThrowIfUIOperationsProhibited()
#define IMPLEMENT_WRAPPERTYPEINFO(LibraryName, ClassName)
#define FML_DCHECK(condition)
static float SafeNarrow(double value)
DlMatrix ToDlMatrix(const SkMatrix &matrix)
A 4x4 matrix using column-major storage.