## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csRGBcolor Struct Reference
[Graphics]

An RGB color. More...

`#include <csgfx/rgbpixel.h>`

List of all members.

## Public Member Functions

| csRGBcolor (unsigned char r, unsigned char g, unsigned char b)
| Initialize the color with some R/G/B value.
| csRGBcolor ()
| Constructor (initialize to zero).
bool | operator!= (const csRGBcolor &c) const
| Compare with an csRGBcolor.
csRGBcolor | operator+ (const csRGBcolor &c) const
| Add two csRGBcolors (may overflow!).
bool | operator== (const csRGBcolor &c) const
| Compare with an csRGBcolor.
void | SafeAdd (const csRGBcolor &c)
| Use this in the general case.
void | Set (unsigned char r, unsigned char g, unsigned char b)
| Assign given red/green/blue values to this pixel.
void | UnsafeAdd (const csRGBcolor &c)
| Use this only if you know there is no overflow.

## Public Attributes

unsigned char | blue
unsigned char | green
unsigned char | red
| The red, green, blue components.

## Detailed Description

An RGB color.

This class is used whenever we need just R, G and B information, such as when defining a color palette.

Definition at line 67 of file rgbpixel.h.

## Constructor & Destructor Documentation

csRGBcolor::csRGBcolor | ( |  | ) | `[inline]`

Constructor (initialize to zero).

Definition at line 72 of file rgbpixel.h.

Referenced by operator+().

csRGBcolor::csRGBcolor | ( | unsigned char | r,
|  | unsigned char | g,
|  | unsigned char | b |
| ) |  |  | `[inline]`

Initialize the color with some R/G/B value.

Definition at line 74 of file rgbpixel.h.

## Member Function Documentation

bool csRGBcolor::operator!= | ( | const csRGBcolor & | c | ) | const`[inline]`

Compare with an csRGBcolor.

Definition at line 83 of file rgbpixel.h.

References operator==().

csRGBcolor csRGBcolor::operator+ | ( | const csRGBcolor & | c | ) | const`[inline]`

Add two csRGBcolors (may overflow!).

Definition at line 86 of file rgbpixel.h.

References blue, csRGBcolor(), green, and red.

bool csRGBcolor::operator== | ( | const csRGBcolor & | c | ) | const`[inline]`

Compare with an csRGBcolor.

Definition at line 80 of file rgbpixel.h.

References blue, green, and red.

Referenced by operator!=().

void csRGBcolor::SafeAdd | ( | const csRGBcolor & | c | ) | `[inline]`

Use this in the general case.

This version test for overflow.

Definition at line 103 of file rgbpixel.h.

References blue, green, and red.

void csRGBcolor::Set | ( | unsigned char | r,
|  | unsigned char | g,
|  | unsigned char | b |
| ) |  |  | `[inline]`

Assign given red/green/blue values to this pixel.

Definition at line 77 of file rgbpixel.h.

References blue, green, and red.

void csRGBcolor::UnsafeAdd | ( | const csRGBcolor & | c | ) | `[inline]`

Use this only if you know there is no overflow.

Definition at line 94 of file rgbpixel.h.

References blue, green, and red.

## Member Data Documentation

unsigned char csRGBcolor::red

The red, green, blue components.

Definition at line 70 of file rgbpixel.h.

Referenced by csComparator< csRGBcolor, csRGBcolor >::Compare(), operator+(), csRGBpixel::operator+=(), csRGBpixel::operator==(), operator==(), csPackRGB::PackRGBcolorToRGBBuffer(), SafeAdd(), Set(), csPackRGBA::UnpackRGBAtoRGBcolor(), csPackRGB::UnpackRGBtoRGBcolor(), and UnsafeAdd().

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

- csgfx/rgbpixel.h