Flutter Engine
The Flutter Engine
Surface_writePixels_2.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_writePixels_2, 256, 96, false, 4) {
5void draw(SkCanvas* canvas) {
7 auto surfCanvas = surf->getCanvas();
8 surfCanvas->clear(SK_ColorGREEN);
9 surf->writePixels(source, 25, 25);
11 canvas->drawImage(image, 0, 0);
12}
13} // END FIDDLE
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
REG_FIDDLE(Surface_writePixels_2, 256, 96, false, 4)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
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< SkImage > makeImageSnapshot()
Definition: SkSurface.cpp:90
void writePixels(const SkPixmap &src, int dstX, int dstY)
Definition: SkSurface.cpp:202
SkBitmap source
Definition: examples.cpp:28
sk_sp< const SkImage > image
Definition: SkRecords.h:269
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo MakeN32Premul(int width, int height)