Creates an image with two one-pixel wide borders around a checkerboard. The checkerboard is 2x2 checks where each check has as many pixels as is necessary to fill the interior. It returns the image and a src rect that bounds the checkerboard portion.
42 {
43
44
45 static constexpr uint32_t kOuterRingColor = 0xFFFF0000,
46 kInnerRingColor = 0xFF0000FF,
47 kCheckColor1 = 0xFF000000,
48 kCheckColor2 = 0xFFFFFFFF;
49
52
58
59 uint32_t* scanline =
bitmap.getAddr32(0, 0);
61 scanline[
x] = kOuterRingColor;
62 }
63 scanline =
bitmap.getAddr32(0, 1);
64 scanline[0] = kOuterRingColor;
65 for (
int x = 1;
x <
width - 1; ++
x) {
66 scanline[
x] = kInnerRingColor;
67 }
68 scanline[
width - 1] = kOuterRingColor;
69
71 scanline =
bitmap.getAddr32(0,
y);
72 scanline[0] = kOuterRingColor;
73 scanline[1] = kInnerRingColor;
74 for (
int x = 2;
x <
width / 2; ++
x) {
75 scanline[
x] = kCheckColor1;
76 }
78 scanline[
x] = kCheckColor2;
79 }
80 scanline[
width - 2] = kInnerRingColor;
81 scanline[
width - 1] = kOuterRingColor;
82 }
83
85 scanline =
bitmap.getAddr32(0,
y);
86 scanline[0] = kOuterRingColor;
87 scanline[1] = kInnerRingColor;
88 for (
int x = 2;
x <
width / 2; ++
x) {
89 scanline[
x] = kCheckColor2;
90 }
92 scanline[
x] = kCheckColor1;
93 }
94 scanline[
width - 2] = kInnerRingColor;
95 scanline[
width - 1] = kOuterRingColor;
96 }
97
99 scanline[0] = kOuterRingColor;
100 for (
int x = 1;
x <
width - 1; ++
x) {
101 scanline[
x] = kInnerRingColor;
102 }
103 scanline[
width - 1] = kOuterRingColor;
104
107 scanline[
x] = kOuterRingColor;
108 }
111}
static constexpr T SkAlign4(T x)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)