sk_shader_t* sk_shader_new_two_point_conical_gradient(const sk_point_t* start, float startRadius, const sk_point_t* end, float endRadius, const sk_color_t colors[], const float colorPos[], int colorCount, sk_shader_tilemode_t cmode, const sk_matrix_t* cmatrix) { SkTileMode mode; if (!from_c_tilemode(cmode, &mode)) { return nullptr; } SkMatrix matrix; if (cmatrix) { from_c_matrix(cmatrix, &matrix); } else { matrix.setIdentity(); } SkPoint skstart = to_skpoint(*start); SkPoint skend = to_skpoint(*end); return (sk_shader_t*)SkGradientShader::MakeTwoPointConical(skstart, (SkScalar)startRadius, skend, (SkScalar)endRadius, reinterpret_cast<const SkColor*>(colors), reinterpret_cast<const SkScalar*>(colorPos), colorCount, mode, 0, &matrix).release(); }
sk_shader_t* sk_shader_new_linear_gradient(const sk_point_t pts[2], const sk_color_t colors[], const float colorPos[], int colorCount, sk_shader_tilemode_t cmode, const sk_matrix_t* cmatrix) { SkShader::TileMode mode; if (!from_c_tilemode(cmode, &mode)) { return NULL; } SkMatrix matrix; if (cmatrix) { from_c_matrix(cmatrix, &matrix); } else { matrix.setIdentity(); } SkShader* s = SkGradientShader::CreateLinear(reinterpret_cast<const SkPoint*>(pts), reinterpret_cast<const SkColor*>(colors), colorPos, colorCount, mode, 0, &matrix); return (sk_shader_t*)s; }
sk_shader_t* sk_shader_new_radial_gradient(const sk_point_t* ccenter, float radius, const sk_color_t colors[], const float colorPos[], int colorCount, sk_shader_tilemode_t cmode, const sk_matrix_t* cmatrix) { SkTileMode mode; if (!from_c_tilemode(cmode, &mode)) { return nullptr; } SkMatrix matrix; if (cmatrix) { from_c_matrix(cmatrix, &matrix); } else { matrix.setIdentity(); } SkPoint center = to_skpoint(*ccenter); return (sk_shader_t*)SkGradientShader::MakeRadial(center, (SkScalar)radius, reinterpret_cast<const SkColor*>(colors), reinterpret_cast<const SkScalar*>(colorPos), colorCount, mode, 0, &matrix).release(); }