15 static const int GRADIENT_LENGTH = 4096;
62 return _spline[index];
73 return _spline[index];
87 void fillGradient(QRgb* buffer,
int length = GRADIENT_LENGTH,
double* data = NULL,
bool withAlpha =
false)
const;
108 double sb = 128.0 * (1.0 - s);
112 vb = 510.0 * v - 255.0;
118 int hh = (int)(6.0 * h);
119 double f = 6.0 * h - (double)hh;
123 double m = (255.0 * s + sb) * va + vb;
124 double n = sb * va + vb;
125 double p = (255.0 * f * s + sb) * va + vb;
128 case 0: r = m; g = p; b = n;
break;
129 case 1: r = p; g = m; b = n;
break;
130 case 2: r = n; g = m; b = p;
break;
131 case 3: r = n; g = p; b = m;
break;
132 case 4: r = p; g = n; b = m;
break;
133 case 5: r = m; g = n; b = p;
break;
134 default: r = m; g = n; b = n;
break;
137 return qRgb((
int)r, (
int)g, (
int)b);
Gradient(bool hsv)
Constructor.
const Spline & getSpline(int index) const
Get one of the splines of the gradient.
bool isHsv() const
Get the mode of the gradient.
void invert()
Invert the gradient.
static QRgb hsvToRgb(double h, double s, double v)
Calculate a color from HSV components.
void fillGradient(QRgb *buffer, int length=GRADIENT_LENGTH, double *data=NULL, bool withAlpha=false) const
Generate the color table for the gradient.
Spline & getSpline(int index)
Get one of the splines of the gradient.
A spline used to store gradient components waveforms.