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

Go to the source code of this file.

Functions

 REG_FIDDLE (Bitmap_readPixels_2, 256, 256, false, 3)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Bitmap_readPixels_2  ,
256  ,
256  ,
false  ,
 
)

Definition at line 4 of file Bitmap_readPixels_2.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 std::vector<int32_t> srcPixels;
7 srcPixels.resize(source.height() * source.rowBytes());
8 for (int y = 0; y < 4; ++y) {
9 for (int x = 0; x < 4; ++x) {
11 &srcPixels.front() + x * source.height() * source.width() / 4 +
12 y * source.width() / 4, source.rowBytes());
13 source.readPixels(pixmap, x * source.width() / 4, y * source.height() / 4);
14 }
15 }
16 canvas->scale(.5f, .5f);
19 &srcPixels.front(), source.rowBytes());
20 canvas->drawImage(bitmap.asImage(), 0, 0);
21}
22} // END FIDDLE
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
int width() const
Definition: SkBitmap.h:149
size_t rowBytes() const
Definition: SkBitmap.h:238
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
Definition: SkBitmap.cpp:488
int height() const
Definition: SkBitmap.h:158
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
SkBitmap source
Definition: examples.cpp:28
double y
double x
Definition: bitmap.py:1
static SkImageInfo MakeN32Premul(int width, int height)