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
32
void draw(SkCanvas* canvas) {
auto test_draw = [](SkCanvas* surfaceCanvas) -> void {
SkFont font(fontMgr->matchFamilyStyle(nullptr, {}), 32);
SkPaint paint;
paint.setAntiAlias(true);
// TODO: where did this setting go?
//paint.setLCDRenderText(true);
paint.setColor(0xFFBBBBBB);
surfaceCanvas->drawRect(SkRect::MakeWH(128, 64), paint);
paint.setColor(SK_ColorWHITE);
surfaceCanvas->drawString("Text", 0, 25, font, paint);
};
auto context = canvas->recordingContext();
SkImageInfo info = SkImageInfo::MakeN32(128, 64, kOpaque_SkAlphaType);
int y = 0;
for (auto geometry : { kRGB_H_SkPixelGeometry, kBGR_H_SkPixelGeometry,
kRGB_V_SkPixelGeometry, kBGR_V_SkPixelGeometry } ) {
SkSurfaceProps props(0, geometry);
sk_sp<SkSurface> surface =
context ? SkSurfaces::RenderTarget(context, skgpu::Budgeted::kNo, info, 0, &props)
: SkSurfaces::Raster(info, &props);
test_draw(surface->getCanvas());
surface->draw(canvas, 0, y);
sk_sp<SkImage> image(surface->makeImageSnapshot());
SkAutoCanvasRestore acr(canvas, true);
canvas->scale(8, 8);
canvas->drawImage(image, 12, y / 8);
y += 64;
}
}