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

Go to the source code of this file.

Functions

 REG_FIDDLE (Alpha_Constants_b, 256, 128, false, 1)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Alpha_Constants_b  ,
256  ,
128  ,
false  ,
 
)

Definition at line 4 of file Alpha_Constants_b.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 std::vector<int32_t> srcPixels;
7 srcPixels.resize(source.height() * source.rowBytes());
9 &srcPixels.front(), source.rowBytes());
10 source.readPixels(pixmap, 0, 0);
11 for (int y = 0; y < source.height(); ++y) {
12 for (int x = 0; x < source.width(); ++x) {
13 SkPMColor pixel = srcPixels[y * source.width() + x];
16 srcPixels[y * source.width() + x] = SK_ColorGREEN;
17 }
18 }
19 }
20 canvas->drawImage(SkImages::RasterFromPixmapCopy(pixmap), 0, 0);
21}
22} // END FIDDLE
uint32_t SkColor
Definition: SkColor.h:37
uint32_t SkPMColor
Definition: SkColor.h:205
constexpr SkAlpha SK_AlphaOPAQUE
Definition: SkColor.h:94
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
#define SkColorGetA(color)
Definition: SkColor.h:61
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 drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
static SkColor PMColorToColor(SkPMColor c)
DlColor color
SkBitmap source
Definition: examples.cpp:28
double y
double x
SK_API sk_sp< SkImage > RasterFromPixmapCopy(const SkPixmap &pixmap)
static SkImageInfo MakeN32Premul(int width, int height)