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
33
void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
canvas->clear(0xFF'00AAFF);
paint.setStyle(SkPaint::kFill_Style);
paint.setColor(0xFF'FFFF00);
SkPath path;
SkParsePath::FromSVGString(
"m480-121-41-37q-105.768-97.121-174.884-167.561Q195-396 "
"154-451.5T96.5-552Q80-597 80-643q0-90.155 60.5-150.577Q201-854 "
"290-854q57 0 105.5 27t84.5 78q42-54 89-79.5T670-854q89 0 149.5 "
"60.423Q880-733.155 880-643q0 46-16.5 91T806-451.5Q765-396 "
"695.884-325.561 626.768-255.121 521-158l-41 37Zm0-79q101.236-92.995 "
"166.618-159.498Q712-426 750.5-476t54-89.135q15.5-39.136 "
"15.5-77.72Q820-709 778-751.5T670.225-794q-51.524 0-95.375 "
"31.5Q531-731 504-674h-49q-26-56-69.85-88-43.851-32-95.375-32Q224-794 "
"182-751.5t-42 108.816Q140-604 155.5-564.5t54 90Q248-424 314-358t166 "
"158Zm0-297Z",
&path);
// Compensate for the odd "0 -960 960 960" viewBox
SkScalar scaleFactor = 256.f / 960.f;
SkMatrix transform
= SkMatrix::Scale(scaleFactor, scaleFactor)
* SkMatrix::Translate(0, 960.f);
path.transform(transform);
canvas->drawPath(path, paint);
}