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
17
constexpr int kWidth = 4;
constexpr int kHeight = 4;
static const uint32_t kPixels[kHeight * kWidth] = {
0xFF000000, 0xFF005500, 0xFF00AA00, 0xFF00FF00,
0xFF000055, 0xFF005555, 0xFF00AA55, 0xFF00FF55,
0xFF0000AA, 0xFF0055AA, 0xFF00AAAA, 0xFF00FFAA,
0xFF0000FF, 0xFF0055FF, 0xFF00AAFF, 0xFF00FFFF,
};
void draw(SkCanvas* canvas) {
SkPixmap pixmap(SkImageInfo::Make(kWidth, kHeight, kN32_SkColorType, kPremul_SkAlphaType),
kPixels, sizeof(uint32_t) * kWidth);
sk_sp<SkImage> img = SkImages::RasterFromPixmap(pixmap, nullptr, nullptr);
canvas->scale(16, 16);
canvas->drawImage(img, 6, 6);
}