CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csRGBpixel Struct Reference
[Graphics]

An RGB pixel. More...

#include <rgbpixel.h>

List of all members.

Public Methods

 csRGBpixel ()
 Constructor (initialize to zero, alpha to 255).

 csRGBpixel (const csRGBpixel &p)
 Copy constructor.

 csRGBpixel (const csRGBcolor &c)
 Yet another copy constructor.

 csRGBpixel (int r, int g, int b)
 Initialize the pixel with some R/G/B value.

bool operator== (const csRGBcolor &c) const
 Compare with an csRGBcolor.

bool operator== (const csRGBpixel &p) const
 Compare with an csRGBpixel (including alpha value).

bool operator!= (const csRGBcolor &c) const
 Check if the csRGBpixel is not equal to an csRGBcolor.

bool operator!= (const csRGBpixel &p) const
 Check if this csRGBpixel is not equal to another csRGBpixel (including alpha).

 operator csRGBcolor () const
 Construct an csRGBcolor from this csRGBpixel.

bool eq (const csRGBpixel &p) const
 Compare with another csRGBpixel, but don't take alpha into account.

int Intensity ()
 Get the pixel intensity.

unsigned char Luminance ()
 Get the pixel luminance.

void Set (const int r, const int g, const int b)
 Assign given red/green/blue values to this pixel.

void Set (const int r, const int g, const int b, const int a)
 Assign given red/green/blue/alpha values to this pixel.

void Set (const csRGBpixel &p)
 Assign another csRGBpixel.

void operator+= (const csRGBcolor &c)
 Add a csRGBcolor.

void UnsafeAdd (const csRGBpixel &c)
 Use this only if you know there is no overflow.

void SafeAdd (const csRGBpixel &c)
 Use this in the general case.


Public Attributes

unsigned char red
 The red, green, blue and alpha components.

unsigned char green
 The red, green, blue and alpha components.

unsigned char blue
 The red, green, blue and alpha components.

unsigned char alpha
 The red, green, blue and alpha components.


Detailed Description

An RGB pixel.

In addition to R,G,B color components this structure also contains the Alpha channel component, which is used in images (that potentially have an alpha channel).

Definition at line 98 of file rgbpixel.h.


Constructor & Destructor Documentation

csRGBpixel::csRGBpixel   [inline]
 

Constructor (initialize to zero, alpha to 255).

Definition at line 103 of file rgbpixel.h.

References alpha, blue, green, and red.

csRGBpixel::csRGBpixel const csRGBpixel &    p [inline]
 

Copy constructor.

Definition at line 105 of file rgbpixel.h.

References alpha, blue, green, and red.

csRGBpixel::csRGBpixel const csRGBcolor   c [inline]
 

Yet another copy constructor.

Definition at line 108 of file rgbpixel.h.

References alpha, blue, green, and red.

csRGBpixel::csRGBpixel int    r,
int    g,
int    b
[inline]
 

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

Definition at line 111 of file rgbpixel.h.

References alpha, blue, green, and red.


Member Function Documentation

bool csRGBpixel::eq const csRGBpixel &    p const [inline]
 

Compare with another csRGBpixel, but don't take alpha into account.

Definition at line 135 of file rgbpixel.h.

References operator==().

int csRGBpixel::Intensity   [inline]
 

Get the pixel intensity.

Definition at line 138 of file rgbpixel.h.

References blue, green, and red.

unsigned char csRGBpixel::Luminance   [inline]
 

Get the pixel luminance.

Definition at line 141 of file rgbpixel.h.

References blue, green, and red.

csRGBpixel::operator csRGBcolor   const [inline]
 

Construct an csRGBcolor from this csRGBpixel.

Definition at line 132 of file rgbpixel.h.

References blue, green, and red.

bool csRGBpixel::operator!= const csRGBpixel &    p const [inline]
 

Check if this csRGBpixel is not equal to another csRGBpixel (including alpha).

Definition at line 129 of file rgbpixel.h.

References operator==().

bool csRGBpixel::operator!= const csRGBcolor   c const [inline]
 

Check if the csRGBpixel is not equal to an csRGBcolor.

Definition at line 123 of file rgbpixel.h.

References operator==().

void csRGBpixel::operator+= const csRGBcolor   c [inline]
 

Add a csRGBcolor.

Definition at line 165 of file rgbpixel.h.

References csRGBcolor::blue, blue, csRGBcolor::green, green, csRGBcolor::red, and red.

bool csRGBpixel::operator== const csRGBpixel &    p const [inline]
 

Compare with an csRGBpixel (including alpha value).

Definition at line 120 of file rgbpixel.h.

References blue, green, and red.

bool csRGBpixel::operator== const csRGBcolor   c const [inline]
 

Compare with an csRGBcolor.

Definition at line 117 of file rgbpixel.h.

References blue, csRGBcolor::blue, green, csRGBcolor::green, red, and csRGBcolor::red.

Referenced by eq(), and operator!=().

void csRGBpixel::SafeAdd const csRGBpixel &    c [inline]
 

Use this in the general case.

This version test for overflow. Note that alpha is ignored by this routine.

Definition at line 185 of file rgbpixel.h.

References blue, green, and red.

void csRGBpixel::Set const csRGBpixel &    p [inline]
 

Assign another csRGBpixel.

Definition at line 162 of file rgbpixel.h.

References alpha, blue, green, and red.

void csRGBpixel::Set const int    r,
const int    g,
const int    b,
const int    a
[inline]
 

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

Definition at line 154 of file rgbpixel.h.

References alpha, blue, green, and red.

void csRGBpixel::Set const int    r,
const int    g,
const int    b
[inline]
 

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

Definition at line 146 of file rgbpixel.h.

References alpha, blue, green, and red.

void csRGBpixel::UnsafeAdd const csRGBpixel &    c [inline]
 

Use this only if you know there is no overflow.

Also take care to set alpha to 0 in 'c'!

Definition at line 175 of file rgbpixel.h.

References blue, green, and red.


Member Data Documentation

unsigned char csRGBpixel::alpha
 

The red, green, blue and alpha components.

Definition at line 101 of file rgbpixel.h.

Referenced by csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Set(), and csShaderVariable::SetValue().

unsigned char csRGBpixel::blue
 

The red, green, blue and alpha components.

Definition at line 101 of file rgbpixel.h.

Referenced by csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().

unsigned char csRGBpixel::green
 

The red, green, blue and alpha components.

Definition at line 101 of file rgbpixel.h.

Referenced by csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().

unsigned char csRGBpixel::red
 

The red, green, blue and alpha components.

Definition at line 101 of file rgbpixel.h.

Referenced by csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18