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
26
void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setStrokeWidth(5);
SkRegion region;
region.op({140, 10, 160, 30}, SkRegion::kUnion_Op);
region.op({170, 40, 190, 60}, SkRegion::kUnion_Op);
SkBitmap bitmap;
bitmap.setInfo(SkImageInfo::MakeA8(50, 50), 50);
uint8_t pixels[50][50];
for (int x = 0; x < 50; ++x) {
for (int y = 0; y < 50; ++y) {
pixels[y][x] = (x + y) % 5 ? 0xFF : 0x00;
}
}
bitmap.setPixels(pixels);
for (auto style : { SkPaint::kFill_Style,
SkPaint::kStroke_Style,
SkPaint::kStrokeAndFill_Style }) {
paint.setStyle(style);
canvas->drawLine(10, 10, 60, 60, paint);
canvas->drawRect({80, 10, 130, 60}, paint);
canvas->drawRegion(region, paint);
canvas->drawImage(bitmap.asImage(), 200, 10, SkSamplingOptions(), &paint);
canvas->translate(0, 80);
}
}