Rogue Wave Views
Foundation Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions | Friends
IlvColor Class Reference

Resource class. More...

#include <ilviews/base/resource.h>

Inheritance diagram for IlvColor:
IlvResource

Public Member Functions

IlvIntensity getBlue () const
 Retrieves the blue component value. More...
 
IlvIntensity getGreen () const
 Retrieves the green component value. More...
 
void getHSV (IlFloat &hue, IlFloat &saturation, IlFloat &value) const
 Retrieves the HSV values. More...
 
IlFloat getHue () const
 Retrieves the hue value. More...
 
IlUInt getIndex () const
 Gets the index of this color. More...
 
IlvIntensity getRed () const
 Retrieves the red component value. More...
 
void getRGB (IlvIntensity &red, IlvIntensity &green, IlvIntensity &blue) const
 Retrieves the RGB component values. More...
 
IlFloat getSaturation () const
 Retrieves the color saturation value. More...
 
IlFloat getValue () const
 Retrieves the luminosity value. More...
 
IlBoolean isMutable () const
 Get the mutable attribute. More...
 
void setBlue (IlvIntensity blue)
 Sets the blue component value. More...
 
void setGreen (IlvIntensity green)
 Sets the green component value. More...
 
void setHSV (IlFloat hue, IlFloat saturation, IlFloat value)
 Sets the HSV parameters. More...
 
void setHue (IlFloat hue)
 Sets the hue value. More...
 
virtual void setName (const char *name)
 Sets the name of the resource. More...
 
void setRed (IlvIntensity red)
 Sets the red component value. More...
 
void setRGB (IlvIntensity red, IlvIntensity green, IlvIntensity blue)
 Sets the RGB component values. More...
 
void setSaturation (IlFloat saturation)
 Sets the saturation. More...
 
void setValue (IlFloat value)
 Sets the luminosity value. More...
 
virtual void unLock ()
 Unlocks the resource. More...
 
- Public Member Functions inherited from IlvResource
IlvDisplaygetDisplay () const
 Gets the IlvDisplay instance. More...
 
const char * getName () const
 Gets the resource name. More...
 
void lock ()
 Locks the resource. More...
 

Static Public Member Functions

static void ComputeReliefColors (const IlvColor *reference, IlvColor *&topShade, IlvColor *&bottomShade, IlvColor *&select)
 Computes colors that make a shadow effect. More...
 
static void HSVToRGB (IlFloat h, IlFloat s, IlFloat v, IlvIntensity &red, IlvIntensity &green, IlvIntensity &blue)
 Converts HSV values to the RGB model. More...
 
static void RGBToHSV (IlvIntensity red, IlvIntensity green, IlvIntensity blue, IlFloat &h, IlFloat &s, IlFloat &v)
 Converts RGB values to the HSV model. More...
 

Friends

class IlvDisplay
 

Detailed Description

Resource class.

Library: xviews or winviews or mviews (mutually exclusive)

This class lets you manipulate color objects, both in the RGB and the HSV color models.

IlvColor has no constructor. The only way to obtain a color is to ask your IlvDisplay object to get it for you.

A color is entirely defined by its three component values: red, green and blue. These values are stored as unsigned 16-bit numbers. For example, black is defined with its three components set to zero, and white has its three components set to 65535.

An IlvColor can be mutable on systems that accept it. Values defining a mutable color can be modified on the fly, allowing to animate your displays without requiring a refresh of the screen.

Member Function Documentation

§ ComputeReliefColors()

static void IlvColor::ComputeReliefColors ( const IlvColor reference,
IlvColor *&  topShade,
IlvColor *&  bottomShade,
IlvColor *&  select 
)
static

Computes colors that make a shadow effect.

The different colors are derived from reference by making it brighter or dimmer.

Parameters
referenceThe reference color.
topShadeIs set to a brighter version of reference.
bottomShadeIs set to a dimmer version of reference.
selectA color that looks like a selected version of reference (usually slightly dimmer).

§ getBlue()

IlvIntensity IlvColor::getBlue ( ) const

Retrieves the blue component value.

Returns
The intensity of the blue component.

§ getGreen()

IlvIntensity IlvColor::getGreen ( ) const

Retrieves the green component value.

Returns
The intensity of the green component.

§ getHSV()

void IlvColor::getHSV ( IlFloat hue,
IlFloat saturation,
IlFloat value 
) const

Retrieves the HSV values.

Obtains the current values of all three HSV components: hue, saturation and luminosity.

Parameters
hueThe hue value of this color.
saturationThe saturation value of this color.
valueThe luminosity value of this color.

§ getHue()

IlFloat IlvColor::getHue ( ) const

Retrieves the hue value.

This value is computed from the RGB color model. It corresponds to an angle in the HSV color model, where a value of 0 indicates a pure red color, 120 indicates a pure blue color, and 240 indicates a pure green color.

Returns
The hue of the current color. In the context of the HSV cone model, this number represents an angle in the range of 0 to 360 degrees.

§ getIndex()

IlUInt IlvColor::getIndex ( ) const

Gets the index of this color.

Colors are generally stored in a color table that is maintained internally by your IlvDisplay object. You can obtain the index of a color object (an unsigned long integer) by means of this member function. Then you can use this number for remapping processes involving color bitmaps, when you want to map pixel values to color objects.

Returns
The index of this color in the color map. If the display where this color was allocated has true-color capabilities, the returned value is the entire 24-bit color representation.

§ getRed()

IlvIntensity IlvColor::getRed ( ) const

Retrieves the red component value.

Returns
The intensity of the red component.

§ getRGB()

void IlvColor::getRGB ( IlvIntensity red,
IlvIntensity green,
IlvIntensity blue 
) const

