anatomist  5.1.2
3D neuroimaging data viewer
Gradient Class Reference

The gradient of colors. More...

#include <anatomist/gradientwidget/gradient.h>

Public Member Functions

 Gradient ()
 Constructor. More...
 
 Gradient (bool hsv)
 Constructor. More...
 
 ~Gradient ()
 Destructor. More...
 
bool isHsv () const
 Get the mode of the gradient. More...
 
const SplinegetSpline (int index) const
 Get one of the splines of the gradient. More...
 
SplinegetSpline (int index)
 Get one of the splines of the gradient. More...
 
void fillGradient (QRgb *buffer, int length=GRADIENT_LENGTH, double *data=NULL, bool withAlpha=false) const
 Generate the color table for the gradient. More...
 
void invert ()
 Invert the gradient. More...
 

Static Public Member Functions

static QRgb hsvToRgb (double h, double s, double v)
 Calculate a color from HSV components. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Gradient() [1/2]

Gradient::Gradient ( )

Constructor.

◆ Gradient() [2/2]

Gradient::Gradient ( bool  hsv)

Constructor.

Parameters
hsvMode of the gradient, true - HSV, false - RGB.

◆ ~Gradient()

Gradient::~Gradient ( )

Destructor.

Member Function Documentation

◆ 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]bufferThe array to fill.
lengthThe length of the array.
dataThe components array to use (3 x length, or 4 x length if withAlpha is true). If NULL, a temporary array is used.
withAlphaif true, the returned array is RGBA, and the data array must be allocated 4 x length.

◆ getSpline() [1/2]

Spline& Gradient::getSpline ( int  index)
inline

Get one of the splines of the gradient.

Parameters
indexThe 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
indexThe 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
hThe hue component.
sThe saturation component.
vThe value component.
Returns
The calculated color.

Definition at line 104 of file gradient.h.

◆ invert()

void Gradient::invert ( )

Invert the gradient.

◆ 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: