/*
4 * Authors: see git history
6 * Copyright (C) 2023 Authors
7 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
25 double d = output[0] * 5.99999999;
26 double f = d - std::floor(d);
27 double w = v * (1.0 - output[1]);
28 double q = v * (1.0 - (output[1] * f));
29 double t = v * (1.0 - (output[1] * (1.0 - f)));
67 double max = std::max(std::max(r, g), b);
68 double min = std::min(std::min(r, g), b);
69 double delta = max - min;
72 output[1] = max > 0 ?
delta / max : 0.0;
74 if (output[1] != 0.0) {
76 output[0] = (g - b) /
delta;
77 }
else if (g == max) {
78 output[0] = 2.0 + (b - r) /
delta;
80 output[0] = 4.0 + (r - g) /
delta;
82 output[0] = output[0] / 6.0;
96 auto scale = output[1] + output[2];
101 output[1] = output[2] == 1.0 ? 0.0 : (1.0 - (output[1] / (1.0 - output[2])));
102 output[2] = 1.0 - output[2];
114std::string
HSV::toString(std::vector<double>
const &values,
bool opacity)
const
118 return oo << (int)(values[0] * 360)
119 << (1.0 - values[1]) * values[2]
bool parse(std::istringstream &ss, std::vector< double > &output) const override
bool parse(std::istringstream &input, std::vector< double > &output) const override
Parse the hwb css string and convert to hsv inline, if it exists in the input string stream.
std::string toString(std::vector< double > const &values, bool opacity) const override
Print the HSV color to a CSS hwb() string.
void spaceToProfile(std::vector< double > &output) const override
Convert the HSV color into sRGB components used in the sRGB icc profile.
void profileToSpace(std::vector< double > &output) const override
Convert from sRGB icc values to HSV values.