# CColor Struct Reference

Related Scripting Object: Color

This struct represents an RGBA color. More...

`#include <xsi_color.h>`

List of all members.

## Public Member Functions
| CColor ()
| CColor (const CColor &in_color)
| CColor (double in_rc, double in_gc, double in_bc, double in_ac)
bool | operator== (const CColor &in_color) const
bool | operator!= (const CColor &in_color) const
## Public Attributes
double | r
double | g
double | b
double | a

## Detailed Description

This struct represents an RGBA color.

The RBGA component values are stored as double precision numbers.

CColor objects are created from OGLLight and OGLMaterial objects.

Note:
  If a component value is greater than a signed, single-precision value, the component value is interpreted as a negative value.

In most cases, the component values are normalized to the range 0 to 1. TrianglePoint::GetColor is an exception, and returns values in the range 0 to 255.

Other XSI objects and properties store colors differently:

- Shaders and XSI objects have separate Parameter objects for each color component (for example, `Scene_Material.Phong.diffuse.green`). These component values are normalized and use double precision.

- Vertex Color properties store color component values as arrays of doubles inside a ClusterProperty.

- Wireframe colors are encoded as 10-bit values (0 to 1023), with the least significant bit ignored. Each of the R,G,B channels is 3 bits (a number from 0 to 7), and the wireframe color is encoded as:

       B2|B1|B0|G2|G1|G0|R2|R1|R0|0|

See also:
  CColorArray, OGLLight::GetColor, OGLMaterial::GetDiffuse, OGLMaterial::GetSpecular, OGLMaterial::GetAmbient

## Constructor & Destructor Documentation

CColor | ( |  | ) | `[inline]`

Constructs a CColor object.

CColor | ( | const CColor & | in_color | ) | `[inline]`

Constructs a new CColor object from an existing CColor object.

Parameters:

  | in_color | An existing CColor object to copy into this CColor object.

CColor | ( | double | in_rc,
|  | double | in_gc,
|  | double | in_bc,
|  | double | in_ac |
| ) |  |  | `[inline]`

Constructs a new CColor object from RGBA values.

Parameters:

  | in_rc | Red component value.
  | in_gc | Green component value.
  | in_bc | Blue component value.
  | in_ac | Alpha component value.

## Member Function Documentation

bool operator== | ( | const CColor & | in_color | ) | const`[inline]`

Tests whether two CColor objects are equal.

Parameters:

  | in_color | CColor to compare with this CColor object.

Returns:
  True if the colors are equal, and false otherwise.

bool operator!= | ( | const CColor & | in_color | ) | const`[inline]`

Tests whether two CColor objects are different.

Parameters:

  | in_color | CColor to compare with this CColor object

Returns:
  True if the colors are different, and false is they are the same.

## Member Data Documentation

double r

Red component value

double g

Green component value

double b

Blue component value

double a

Alpha component value

The documentation for this struct was generated from the following file:

- xsi_color.h