DzColorGradient Class Reference
[Basic Objects]

Generates a gradient between two or more colors. More...

Inheritance diagram for DzColorGradient:

DzBase QObject Object List of all members.

Enumerations



enum  ColorModel { RGB, HSV }

Methods

void addGradientColor (Color color, Number value)
void clear ()
Color getColor (Number value)
ColorModel getColorModel ()
Color getGradientColor (Number index)
Number getGradientValue (Number index)
Number getNumGradients ()
void removeGradientColor (Number index)
void setColorModel (ColorModel model)
void setGradientColor (Number index, Color color)

Constructors

 DzColorGradient (ColorModel model=RGB)

Signals

void gradientChanged ()

Detailed Description

Generates a gradient between two or more colors.

This class encapsulates the behavior of a color gradient. The gradient color interpolation model can be set to be either RGB or HSV.

The user set points on the gradient are set via the addGradient() function and are stored in an internally sorted array.

Once the gradient is initialized the getColor() function is the primary interface to get values from the gradient. This function interpolates between the set points on the gradient to determine the color at the request position in the x-axis.

Typically the gradient endpoints are set at 0.0 and 1.0f but that is not required. The gradient is constructed as a set of user set colors at specific points along an x-axis aligned colorbar. The getColor() function returns the interpolated gradient color value at the requested point along the x-axis.


Member Enumeration Documentation

enum DzColorGradient::ColorModel

Enum value used to determine if HSV or RGB color model used for interpolation.

Enumerator:
RGB  Interpolates in Red-Green-Blue color space
HSV  Interpolates in Hue-Saturation-Value color space


Constructor & Destructor Documentation

DzColorGradient::DzColorGradient ( ColorModel  model = RGB  ) 

Constructor.

Parameters:
model The color model for the gradient.


Member Function Documentation

void DzColorGradient::addGradientColor ( Color  color,
Number  value 
)

Adds a new color to the gradient.

Parameters:
color The new color.
value The x-axis value.

void DzColorGradient::clear (  ) 

Removes all the colors from the gradient.

Color DzColorGradient::getColor ( Number  value  ) 

Computes the color on the gradient at the passed position on the gradient colorbar.

Parameters:
value The x-axis value.
Returns:
The gradient color.

DzColorGradient::ColorModel DzColorGradient::getColorModel (  ) 

Returns:
The current color model for this gradient.

Color DzColorGradient::getGradientColor ( Number  index  ) 

Get the color at the indexed array point.

Parameters:
i The index into the point array.
Returns:
The color at the specified index.

Number DzColorGradient::getGradientValue ( Number  index  ) 

Get the x-axis value at the indexed array point.

Parameters:
i The index into the point array.
Returns:
The x-axis value at the specified index.

Number DzColorGradient::getNumGradients (  ) 

Get the number of points in the gradient. Used with getGradientColor() and getGradientValue() to iterate over the gradient colors and values.

Returns:
The number of color points.

void DzColorGradient::gradientChanged (  )  [signal]

Emitted when the value of the gradient has been changed.

void DzColorGradient::removeGradientColor ( Number  index  ) 

Removes an existing color point from the gradient.

Parameters:
index The index of the color point to remove.

void DzColorGradient::setColorModel ( ColorModel  model  ) 

Sets the color model of the gradient.

Parameters:
model The new color model for the gradient.

void DzColorGradient::setGradientColor ( Number  index,
Color  color 
)

Changes the color of an existing point in the gradient.

Parameters:
index The index of the color point.
color The new color.


Generated on Thu Sep 24 12:21:11 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.