rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvColor Class Reference

Resource class. More...

#include <ilviews/base/resource.h>

Inheritance diagram for IlvColor:
IlvResource

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Friends

class IlvDisplay

Detailed Description

Resource class.

Library: display

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

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:
reference The reference color.
topShade Is set to a brighter version of reference.
bottomShade Is set to a dimmer version of reference.
select A color that looks like a selected version of reference (usually slightly dimmer).
IlvIntensity IlvColor::getBlue (  )  const

Retrieves the blue component value.

Returns:
The intensity of the blue component.
IlvIntensity IlvColor::getGreen (  )  const

Retrieves the green component value.

Returns:
The intensity of the green component.
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:
hue The hue value of this color.
saturation The saturation value of this color.
value The luminosity value of this color.
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.
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.
IlvIntensity IlvColor::getRed (  )  const

Retrieves the red component value.

Returns:
The intensity of the red component.
void IlvColor::getRGB ( IlvIntensity red,
IlvIntensity green,
IlvIntensity blue 
) const

Retrieves the RGB component values.

Parameters:
red The red component value.
green The green component value.
blue The blue component value.
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).
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).
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:
h The input hue value.
s The input saturation value.
v The 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.
red Is set to the output red component value.
green Is set to the output green component value.
blue Is set to the output blue component value.
IlBoolean IlvColor::isMutable (  )  const

Get the mutable attribute.

Returns:
A Boolean value that indicates whether this color is mutable or not. A color can be either static (impossible to modify after its creation) or mutable. In the latter case, you can use 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.

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:
red The input red value.
green The input green value.
blue The input blue value.
h Is set to the output hue value.
s Is set to the output saturation value.
v Is set to the output luminosity value value.
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:
blue The new blue component value of this color.
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:
green The new green component value of this color.
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:
hue The new hue value of this color.
saturation The new saturation value of this color.
value The new luminosity value of this color.
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:
hue The new hue value of this color.
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.

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:
red The new red component value of this color.
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:
red The new red component value of this color.
green The new green component value of this color.
blue The new blue component value of this color.
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:
saturation The new saturation value of this color.
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:
value The new luminosity value of this color.
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.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, 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.