BColor Class Reference

#include <BColor.h>

Inheritance diagram for BColor:

Inheritance graph
[legend]

List of all members.


Detailed Description

Represents an ARGB color.

An RGB color can be represented as an ARGB color with the opacity (A) set to 255.

Public Member Functions

 BColor (UInt32 rgb)
 Constructs a BColor from an integer containing an RGB value.
 BColor (UInt32 red, UInt32 green, UInt32 blue, UInt32 opacity=255)
 Constructs a BColor with the specified components.
 BColor (const BColor &c)
 Copy constructor.
 BColor ()
 Default constructor.
virtual size_t ComputeSize (void) const
 Computes the size of the BByteArray required to store this object.
void FromARGB (UInt32 argb)
 Sets the value of this BColor according to an unsigned integer containing ARGB bytes.
virtual void FromByteArray (const BByteArray &bytes, size_t &startPos)
 Initializes an instance of this object from a BByteArray.
void FromRGB (UInt32 rgb, UInt32 opacity=0xFF)
 Sets the value of this BColor according to an unsigned integer containing RGB bytes.
UInt32 GetBlue (void) const
 Gets the blue component.
UInt32 GetGreen (void) const
 Gets the green component.
UInt32 GetOpacity (void) const
 Gets the opacity component.
UInt32 GetRed (void) const
 Gets the red component.
bool IsTransparent (void) const
 Indicats whether or not this BColor is transparent.
bool operator!= (const BColor &rhs) const
 Inequality operator.
BColoroperator= (const BColor &rhs)
 Assignment operator.
bool operator== (const BColor &rhs) const
 Equality operator.
void SetBlue (UInt32 blue)
 Sets the blue component.
void SetGreen (UInt32 green)
 Sets the green component.
void SetOpacity (UInt32 op)
 Sets the opacity component.
void SetRed (UInt32 red)
 Sets the red component.
UInt32 ToARGB () const
 Converts this BColor to an unsigned integer containing ARGB bytes.
virtual BByteArray ToByteArray (void) const
 Stores this object in a BByteArray.
UInt32 ToRGB (void) const
 Converts this BColor to an unsigned integer containing RGB bytes.
virtual ~BColor ()
 Destructor.

Static Public Member Functions

static size_t SizeOf (void)
 Returns the size of a BColor in bytes.

Static Public Attributes

static BColor Black
 Defines a BColor that is black.
static BColor Transparent
 Defines a BColor that is completely transparent.
static BColor White
 Defines a BColor that is white.


Constructor & Destructor Documentation

BColor (  ) 

Default constructor.

This will construct a BColor that is black.

BColor ( const BColor c  ) 

Copy constructor.

Parameters:
c The BColor to copy.

BColor ( UInt32  red,
UInt32  green,
UInt32  blue,
UInt32  opacity = 255 
)

Constructs a BColor with the specified components.

All arguments to this method must be between 0 and 255. The opacity parameter is optional, and it will be set to 255 (opaque) if it is ommitted.

Parameters:
red The red component.
green The green component.
blue The blue component.
opacity The opacity component.

BColor ( UInt32  rgb  ) 

Constructs a BColor from an integer containing an RGB value.

Parameters:
rgb The RGB value.

virtual ~BColor (  )  [inline, virtual]

Destructor.


Member Function Documentation

virtual size_t ComputeSize ( void   )  const [inline, virtual]

Computes the size of the BByteArray required to store this object.

Returns:
The size of the BByteArray.

Implements BByteStreamable.

void FromARGB ( UInt32  argb  ) 

Sets the value of this BColor according to an unsigned integer containing ARGB bytes.

Parameters:
argb The ARGB value.

virtual void FromByteArray ( const BByteArray bytes,
size_t &  startPos 
) [virtual]

Initializes an instance of this object from a BByteArray.

Parameters:
bytes The BByteArray containing the byte representation for this object.
startPos The position in the BByteArray where the byte representation begins. This value will be updated to point to the byte past the end of this object in the byte array.

Implements BByteStreamable.

void FromRGB ( UInt32  rgb,
UInt32  opacity = 0xFF 
)

Sets the value of this BColor according to an unsigned integer containing RGB bytes.

The opacity of the BColor may optionally be set with this method.

Parameters:
rgb The RGB value.
opacity The opacity value. It is assumed that this value will be between 0 (transparent) and 255 (opaque).

UInt32 GetBlue ( void   )  const [inline]

Gets the blue component.

Returns:
The blue component value. This value will be between 0 (no blue) and 255 (lots of blue).

UInt32 GetGreen ( void   )  const [inline]

Gets the green component.

Returns:
The green component value. This value will be between 0 (no green) and 255 (lots of green).

UInt32 GetOpacity ( void   )  const [inline]

Gets the opacity component.

Returns:
The opacity component value. This value will be between 0 (transparent) and 255 (opaque).

UInt32 GetRed ( void   )  const [inline]

Gets the red component.

Returns:
The red component value. This value will be between 0 (no red) and 255 (lots of red).

bool IsTransparent ( void   )  const [inline]

Indicats whether or not this BColor is transparent.

A BColor is transparent if its opacity value is 0.

Returns:
True if this BColor is transparent and false otherwise.

bool operator!= ( const BColor rhs  )  const

Inequality operator.

Parameters:
rhs The BColor that will be compared to this one.
Returns:
True if this BColor does not have the same value as the specified BColor and false otherwise.

BColor& operator= ( const BColor rhs  ) 

Assignment operator.

Parameters:
rhs The BColor whose value will be copied into this one.
Returns:
A reference to this BColor.

bool operator== ( const BColor rhs  )  const

Equality operator.

Parameters:
rhs The BColor that will be compared to this one.
Returns:
True if this BColor has the same value as the specified BColor and false otherwise.

void SetBlue ( UInt32  blue  )  [inline]

Sets the blue component.

Parameters:
blue The blue component value. It is assumed that this value will be between 0 (no blue) and 255 (lots of blue).

void SetGreen ( UInt32  green  )  [inline]

Sets the green component.

Parameters:
green The green component value. It is assumed that this value will be between 0 (no green) and 255 (lots of green).

void SetOpacity ( UInt32  op  )  [inline]

Sets the opacity component.

Parameters:
op The opacity component value. It is assumed that this value will be between 0 (transparent) and 255 (opaque).

void SetRed ( UInt32  red  )  [inline]

Sets the red component.

Parameters:
red The red component value. It is assumed that this value will be between 0 (no red) and 255 (lots of red).

static size_t SizeOf ( void   )  [inline, static]

Returns the size of a BColor in bytes.

Returns:
The size of a BColor in bytes.

UInt32 ToARGB (  )  const

Converts this BColor to an unsigned integer containing ARGB bytes.

Returns:
The ARGB value.

virtual BByteArray ToByteArray ( void   )  const [virtual]

Stores this object in a BByteArray.

Returns:
A BByteArray that stores the contents of this object.

Implements BByteStreamable.

UInt32 ToRGB ( void   )  const

Converts this BColor to an unsigned integer containing RGB bytes.

Returns:
The RGB value.


Member Data Documentation

BColor Black [static]

Defines a BColor that is black.

BColor Transparent [static]

Defines a BColor that is completely transparent.

BColor White [static]

Defines a BColor that is white.


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

GeoTranslate 5.0 From Blue Marble Geographics