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
25
void draw(SkCanvas* canvas) {
std::string text{"Hello, World!"};
SkFont font{};
font.setSize(32);
SkPaint p_white;
p_white.setColor(SkColor4f{ 1.0f, 1.0f, 1.0f, 1.0f });
SkPaint p_red;
p_red.setColor(SkColor4f{ 1.0f, 0.0f, 0.0f, 1.0f });
SkPaint p_green;
p_green.setColor(SkColor4f{ 0.0f, 1.0f, 0.0f, 1.0f });
SkPaint p_blue;
p_blue.setColor(SkColor4f{ 0.0f, 0.0f, 1.0f, 1.0f });
canvas->clear(SkColor4f{ 0.0f, 0.0f, 0.0f, 0.0f });
canvas->drawSimpleText(text.data(), text.size(), SkTextEncoding::kUTF8, 16.0f, 32.0f, font, p_white);
canvas->drawSimpleText(text.data(), text.size(), SkTextEncoding::kUTF8, 16.0f, 64.0f, font, p_red);
canvas->drawSimpleText(text.data(), text.size(), SkTextEncoding::kUTF8, 16.0f, 96.0f, font, p_green);
canvas->drawSimpleText(text.data(), text.size(), SkTextEncoding::kUTF8, 16.0f, 128.0f, font, p_blue);
}