5#include "flutter/lib/ui/painting/gradient.h"
7#include "flutter/lib/ui/floating_point.h"
22 auto res = fml::MakeRefCounted<CanvasGradient>();
23 res->AssociateWithDartWrapper(wrapper);
27 const tonic::Int32List&
colors,
28 const tonic::Float32List& color_stops,
30 const tonic::Float64List& matrix4) {
33 color_stops.data() ==
nullptr);
35 static_assert(
sizeof(
SkPoint) ==
sizeof(
float) * 2,
36 "SkPoint doesn't use floats.");
37 static_assert(
sizeof(
SkColor) ==
sizeof(int32_t),
38 "SkColor doesn't use int32_t.");
41 bool has_matrix = matrix4.data() !=
nullptr;
51 p0, p1,
colors.num_elements(), colors_array, color_stops.data(),
52 tile_mode, has_matrix ? &
sk_matrix :
nullptr);
60 const tonic::Int32List&
colors,
61 const tonic::Float32List& color_stops,
63 const tonic::Float64List& matrix4) {
65 color_stops.data() ==
nullptr);
67 static_assert(
sizeof(
SkColor) ==
sizeof(int32_t),
68 "SkColor doesn't use int32_t.");
71 bool has_matrix = matrix4.data() !=
nullptr;
81 color_stops.data(), tile_mode, has_matrix ? &
sk_matrix :
nullptr);
88 const tonic::Int32List&
colors,
89 const tonic::Float32List& color_stops,
93 const tonic::Float64List& matrix4) {
95 color_stops.data() ==
nullptr);
97 static_assert(
sizeof(
SkColor) ==
sizeof(int32_t),
98 "SkColor doesn't use int32_t.");
101 bool has_matrix = matrix4.data() !=
nullptr;
112 colors.num_elements(), colors_array, color_stops.data(), tile_mode,
124 const tonic::Int32List&
colors,
125 const tonic::Float32List& color_stops,
127 const tonic::Float64List& matrix4) {
129 color_stops.data() ==
nullptr);
131 static_assert(
sizeof(
SkColor) ==
sizeof(int32_t),
132 "SkColor doesn't use int32_t.");
135 bool has_matrix = matrix4.data() !=
nullptr;
147 color_stops.data(), tile_mode, has_matrix ? &
sk_matrix :
nullptr);
152CanvasGradient::CanvasGradient() =
default;
static void Create(Dart_Handle wrapper)
void initRadial(double center_x, double center_y, double radius, const tonic::Int32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, const tonic::Float64List &matrix4)
void initLinear(const tonic::Float32List &end_points, const tonic::Int32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, 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::Int32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, const tonic::Float64List &matrix4)
void initSweep(double center_x, double center_y, const tonic::Int32List &colors, const tonic::Float32List &color_stops, DlTileMode tile_mode, double start_angle, double end_angle, const tonic::Float64List &matrix4)
~CanvasGradient() override
static std::shared_ptr< DlConicalGradientColorSource > 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 std::shared_ptr< DlLinearGradientColorSource > 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 std::shared_ptr< DlSweepGradientColorSource > 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 std::shared_ptr< DlRadialGradientColorSource > MakeRadial(SkPoint center, SkScalar radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
static void ThrowIfUIOperationsProhibited()
struct _Dart_Handle * Dart_Handle
#define FML_DCHECK(condition)
PODArray< SkColor > colors
IMPLEMENT_WRAPPERTYPEINFO(flutter_gpu, FlutterGpuTestClass)
static float SafeNarrow(double value)
constexpr SkMatrix ToSkMatrix(const DlMatrix &matrix)
static constexpr SkPoint Make(float x, float y)