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

Go to the source code of this file.

Functions

 REG_FIDDLE (Surface_MakeRasterN32Premul, 256, 256, true, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Surface_MakeRasterN32Premul  ,
256  ,
256  ,
true  ,
 
)

Definition at line 4 of file Surface_MakeRasterN32Premul.cpp.

4 {
5void draw(SkCanvas* ) {
7 SkCanvas* canvas = surface->getCanvas();
8 canvas->clear(SK_ColorWHITE);
9 SkPixmap pixmap;
10 if (surface->peekPixels(&pixmap)) {
11 const uint32_t* colorPtr = pixmap.addr32();
12 SkPMColor pmWhite = colorPtr[0];
14 canvas->drawPoint(1, 1, paint);
15 for (int y = 0; y < surface->height(); ++y) {
16 for (int x = 0; x < surface->width(); ++x) {
17 SkDebugf("%c", colorPtr[x] == pmWhite ? '-' : 'x');
18 }
19 colorPtr += surface->width();
20 SkDebugf("\n");
21 }
22 }
23}
24} // END FIDDLE
uint32_t SkPMColor
Definition: SkColor.h:205
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawPoint(SkScalar x, SkScalar y, const SkPaint &paint)
Definition: SkCanvas.cpp:2695
void clear(SkColor color)
Definition: SkCanvas.h:1199
const uint32_t * addr32() const
Definition: SkPixmap.h:352
const Paint & paint
Definition: color_source.cc:38
VkSurfaceKHR surface
Definition: main.cc:49
double y
double x
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo MakeN32Premul(int width, int height)