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

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_readPixels_a, 64, 64, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_readPixels_a  ,
64  ,
64  ,
false  ,
 
)

Definition at line 4 of file Canvas_readPixels_a.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 canvas->clear(SK_ColorBLUE);
8 canvas->drawCircle(32, 32, 28, paint);
10 sk_sp<SkData> data(SkData::MakeUninitialized(info.minRowBytes() * info.height()));
11 sk_bzero(data->writable_data(), info.minRowBytes() * info.height());
12 for (int x : { 32, -32 } ) {
13 for (int y : { 32, -32 } ) {
14 canvas->readPixels(info, data->writable_data(), info.minRowBytes(), x, y);
15 }
16 }
18 canvas->drawImage(image, 0, 0);
19}
20} // END FIDDLE
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
sk_bzero(glyphs, sizeof(glyphs))
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void clear(SkColor color)
Definition: SkCanvas.h:1199
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY)
Definition: SkCanvas.cpp:382
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
static sk_sp< SkData > MakeUninitialized(size_t length)
Definition: SkData.cpp:116
const Paint & paint
Definition: color_source.cc:38
double y
double x
SK_API sk_sp< SkImage > RasterFromData(const SkImageInfo &info, sk_sp< SkData > pixels, size_t rowBytes)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63