#ifndef FLUTTER_LIB_UI_PAINTING_GRADIENT_H_
#define FLUTTER_LIB_UI_PAINTING_GRADIENT_H_
#include "flutter/lib/ui/dart_wrapper.h"
#include "flutter/lib/ui/painting/matrix.h"
#include "flutter/lib/ui/painting/shader.h"
#include "include/effects/SkGradientShader.h"
namespace tonic {
class DartLibraryNatives;
}
namespace flutter {
#ifdef USE_SYSTEM_SKIA
static_assert(SkShader::kTileModeCount >= 3, "Need to update tile mode enum");
using SkTileMode = SkShader::TileMode;
#else
static_assert(kSkTileModeCount >= 3, "Need to update tile mode enum");
#endif
class CanvasGradient : public Shader {
DEFINE_WRAPPERTYPEINFO();
FML_FRIEND_MAKE_REF_COUNTED(CanvasGradient);
public:
~CanvasGradient() override;
static fml::RefPtr<CanvasGradient> Create();
void initLinear(const tonic::Float32List& end_points,
const tonic::Int32List& colors,
const tonic::Float32List& color_stops,
SkTileMode tile_mode,
const tonic::Float64List& matrix4);
void initRadial(double center_x,
double center_y,
double radius,
const tonic::Int32List& colors,
const tonic::Float32List& color_stops,
SkTileMode tile_mode,
const tonic::Float64List& matrix4);
void initSweep(double center_x,
double center_y,
const tonic::Int32List& colors,
const tonic::Float32List& color_stops,
SkTileMode 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::Int32List& colors,
const tonic::Float32List& color_stops,
SkTileMode tile_mode,
const tonic::Float64List& matrix4);
static void RegisterNatives(tonic::DartLibraryNatives* natives);
private:
CanvasGradient();
};
}
#endif