Flutter Engine
The Flutter Engine
Functions
Surface_makeImageSnapshot.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Surface_makeImageSnapshot, 256, 64, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Surface_makeImageSnapshot  ,
256  ,
64  ,
false  ,
 
)

Definition at line 4 of file Surface_makeImageSnapshot.cpp.

4 {
5void draw(SkCanvas* canvas) {
7 sk_sp<SkSurface> lil(big->makeSurface(SkImageInfo::MakeN32(32, 32, kPremul_SkAlphaType)));
8 big->getCanvas()->clear(SK_ColorRED);
9 lil->getCanvas()->clear(SK_ColorBLACK);
10 sk_sp<SkImage> early(big->makeImageSnapshot());
11 lil->draw(big->getCanvas(), 16, 16);
12 sk_sp<SkImage> later(big->makeImageSnapshot());
13 canvas->drawImage(early, 0, 0);
14 canvas->drawImage(later, 128, 0);
15}
16} // 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
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)