Flutter Engine
The Flutter Engine
Surface_draw.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_draw, 256, 64, false, 0) {
5void draw(SkCanvas* canvas) {
10 lil->draw(big->getCanvas(), 16, 16);
11 SkPixmap pixmap;
12 if (big->peekPixels(&pixmap)) {
13 SkBitmap bigBits;
14 bigBits.installPixels(pixmap);
15 canvas->drawImage(bigBits.asImage(), 0, 0);
16 }
17}
18} // 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_draw, 256, 64, false, 0)
Definition: Surface_draw.cpp:4
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
void draw(SkCanvas *canvas, SkScalar x, SkScalar y, const SkSamplingOptions &sampling, const SkPaint *paint)
Definition: SkSurface.cpp:116
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)