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
26
void write_text(SkCanvas* canvas, sk_sp<SkTypeface> typeface) {
SkString name;
typeface->getFamilyName(&name);
auto sizeStr = SkStringPrintf("chars: '%d'", name.size());
auto nameStr = SkStringPrintf("name: '%s'", name.c_str());
SkPaint paint;
paint.setTypeface(typeface);
paint.setTextSize(40);
canvas->drawText(nameStr.c_str(), nameStr.size(), 20, 50, paint);
canvas->drawText(sizeStr.c_str(), sizeStr.size(), 20, 100, paint);
}
void draw(SkCanvas* canvas) {
canvas->clear(SkColorSetARGB(255, 255, 255, 255));
auto typeface = SkTypeface::MakeFromFile("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 0);
write_text(canvas, typeface);
canvas->translate(0, 150);
typeface = SkTypeface::MakeDefault();
write_text(canvas, typeface);
}