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

Go to the source code of this file.

Functions

 REG_FIDDLE (Surface_makeSurface, 256, 96, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Surface_makeSurface  ,
256  ,
96  ,
false  ,
 
)

Definition at line 4 of file Surface_makeSurface.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 SkPixmap pixmap;
11 if (big->peekPixels(&pixmap)) {
12 SkBitmap bigBits;
13 bigBits.installPixels(pixmap);
14 canvas->drawImage(bigBits.asImage(), 0, 0);
15 }
16 if (lil->peekPixels(&pixmap)) {
17 SkBitmap lilBits;
18 lilBits.installPixels(pixmap);
19 canvas->drawImage(lilBits.asImage(), 64, 64);
20 }
21}
22} // 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
sk_sp< SkImage > asImage() const
Definition: SkBitmap.cpp:645
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
Definition: SkBitmap.cpp:323
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)