libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AlgAudio::Color Class Reference

#include <Color.hpp>

Public Member Functions

constexpr Color (unsigned char R, unsigned char G, unsigned char B, unsigned char A=255)
 
constexpr Color (unsigned int hex)
 
 Color ()
 
Color Darker (double amount) const
 
Color Lighter (double amount) const
 
 operator SDL_Color () const
 
SDL_Color SDL () const
 
Color SetAlpha (float a_) const
 
std::string ToString ()
 
Color ZeroAlpha () const
 

Public Attributes

unsigned char alpha
 
unsigned char b
 
unsigned char g
 
unsigned char r
 

Detailed Description

A handy class for representin colors and operations on them.

Constructor & Destructor Documentation

constexpr AlgAudio::Color::Color ( unsigned char  R,
unsigned char  G,
unsigned char  B,
unsigned char  A = 255 
)
inline

Constructs a new color instance using the given values.

constexpr AlgAudio::Color::Color ( unsigned int  hex)
inline

Constructs a new color instance from a hex code. For example, 0x01020304 will get interpreted as r=1, g=2, b=3, a=4.

AlgAudio::Color::Color ( )
inline

Member Function Documentation

Color AlgAudio::Color::Darker ( double  amount) const

Returns a new color darker than this one by the given amount.

Color AlgAudio::Color::Lighter ( double  amount) const

Returns a new color lighter than this one by the given amount.

AlgAudio::Color::operator SDL_Color ( ) const
SDL_Color AlgAudio::Color::SDL ( ) const

Conversion to SDL_Color struct.

Color AlgAudio::Color::SetAlpha ( float  a_) const
inline

Returns a new color with alpha set to the desired value.

std::string AlgAudio::Color::ToString ( )
inline

For prettyprinting colors.

Color AlgAudio::Color::ZeroAlpha ( ) const
inline

Returns a new color with alpha reset to 0

Member Data Documentation

unsigned char AlgAudio::Color::alpha
unsigned char AlgAudio::Color::b
unsigned char AlgAudio::Color::g
unsigned char AlgAudio::Color::r

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