pgCol Struct Reference
[pgDraw -- Graphics module]

A 32-bit color which is represented by red, green, blue and alpha components. More...

#include <pg_col.h>

List of all members.

Public Member Functions

 pgCol ()
 Constructs a pgCol.
 pgCol (const pgCol &col)
 Constructs and initializes a pgCol from the specified pgCol.
 pgCol (u8 r_, u8 g_, u8 b_, u8 a_=255)
 Constructs and initializes a pgCol from the specified components.
void set (u8 r_, u8 g_, u8 b_, u8 a_=255)
 Sets all components from the specified components.
bool operator== (pgCol col) const
 Returns whether this pgCol is equal to the right hand side pgCol.
bool operator!= (pgCol col) const
 Returns whether this pgCol is unequal to the right hand side pgCol.
pgCol operator+ (pgCol col) const
 Returns a pgCol which is the sum of this pgCol and the right hand side pgCol.
void operator+= (pgCol col)
 Adds the right hand side pgCol to this pgCol.
pgCol operator- (pgCol col) const
 Returns a pgCol which is the right hand side pgCol subtracted from this pgCol.
void operator-= (pgCol col)
 Subtracts the right hand side pgCol from this pgCol.
pgCol operator* (pgCol col) const
 Returns a pgCol which is this pgCol multiplied with right hand side pgCol and divided by 255.
void operator*= (pgCol col)
 Multiplies this pgVec with the right hand side pgCol and divides by 255.
pgCol operator* (r32 s) const
 Returns a pgCol which is this pgCol multiplied with right hand side scalar and divided by 255.
void operator*= (r32 s)
 Multiplies this pgCol with the right hand side scalar.
pgCol operator/ (r32 s) const
 Returns a pgCol which is this pgCol divided by the right hand side scalar.
void operator/= (r32 s)
 Divides this pgCol by the right hand side scalar.
pgCol interp (pgCol to, r32 ratio) const
 Returns a pgCol which is interpolated between this pgCol and an another pgCol by the specified ratio, using linear interpolation.

Public Attributes

u8 r
u8 g
u8 b
u8 a

Static Public Attributes

static const pgCol ZERO
 The color whose all components are 0s.
static const pgCol FULL
 The color whose all components are 255s.

Friends

PG_API friend pgCol operator* (r32 s, pgCol col)
 Returns a pgCol which is the right hand side pgCol multiplied with the left hand side scalar.


Detailed Description

A 32-bit color which is represented by red, green, blue and alpha components.

Constructor & Destructor Documentation

pgCol::pgCol ( const pgCol col  ) 

Constructs and initializes a pgCol from the specified pgCol.

Parameters:
[in] col A pgCol.

pgCol::pgCol ( u8  r_,
u8  g_,
u8  b_,
u8  a_ = 255 
)

Constructs and initializes a pgCol from the specified components.

Parameters:
[in] r_ A red component.
[in] g_ A green component.
[in] b_ A blue component.
[in] a_ An alpha component. If not specified, 255 is used.


Member Function Documentation

pgCol pgCol::interp ( pgCol  to,
r32  ratio 
) const

Returns a pgCol which is interpolated between this pgCol and an another pgCol by the specified ratio, using linear interpolation.

param[in] to An another pgCol.

Parameters:
[in] ratio The value which indicates how far to interpolate between two pgCols. This value is clamped between 0.0f and 1.0f.
Returns:
A pgCol which is interpolated between two pgCols.

bool pgCol::operator!= ( pgCol  col  )  const

Returns whether this pgCol is unequal to the right hand side pgCol.

Parameters:
[in] col The right hand side pgCol.
Returns:
Whether this pgCol is unequal to the right hand side pgCol.

pgCol pgCol::operator* ( r32  s  )  const

Returns a pgCol which is this pgCol multiplied with right hand side scalar and divided by 255.

The values of the components are clamped between 0 and 255.

Parameters:
[in] The right hand side scalar.
Returns:
A pgCol which is this pgCol multiplied with right hand side scalar and divided by 255.

pgCol pgCol::operator* ( pgCol  col  )  const

Returns a pgCol which is this pgCol multiplied with right hand side pgCol and divided by 255.

The values of the components are clamped between 0 and 255.

Parameters:
[in] col The right hand side pgCol.
Returns:
A pgCol which is this pgCol multiplied with right hand side pgCol and divided by 255.

void pgCol::operator*= ( r32  s  ) 

Multiplies this pgCol with the right hand side scalar.

The values of the components are clamped between 0 and 255.

Parameters:
[in] The right hand side scalar.

void pgCol::operator*= ( pgCol  col  ) 

Multiplies this pgVec with the right hand side pgCol and divides by 255.

The values of the components are clamped between 0 and 255.

Parameters:
[in] col The right hand side pgCol.

pgCol pgCol::operator+ ( pgCol  col  )  const

Returns a pgCol which is the sum of this pgCol and the right hand side pgCol.

The values of the components are clamped between 0 and 255.

Parameters:
[in] col The right hand side pgCol.
Returns:
A pgCol which is the sum of two pgCols.

void pgCol::operator+= ( pgCol  col  ) 

Adds the right hand side pgCol to this pgCol.

The values of the components are clamped between 0 and 255.

Parameters:
[in] col The right hand side pgCol.

pgCol pgCol::operator- ( pgCol  col  )  const

Returns a pgCol which is the right hand side pgCol subtracted from this pgCol.

The values of the components are clamped between 0 and 255.

Parameters:
[in] col The right hand side pgCol.
Returns:
A pgCol which is the right hand side pgCol subtracted from this pgCol.

void pgCol::operator-= ( pgCol  col  ) 

Subtracts the right hand side pgCol from this pgCol.

The values of the components are clamped between 0 and 255.

Parameters:
[in] col The right hand side pgCol.

pgCol pgCol::operator/ ( r32  s  )  const

Returns a pgCol which is this pgCol divided by the right hand side scalar.

The values of the components are clamped between 0 and 255.

Parameters:
[in] s The right hand side scalar.
Returns:
A pgCol which is this pgCol divided by the right hand side scalar.

void pgCol::operator/= ( r32  s  ) 

Divides this pgCol by the right hand side scalar.

The values of the components are clamped between 0 and 255.

Parameters:
[in] s The right hand side scalar.

bool pgCol::operator== ( pgCol  col  )  const

Returns whether this pgCol is equal to the right hand side pgCol.

Parameters:
[in] col The right hand side pgCol.
Returns:
Whether this pgCol is equal to the right hand side pgCol.

void pgCol::set ( u8  r_,
u8  g_,
u8  b_,
u8  a_ = 255 
)

Sets all components from the specified components.

Parameters:
[in] r_ A red component.
[in] g_ A green component.
[in] b_ A blue component.
[in] a_ An alpha component. If not specified, 255 is used.


Friends And Related Function Documentation

PG_API friend pgCol operator* ( r32  s,
pgCol  col 
) [friend]

Returns a pgCol which is the right hand side pgCol multiplied with the left hand side scalar.

The values of the components are clamped between 0 and 255.

Parameters:
[in] s The left hand side scalar.
[in] col The right hand side pgCol.
Returns:
A pgCol which is the right hand side pgCol multiplied with the left hand side scalar.


Member Data Documentation

const pgCol pgCol::FULL [static]

The color whose all components are 255s.

const pgCol pgCol::ZERO [static]

The color whose all components are 0s.


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

Generated on Sat Aug 15 11:24:38 2009 for Pogolyn by  doxygen 1.5.8