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

Go to the source code of this file.

Functions

 REG_FIDDLE (Bitmap_readPixels_3, 256, 128, false, 3)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Bitmap_readPixels_3  ,
256  ,
128  ,
false  ,
 
)

Definition at line 4 of file Bitmap_readPixels_3.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 std::vector<int32_t> srcPixels;
7 srcPixels.resize(source.height() * source.width() * 8);
8 for (int i = 0; i < 2; ++i) {
11 &srcPixels.front() + i * source.width(), source.rowBytes() * 2);
12 source.readPixels(pixmap);
13 }
14 canvas->scale(.25f, .25f);
17 &srcPixels.front(), source.rowBytes() * 2);
18 canvas->drawImage(bitmap.asImage(), 0, 0);
19}
20} // END FIDDLE
@ 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
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
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
Definition: bitmap.py:1
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)