Go to the source code of this file.
◆ DEF_SIMPLE_GM() [1/3]
DEF_SIMPLE_GM |
( |
color4blendcf |
, |
|
|
canvas |
, |
|
|
360 |
, |
|
|
480 |
|
|
) |
| |
Definition at line 131 of file color4f.cpp.
131 {
132 canvas->translate(10, 10);
133
135 auto spin = srgb->makeColorSpin();
136
138 { 1, 0, 0, 1 },
139 { 0, 1, 0, 1 },
140 { 0, 0, 1, 1 },
141 { 0.5, 0.5, 0.5, 1 },
142 };
143
147
148 for (
const auto& c4 :
colors) {
150
151
155 };
156
157 canvas->save();
158 for (
const auto&
f : filters) {
160 canvas->drawRect(r,
paint);
161 canvas->translate(r.
width() * 6 / 5, 0);
162 }
163 canvas->restore();
164 canvas->translate(0, r.
height() * 6 / 5);
165 }
166}
constexpr SkColor SK_ColorWHITE
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorSpace > MakeSRGB()
PODArray< SkColor > colors
constexpr float height() const
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
static sk_sp< SkColorFilter > spin(sk_sp< SkColorFilter > cf)
◆ DEF_SIMPLE_GM() [2/3]
DEF_SIMPLE_GM |
( |
color4f |
, |
|
|
canvas |
, |
|
|
1024 |
, |
|
|
260 |
|
|
) |
| |
Definition at line 72 of file color4f.cpp.
72 {
73 canvas->translate(10, 10);
74
76
77
79
81 nullptr,
83 };
86 colorSpace);
88 surface->getCanvas()->drawPaint(bg);
91 canvas->translate(0, 120);
92 }
93}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
void setColor(SkColor color)
static void draw_into_canvas(SkCanvas *canvas)
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
◆ DEF_SIMPLE_GM() [3/3]
DEF_SIMPLE_GM |
( |
color4shader |
, |
|
|
canvas |
, |
|
|
360 |
, |
|
|
480 |
|
|
) |
| |
Definition at line 97 of file color4f.cpp.
97 {
98 canvas->translate(10, 10);
99
101 auto spin = srgb->makeColorSpin();
102
104 { 1, 0, 0, 1 },
105 { 0, 1, 0, 1 },
106 { 0, 0, 1, 1 },
107 { 0.5, 0.5, 0.5, 1 },
108 };
109
112
113 for (
const auto& c4 :
colors) {
118 };
119
120 canvas->save();
121 for (
const auto&
s : shaders) {
123 canvas->drawRect(r,
paint);
124 canvas->translate(r.
width() * 6 / 5, 0);
125 }
126 canvas->restore();
127 canvas->translate(0, r.
height() * 6 / 5);
128 }
129}
SK_API sk_sp< SkShader > Color(SkColor)
◆ draw_into_canvas()
static void draw_into_canvas |
( |
SkCanvas * |
canvas | ) |
|
|
static |
Definition at line 56 of file color4f.cpp.
56 {
60
62 for (auto shProc : shaders) {
63 paint.setShader(shProc());
64 for (auto cfProc : filters) {
65 paint.setColorFilter(cfProc());
68 }
69 }
70}
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
static sk_sp< SkShader > make_opaque_color()
static sk_sp< SkShader > make_alpha_color()
static sk_sp< SkColorFilter > make_cf_null()
static sk_sp< SkColorFilter > make_cf0()
static sk_sp< SkColorFilter > make_cf1()
static sk_sp< SkColorFilter > make_cf2()
◆ make_alpha_color()
◆ make_cf0()
Definition at line 34 of file color4f.cpp.
34 {
38}
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
void setSaturation(float sat)
◆ make_cf1()
Definition at line 40 of file color4f.cpp.
40 {
44
45
46
47
50}
void setScale(float rScale, float gScale, float bScale, float aScale=1.0f)
◆ make_cf2()
Definition at line 52 of file color4f.cpp.
52 {
54}
@ kSrcATop
r = s*da + d*(1-sa)
◆ make_cf_null()
Definition at line 30 of file color4f.cpp.
30 {
31 return nullptr;
32}
◆ make_opaque_color()