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
24
void draw(SkCanvas* canvas) {
const struct { SkColor4f fColor; const char* fName; } kColors[] = {
{SkColors::kBlack, "SkColors::kBlack"},
{SkColors::kDkGray, "SkColors::kDkGray"},
{SkColors::kGray, "SkColors::kGray"},
{SkColors::kLtGray, "SkColors::kLtGray"},
{SkColors::kWhite, "SkColors::kWhite"},
{SkColors::kRed, "SkColors::kRed"},
{SkColors::kGreen, "SkColors::kGreen"},
{SkColors::kBlue, "SkColors::kBlue"},
{SkColors::kYellow, "SkColors::kYellow"},
{SkColors::kCyan, "SkColors::kCyan"},
{SkColors::kMagenta, "SkColors::kMagenta"},
};
float y = 0;
constexpr float kSize = 256.0f / (sizeof(kColors) / sizeof(kColors[0]));
const SkColor4f kBrown{0.5f, 0.25f, 0, 1};
SkFont defaultFont = SkFont(fontMgr->matchFamilyStyle(nullptr, {}));
for (const auto& c : kColors) {
canvas->drawRect(SkRect{0, y, 128, y + kSize}, SkPaint(c.fColor));
canvas->drawString(c.fName, 4, y + kSize * 0.7f, defaultFont, SkPaint(kBrown));
y += kSize;
}
}