Flutter Engine
The Flutter Engine
RGBA4f_toSkColor.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(RGBA4f_toSkColor, 256, 256, true, 0) {
5void draw(SkCanvas* canvas) {
6 float red = 0.07f, green = 0.13f, blue = 0.32f, alpha = 0.17f;
7 SkColor4f color4f = { red, green, blue, alpha };
8 SkColor argb = color4f.toSkColor();
9 SkDebugf("red=%u green=%u blue=%u alpha=%u\n", SkColorGetR(argb),
10 SkColorGetG(argb), SkColorGetB(argb), SkColorGetA(argb));
11 SkColor4f fromSkColor = SkColor4f::FromColor(argb);
12 SkDebugf("red=%g green=%g blue=%g alpha=%g\n", fromSkColor.fR, fromSkColor.fG,
13 fromSkColor.fB, fromSkColor.fA);
14}
15} // END FIDDLE
REG_FIDDLE(RGBA4f_toSkColor, 256, 256, true, 0)
#define SkColorGetR(color)
Definition: SkColor.h:65
#define SkColorGetG(color)
Definition: SkColor.h:69
uint32_t SkColor
Definition: SkColor.h:37
#define SkColorGetA(color)
Definition: SkColor.h:61
#define SkColorGetB(color)
Definition: SkColor.h:73
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