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
// draw_patch
void draw(SkCanvas* canvas) {
canvas->clear(SK_ColorWHITE);
SkPaint p;
p.setAntiAlias(true);
const SkColor colors[] = {SK_ColorRED, SK_ColorCYAN, SK_ColorGREEN, SK_ColorWHITE,
SK_ColorMAGENTA, SK_ColorBLUE, SK_ColorYELLOW};
const SkPoint pts[] = {{100.f / 4.f, 0.f}, {3.f * 100.f / 4.f, 100.f}};
p.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
SkTileMode::kMirror));
const SkPoint cubics[] = {{100, 100}, {150, 50}, {250, 150}, {300, 100},
{250, 150}, {350, 250}, {300, 300}, {250, 250},
{150, 350}, {100, 300}, {50, 250}, {150, 150}};
const SkPoint texCoords[] = {
{0.0f, 0.0f}, {100.0f, 0.0f}, {100.0f, 100.0f}, {0.0f, 100.0f}};
canvas->drawPatch(cubics, nullptr, texCoords, SkBlendMode::kSrcOver, p);
}