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(); }
void sk_canvas_draw_picture(sk_canvas_t* ccanvas, const sk_picture_t* cpicture, const sk_matrix_t* cmatrix, const sk_paint_t* cpaint) { const SkMatrix* matrixPtr = NULL; SkMatrix matrix; if (cmatrix) { from_c_matrix(cmatrix, &matrix); matrixPtr = &matrix; } AsCanvas(ccanvas)->drawPicture(AsPicture(cpicture), matrixPtr, AsPaint(cpaint)); }
sk_shader_t* sk_shader_new_sweep_gradient(const sk_point_t* ccenter, const sk_color_t colors[], const float colorPos[], int colorCount, const sk_matrix_t* cmatrix) { SkMatrix matrix; if (cmatrix) { from_c_matrix(cmatrix, &matrix); } else { matrix.setIdentity(); } return (sk_shader_t*)SkGradientShader::MakeSweep((SkScalar)(ccenter->x), (SkScalar)(ccenter->y), reinterpret_cast<const SkColor*>(colors), reinterpret_cast<const SkScalar*>(colorPos), colorCount, 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(); }
void sk_canvas_concat(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix) { SkASSERT(cmatrix); SkMatrix matrix; from_c_matrix(cmatrix, &matrix); AsCanvas(ccanvas)->concat(matrix); }