Flutter Engine
The Flutter Engine
RGBA4f_FromColor.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_FromColor, 256, 256, true, 0) {
5void draw(SkCanvas* canvas) {
6 uint8_t red = 77, green = 101, blue = 153, alpha = 43;
7 SkColor argb = SkColorSetARGB(alpha, red, green, blue);
8 SkColor4f color4f = SkColor4f::FromColor(argb);
9 SkDebugf("red=%g green=%g blue=%g alpha=%g\n", color4f.fR, color4f.fG, color4f.fB, color4f.fA);
10 SkColor fromColor4f = color4f.toSkColor();
11 SkDebugf("red=%u green=%u blue=%u alpha=%u\n", SkColorGetR(fromColor4f),
12 SkColorGetG(fromColor4f), SkColorGetB(fromColor4f), SkColorGetA(fromColor4f));
13}
14} // END FIDDLE
REG_FIDDLE(RGBA4f_FromColor, 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
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition: SkColor.h:49
#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