blob: 91e99dca0f58b1237b90ccd9e89312eb02863851 [file] [log] [blame]
// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "tools/fiddle/examples.h"
REG_FIDDLE(RGBA4f_toSkColor, 256, 256, true, 0) {
void draw(SkCanvas* canvas) {
float red = 0.07f, green = 0.13f, blue = 0.32f, alpha = 0.17f;
SkColor4f color4f = { red, green, blue, alpha };
SkColor argb = color4f.toSkColor();
SkDebugf("red=%u green=%u blue=%u alpha=%u\n", SkColorGetR(argb),
SkColorGetG(argb), SkColorGetB(argb), SkColorGetA(argb));
SkColor4f fromSkColor = SkColor4f::FromColor(argb);
SkDebugf("red=%g green=%g blue=%g alpha=%g\n", fromSkColor.fR, fromSkColor.fG,
fromSkColor.fB, fromSkColor.fA);
}
} // END FIDDLE