Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
Bitmap_extractSubset.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Bitmap_extractSubset, 256, 256, true, 3)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Bitmap_extractSubset  ,
256  ,
256  ,
true  ,
 
)

Definition at line 5 of file Bitmap_extractSubset.cpp.

5 {
6void draw(SkCanvas* canvas) {
8 source.getBounds(&bounds);
9 SkDebugf("bounds: %d, %d, %d, %d\n", bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
10 SkBitmap subset;
11 for (int left: { -100, 0, 100, 1000 } ) {
12 for (int right: { 0, 100, 1000 } ) {
13 SkIRect b = SkIRect::MakeLTRB(left, 100, right, 200);
14 bool success = source.extractSubset(&subset, b);
15 SkDebugf("subset: %4d, %4d, %4d, %4d ", b.fLeft, b.fTop, b.fRight, b.fBottom);
16 SkDebugf("success; %s", success ? "true" : "false");
17 if (success) {
18 subset.getBounds(&s);
19 SkDebugf(" subset: %d, %d, %d, %d", s.fLeft, s.fTop, s.fRight, s.fBottom);
20 }
21 SkDebugf("\n");
22 }
23 }
24}
25} // END FIDDLE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void getBounds(SkRect *bounds) const
Definition SkBitmap.cpp:98
bool extractSubset(SkBitmap *dst, const SkIRect &subset) const
Definition SkBitmap.cpp:453
SkBitmap source
Definition examples.cpp:28
static bool b
struct MyStruct s
Optional< SkRect > bounds
Definition SkRecords.h:189
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
Definition SkRect.h:91