Flutter Engine
The Flutter Engine
Surface_makeSurface.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.
4REG_FIDDLE(Surface_makeSurface, 256, 96, false, 0) {
5void draw(SkCanvas* canvas) {
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
REG_FIDDLE(Surface_makeSurface, 256, 96, false, 0)
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 clear(SkColor color)
Definition: SkCanvas.h:1199
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
SkCanvas * getCanvas()
Definition: SkSurface.cpp:82
sk_sp< SkSurface > makeSurface(const SkImageInfo &imageInfo)
Definition: SkSurface.cpp:108
bool peekPixels(SkPixmap *pixmap)
Definition: SkSurface.cpp:121
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)