Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Surface_makeImageSnapshot.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4// HASH=46f1fa0d95e590a64bed0140407ce5f7
5REG_FIDDLE(Surface_makeImageSnapshot, 256, 64, false, 0) {
6void draw(SkCanvas* canvas) {
8 sk_sp<SkSurface> lil(big->makeSurface(SkImageInfo::MakeN32(32, 32, kPremul_SkAlphaType)));
9 big->getCanvas()->clear(SK_ColorRED);
10 lil->getCanvas()->clear(SK_ColorBLACK);
11 sk_sp<SkImage> early(big->makeImageSnapshot());
12 lil->draw(big->getCanvas(), 16, 16);
13 sk_sp<SkImage> later(big->makeImageSnapshot());
14 canvas->drawImage(early, 0, 0);
15 canvas->drawImage(later, 128, 0);
16}
17} // END FIDDLE
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)