The gradient of colors.
More...
#include <anatomist/gradientwidget/gradient.h>
|
| | Gradient () |
| | Constructor.
|
| |
| | Gradient (bool hsv) |
| | Constructor.
|
| |
| | ~Gradient () |
| | Destructor.
|
| |
| bool | isHsv () const |
| | Get the mode of the gradient.
|
| |
| const Spline & | getSpline (int index) const |
| | Get one of the splines of the gradient.
|
| |
| Spline & | getSpline (int index) |
| | Get one of the splines of the gradient.
|
| |
| void | fillGradient (QRgb *buffer, int length=GRADIENT_LENGTH, double *data=NULL, bool withAlpha=false) const |
| | Generate the color table for the gradient.
|
| |
| void | invert () |
| | Invert the gradient.
|
| |
| void | fromString (const std::string &grad_def) |
| |
|
| static QRgb | hsvToRgb (double h, double s, double v) |
| | Calculate a color from HSV components.
|
| |
The gradient of colors.
The gradients consists of three splines which define the waveforms of the color components. The gradient may work in a RGB mode or HSV mode.
Definition at line 23 of file gradient.h.
◆ Gradient() [1/2]
◆ Gradient() [2/2]
| Gradient::Gradient |
( |
bool | hsv | ) |
|
Constructor.
- Parameters
-
| hsv | Mode of the gradient, true - HSV, false - RGB. |
◆ ~Gradient()
◆ fillGradient()
| void Gradient::fillGradient |
( |
QRgb * | buffer, |
|
|
int | length = GRADIENT_LENGTH, |
|
|
double * | data = NULL, |
|
|
bool | withAlpha = false ) const |
Generate the color table for the gradient.
- Parameters
-
| [out] | buffer | The array to fill. |
| length | The length of the array. |
| data | The components array to use (3 x length, or 4 x length if withAlpha is true). If NULL, a temporary array is used. |
| withAlpha | if true, the returned array is RGBA, and the data array must be allocated 4 x length. |
◆ fromString()
| void Gradient::fromString |
( |
const std::string & | grad_def | ) |
|
◆ getSpline() [1/2]
| Spline & Gradient::getSpline |
( |
int | index | ) |
|
|
inline |
Get one of the splines of the gradient.
- Parameters
-
| index | The spline index (0, 1 or 2). |
- Returns
- The spline object.
Definition at line 71 of file gradient.h.
◆ getSpline() [2/2]
| const Spline & Gradient::getSpline |
( |
int | index | ) |
const |
|
inline |
Get one of the splines of the gradient.
- Parameters
-
| index | The spline index (0, 1 or 2). |
- Returns
- The spline object.
Definition at line 60 of file gradient.h.
◆ hsvToRgb()
| static QRgb Gradient::hsvToRgb |
( |
double | h, |
|
|
double | s, |
|
|
double | v ) |
|
inlinestatic |
Calculate a color from HSV components.
All components should be in range from 0 to 1.
- Parameters
-
| h | The hue component. |
| s | The saturation component. |
| v | The value component. |
- Returns
- The calculated color.
Definition at line 104 of file gradient.h.
◆ invert()
| void Gradient::invert |
( |
| ) |
|
◆ isHsv()
| bool Gradient::isHsv |
( |
| ) |
const |
|
inline |
Get the mode of the gradient.
- Returns
true if gradient is HSV, false if RGB.
Definition at line 49 of file gradient.h.
The documentation for this class was generated from the following file: