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
19
void draw(SkCanvas* canvas) {
const int iterations = 26;
SkRSXform transforms[iterations];
char alphabet[iterations];
SkScalar angle = 0;
SkScalar scale = 1;
for (size_t i = 0; i < std::size(transforms); ++i) {
const SkScalar s = SkScalarSin(angle) * scale;
const SkScalar c = SkScalarCos(angle) * scale;
transforms[i] = SkRSXform::Make(-c, -s, -s * 16, c * 16);
angle += .45f;
scale += .2f;
alphabet[i] = 'A' + i;
}
SkPaint paint;
SkFont font(fontMgr->matchFamilyStyle(nullptr, {}), 20);
auto spiral = SkTextBlob::MakeFromRSXform(alphabet, sizeof(alphabet), transforms, font);
canvas->drawTextBlob(spiral, 110, 138, paint);
}