28 ImGui::Begin(
"Gradient");
30 ImGui::Checkbox(
"Dither", &fDither);
33 ImGui::Checkbox(
"Premul", &
premul);
36 int hm =
static_cast<int>(fInterpolation.
fHueMethod);
37 ImGui::Combo(
"Hue Method", &hm,
"Shorter\0Longer\0Increasing\0Decreasing\0\0");
41 for (
int i = 0;
i < (
int)fColors.size(); ++
i) {
43 if (ImGui::Button(
"X")) {
47 ImGui::ColorEdit4(
"##Color", fColors[
i].vec());
50 if (removeIdx >= 0 && fColors.size() > 2) {
51 fColors.erase(fColors.begin() + removeIdx);
54 if (ImGui::Button(
"+")) {
66 SkPoint pts[2] = {{0, 0}, {256, 0}};
67 SkRect r = {0, 0, 256, 32};
70 paint.setDither(fDither);
80 static const Config kConfigs[] = {
81 { CS::kDestination,
"Destination" },
82 { CS::kSRGB,
"sRGB" },
83 { CS::kSRGBLinear,
"Linear sRGB" },
84 { CS::kLab,
"CIELAB" },
85 { CS::kOKLab,
"Oklab" },
86 { CS::kOKLabGamutMap,
"OklabGamutMap" },
88 { CS::kOKLCH,
"Oklch" },
89 { CS::kOKLCHGamutMap,
"OklchGamutMap" },
95 for (
const Config& config : kConfigs) {
101 fInterpolation,
nullptr));
104 266, 20,
font, labelPaint);
111 std::vector<SkColor4f> fColors;
113 bool fDither =
false;
constexpr SkColor SK_ColorGRAY
@ kUTF8
uses bytes to represent UTF-8 or ASCII
static uint32_t premul(uint32_t color)
void draw(SkCanvas *canvas) override
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void clear(SkColor color)
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
constexpr SkColor4f kBlack
constexpr SkColor4f kBlue
constexpr SkColor4f kYellow
font
Font Metadata and Metrics.