blip  0.1
Color Class Reference

A color with red, green, blue, and alpha components. More...

#include <Color.hpp>

Public Member Functions

 Color (uint32_t rgba) throw ()
 Construct a new Color from the given packed 32-bit RGBA representation. More...
 
 Color (uint8_t red=0, uint8_t green=0, uint8_t blue=0, uint8_t alpha=255) throw ()
 Construct a new Color with the given red, green, blue, and alpha components. More...
 
 ~Color () throw ()
 Destructor. More...
 
void setRed (uint8_t red) throw ()
 Set the red component of the color. More...
 
uint8_t getRed () const throw ()
 Get the red component of the color. More...
 
void setGreen (uint8_t green) throw ()
 Set the green component of the color. More...
 
uint8_t getGreen () const throw ()
 Get the green component of the color. More...
 
void setBlue (uint8_t blue) throw ()
 Set the blue component of the color. More...
 
uint8_t getBlue () const throw ()
 Get the blue component of the color. More...
 
void setAlpha (uint8_t alpha) throw ()
 Set the alpha component of the color. More...
 
uint8_t getAlpha () const throw ()
 Get the alpha component of the color. More...
 
void setColor (int red, int green, int blue, int alpha) throw ()
 Set all components of the color. More...
 
void setRGBA (uint32_t rgba) throw ()
 Set the color from the 32-bit packed RGBA representation. More...
 
uint32_t toRGBA () const throw ()
 Get the color's 32-bit packed RGBA representation. More...
 
void getHSL (float *hue, float *saturation, float *lightness) const throw ()
 Get the hue, saturation, and lightness values for this color. More...
 
void setHSL (float hue, float saturation, float lightness) throw ()
 Set this color using hue, saturation, and lightness values. More...
 

Static Public Attributes

static const Color BLACK
 Black (#000000) More...
 
static const Color BLUE
 Blue (#0000FF) More...
 
static const Color CYAN
 Cyan (#00FFFF) More...
 
static const Color DARK_BLUE
 Dark blue (#000080) More...
 
static const Color DARK_CYAN
 Dark cyan (#008080) More...
 
static const Color DARK_GRAY
 Dark gray (#808080) More...
 
static const Color DARK_GREEN
 Dark green (#008000) More...
 
static const Color DARK_MAGENTA
 Dark magenta (#800080) More...
 
static const Color DARK_RED
 Dark red (#800000) More...
 
static const Color DARK_YELLOW
 Dark yellow (#808000) More...
 
static const Color GRAY
 Gray (#A0A0A0) More...
 
static const Color GREEN
 Green (#00FF00) More...
 
static const Color LIGHT_GRAY
 Light gray (#C0C0C0) More...
 
static const Color MAGENTA
 Magenta (#FF00FF) More...
 
static const Color RED
 Red (#FF0000) More...
 
static const Color TRANSPARENT
 Transparent black. More...
 
static const Color WHITE
 White (#FFFFFF) More...
 
static const Color YELLOW
 Yellow (#FFFF00) More...
 

Detailed Description

A color with red, green, blue, and alpha components.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ Color() [1/2]

Color ( uint32_t  rgba)
throw (
)
explicit

Construct a new Color from the given packed 32-bit RGBA representation.

◆ Color() [2/2]

Color ( uint8_t  red = 0,
uint8_t  green = 0,
uint8_t  blue = 0,
uint8_t  alpha = 255 
)
throw (
)

Construct a new Color with the given red, green, blue, and alpha components.

◆ ~Color()

~Color ( )
throw (
)

Destructor.

Member Function Documentation

◆ getAlpha()

uint8_t getAlpha ( ) const
throw (
)
inline

Get the alpha component of the color.

◆ getBlue()

uint8_t getBlue ( ) const
throw (
)
inline

Get the blue component of the color.

◆ getGreen()

uint8_t getGreen ( ) const
throw (
)
inline

Get the green component of the color.

◆ getHSL()

void getHSL ( float *  hue,
float *  saturation,
float *  lightness 
) const
throw (
)

Get the hue, saturation, and lightness values for this color.

◆ getRed()

uint8_t getRed ( ) const
throw (
)
inline

Get the red component of the color.

◆ setAlpha()

void setAlpha ( uint8_t  alpha)
throw (
)
inline

Set the alpha component of the color.

◆ setBlue()

void setBlue ( uint8_t  blue)
throw (
)
inline

Set the blue component of the color.

◆ setColor()

void setColor ( int  red,
int  green,
int  blue,
int  alpha 
)
throw (
)

Set all components of the color.

◆ setGreen()

void setGreen ( uint8_t  green)
throw (
)
inline

Set the green component of the color.

◆ setHSL()

void setHSL ( float  hue,
float  saturation,
float  lightness 
)
throw (
)

Set this color using hue, saturation, and lightness values.

◆ setRed()

void setRed ( uint8_t  red)
throw (
)
inline

Set the red component of the color.

◆ setRGBA()

void setRGBA ( uint32_t  rgba)
throw (
)

Set the color from the 32-bit packed RGBA representation.

◆ toRGBA()

uint32_t toRGBA ( ) const
throw (
)

Get the color's 32-bit packed RGBA representation.

Member Data Documentation

◆ BLACK

const Color BLACK
static

Black (#000000)

◆ BLUE

const Color BLUE
static

Blue (#0000FF)

◆ CYAN

const Color CYAN
static

Cyan (#00FFFF)

◆ DARK_BLUE

const Color DARK_BLUE
static

Dark blue (#000080)

◆ DARK_CYAN

const Color DARK_CYAN
static

Dark cyan (#008080)

◆ DARK_GRAY

const Color DARK_GRAY
static

Dark gray (#808080)

◆ DARK_GREEN

const Color DARK_GREEN
static

Dark green (#008000)

◆ DARK_MAGENTA

const Color DARK_MAGENTA
static

Dark magenta (#800080)

◆ DARK_RED

const Color DARK_RED
static

Dark red (#800000)

◆ DARK_YELLOW

const Color DARK_YELLOW
static

Dark yellow (#808000)

◆ GRAY

const Color GRAY
static

Gray (#A0A0A0)

◆ GREEN

const Color GREEN
static

Green (#00FF00)

◆ LIGHT_GRAY

const Color LIGHT_GRAY
static

Light gray (#C0C0C0)

◆ MAGENTA

const Color MAGENTA
static

Magenta (#FF00FF)

◆ RED

const Color RED
static

Red (#FF0000)

◆ TRANSPARENT

const Color TRANSPARENT
static

Transparent black.

◆ WHITE

const Color WHITE
static

White (#FFFFFF)

◆ YELLOW

const Color YELLOW
static

Yellow (#FFFF00)


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