Options
These globals are now defined:
double duration; // The requested duration of the animation. double frame; // A value in [0, 1] of where we are in the animation.
This global is now defined:
GrBackendRenderTarget backEndRenderTarget;
GrBackendTexture backEndTextureRenderTarget;
Optional source image
These globals are now defined:
SkBitmap source; sk_sp<SkImage> image; GrBackendTexture backEndTexture; // GPU Only.
Note:
Adding comments with SK_FOLD_START and SK_FOLD_END creates
foldable code blocks.
These blocks will be folded by default and are useful for highlighting specific lines of code.
You can also use the keyboard shortcuts Ctrl+S and Ctrl+E in the code editor to set them.
These blocks will be folded by default and are useful for highlighting specific lines of code.
You can also use the keyboard shortcuts Ctrl+S and Ctrl+E in the code editor to set them.
xxxxxxxxxx
40
void draw(SkCanvas* canvas) {
SkScalar width = 300;
SkScalar height = 100;
SkScalar radius_tl = 64;
SkScalar radius_tr = 16;
SkScalar radius_br = 48;
SkScalar radius_bl = 8;
SkPath path;
auto corner_tl = SkRect::MakeXYWH(0, 0, radius_tl*2, radius_tl*2);
path.arcTo(corner_tl, -180, 90, true);
path.lineTo(width-radius_tr, 0);
auto corner_tr = SkRect::MakeXYWH(width-radius_tr*2, 0, radius_tr*2, radius_tr*2);
path.arcTo(corner_tr, -90, 90, false);
path.lineTo(width, height-radius_br);
auto corner_br = SkRect::MakeXYWH(width-radius_br*2, height-radius_br*2, radius_br*2, radius_br*2);
path.arcTo(corner_br, 0, 90, false);
path.lineTo(radius_bl, height);
auto corner_bl = SkRect::MakeXYWH(0, height-radius_bl*2, radius_bl*2, radius_bl*2);
path.arcTo(corner_bl, 90, 90, false);
path.lineTo(0, radius_tl);
path.close();
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(SK_ColorWHITE);
paint.setStyle(SkPaint::kFill_Style);
canvas->clear(SK_ColorTRANSPARENT);
canvas->drawPath(path, paint);
}