Retrieves the RGB component values.

Parameters
redThe red component value.
greenThe green component value.
blueThe blue component value.

§ getSaturation()

IlFloat IlvColor::getSaturation ( ) const

Retrieves the color saturation value.

Returns
The saturation of the current color. In the context of the HSV cone model, this number ranges from zero (gray) to one (maximum vividness).

§ getValue()

IlFloat IlvColor::getValue ( ) const

Retrieves the luminosity value.

Returns
The luminosity of the current color. In the context of the HSV cone model, this number ranges from zero (black) to one (white).

§ HSVToRGB()

static void IlvColor::HSVToRGB ( IlFloat  h,
IlFloat  s,
IlFloat  v,
IlvIntensity red,
IlvIntensity green,
IlvIntensity blue 
)
static

Converts HSV values to the RGB model.

Parameters
hThe input hue value.
sThe input saturation value.
vThe input luminosity value. If this is 0 the output result will always be 0 for all components, no matter what values are set in h and s.
redIs set to the output red component value.
greenIs set to the output green component value.
blueIs set to the output blue component value.

§ isMutable()

IlBoolean IlvColor::isMutable ( ) const

Get the mutable attribute.

A color can be either static (impossible to modify after its creation) or mutable. In the latter case, you can use the set() member functions to dynamically modify a color, even when there are drawings with this color on the screen. (These set() functions are indicated in the next functions.)

Mutable colors are costly, however, in terms of internal resource management. You specify whether or not you want mutable color in the IlvDisplay member functions that create these objects.

Returns
IlTrue if this color is mutable and IlFalse if it is not.

§ RGBToHSV()

static void IlvColor::RGBToHSV ( IlvIntensity  red,
IlvIntensity  green,
IlvIntensity  blue,
IlFloat h,
IlFloat s,
IlFloat v 
)
static

Converts RGB values to the HSV model.

Parameters
redThe input red value.
greenThe input green value.
blueThe input blue value.
hIs set to the output hue value.
sIs set to the output saturation value.
vIs set to the output luminosity value value.

§ setBlue()

void IlvColor::setBlue ( IlvIntensity  blue)

Sets the blue component value.

This member function does nothing if this color is not mutable.

Assigns an intensity to the blue component. If the mutable color is allocated in a higher bitPlaneGroup (that is, the allocated color allocates many slots of the color map) then all the slots are modified.

Parameters
blueThe new blue component value of this color.

§ setGreen()

void IlvColor::setGreen ( IlvIntensity  green)

Sets the green component value.

This member function does nothing if this color is not mutable.

Assigns an intensity to the green component. If the mutable color is allocated in a higher bitPlaneGroup (that is, the allocated color allocates many slots of the color map) then all the slots are modified.

Parameters
greenThe new green component value of this color.

§ setHSV()

void IlvColor::setHSV ( IlFloat  hue,
IlFloat  saturation,
IlFloat  value 
)

Sets the HSV parameters.

This member function does nothing if this color is not mutable.

Assigns values to all three HSV components: hue, saturation and luminosity.

Parameters
hueThe new hue value of this color.
saturationThe new saturation value of this color.
valueThe new luminosity value of this color.

§ setHue()

void IlvColor::setHue ( IlFloat  hue)

Sets the hue value.

This member function does nothing if this color is not mutable.

Assigns a hue value to the current color. In the context of the HSV cone model, this number represents an angle in the range of 0 to 360&#186;.

Parameters
hueThe new hue value of this color.

§ setName()

virtual void IlvColor::setName ( const char *  name)
virtual

Sets the name of the resource.

Names your resource by means of a unique name string descriptor that is internally copied.

Reimplemented from IlvResource.

§ setRed()

void IlvColor::setRed ( IlvIntensity  red)

Sets the red component value.

This member function does nothing if this color is not mutable.

Assigns an intensity to the red component. If the mutable color is allocated in a higher bitPlaneGroup (that is, the allocated color allocates many slots of the color map) then all the slots are modified.

Parameters
redThe new red component value of this color.

§ setRGB()

void IlvColor::setRGB ( IlvIntensity  red,
IlvIntensity  green,
IlvIntensity  blue 
)

Sets the RGB component values.

This member function does nothing if this color is not mutable.

Assigns intensities to all three components: red, green and blue. If the mutable color is allocated in a higher bitPlaneGroup (that is, the allocated color allocates many slots of the color map) then all the components are modified.

Parameters
redThe new red component value of this color.
greenThe new green component value of this color.
blueThe new blue component value of this color.

§ setSaturation()

void IlvColor::setSaturation ( IlFloat  saturation)

Sets the saturation.

This member function does nothing if this color is not mutable.

Assigns a saturation value to the current color. In the context of the HSV cone model, this number ranges from zero (gray) to one (maximum vividness).

Parameters
saturationThe new saturation value of this color.

§ setValue()

void IlvColor::setValue ( IlFloat  value)

Sets the luminosity value.

This member function does nothing if this color is not mutable.

Assigns a luminosity value to the current color. In the context of the HSV cone model, this number ranges from zero (black) to one (white).

Parameters
valueThe new luminosity value of this color.

§ unLock()

virtual void IlvColor::unLock ( )
virtual

Unlocks the resource.

This function decrements the reference count of the resource, and deletes it if this count becomes 0. Resource management is closely concerned with the way resources are locked and unlocked. Whenever you need a specific resource in one of your persistent objects, you should use this mechanism to make sure that it will stay safe within your IlvDisplay instance. If your application needs more than one instance of IlvDisplay, you have to create resources within each environment, since resources cannot be shared between the different IlvDisplay contexts.

Reimplemented from IlvResource.


© Copyright 2017, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.