zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Zeni::Color Struct Reference

Color. More...

#include <Color.h>

Public Member Functions

 Color ()
 Set the red, green, blue, and alpha channels using the stored type, float. More...
 
 Color (const float &a, const float &r, const float &g, const float &b)
 ARGB order is used for consistency despite interal RGBA ordering. More...
 
 Color (const Uint32 &argb)
 
unsigned char a_ub () const
 Get the alpha channel [0x00, 0xFF]. More...
 
unsigned char b_ub () const
 Get the blue channel [0x00, 0xFF]. More...
 
unsigned char g_ub () const
 Get the green channel [0x00, 0xFF]. More...
 
Uint32 get_argb () const
 Get a Uint32 representation of 0xAARRGGBB. More...
 
Uint32 get_bgra () const
 Get a Uint32 representation of 0xBBGGRRAA - Endianness swap of rgba. More...
 
Uint32 get_rgba () const
 Get a Uint32 representation of 0xRRGGBBAA. More...
 
Color interpolate_to (const float &rhs_part, const Color &rhs) const
 Get a color that is inbetween this color and another color. More...
 
bool operator< (const Color &rhs) const
 To provide an arbitrary total ordering. Do not depend on it remaining the same in the future. More...
 
bool operator== (const Color &rhs) const
 A simple equality test. Close hits are misses. More...
 
const float & operator[] (const int &index) const
 Get 'index'. More...
 
float & operator[] (const int &index)
 Get 'index'. More...
 
unsigned char r_ub () const
 Get the red channel [0x00, 0xFF]. More...
 

Public Attributes

float a
 
float b
 
float g
 
float r
 

Detailed Description

Color.

This class describes a color in ARGB mode.

Note
Different functions prefer receiving color channels in different types and orders. Be careful.
Author
bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 41 of file Color.h.

Constructor & Destructor Documentation

Zeni::Color::Color ( )

Set the red, green, blue, and alpha channels using the stored type, float.

Default value is full white (opaque)

Definition at line 22 of file Color.cpp.

Referenced by interpolate_to().

Zeni::Color::Color ( const float &  a,
const float &  r,
const float &  g,
const float &  b 
)

ARGB order is used for consistency despite interal RGBA ordering.

Definition at line 30 of file Color.cpp.

Zeni::Color::Color ( const Uint32 argb)
explicit

Definition at line 38 of file Color.cpp.

Member Function Documentation

unsigned char Zeni::Color::a_ub ( ) const
inline

Get the alpha channel [0x00, 0xFF].

Definition at line 39 of file Color.hxx.

Referenced by Zeni::Video_DX9::clear_render_target(), get_argb(), get_bgra(), and get_rgba().

unsigned char Zeni::Color::b_ub ( ) const
inline

Get the blue channel [0x00, 0xFF].

Definition at line 35 of file Color.hxx.

Referenced by Zeni::Video_DX9::clear_render_target(), get_argb(), get_bgra(), and get_rgba().

unsigned char Zeni::Color::g_ub ( ) const
inline

Get the green channel [0x00, 0xFF].

Definition at line 31 of file Color.hxx.

Referenced by Zeni::Video_DX9::clear_render_target(), get_argb(), get_bgra(), and get_rgba().

Uint32 Zeni::Color::get_argb ( ) const
inline
Uint32 Zeni::Color::get_bgra ( ) const
inline

Get a Uint32 representation of 0xBBGGRRAA - Endianness swap of rgba.

Definition at line 51 of file Color.hxx.

References a_ub(), b_ub(), g_ub(), and r_ub().

Uint32 Zeni::Color::get_rgba ( ) const
inline

Get a Uint32 representation of 0xRRGGBBAA.

Definition at line 43 of file Color.hxx.

References a_ub(), b_ub(), g_ub(), and r_ub().

Referenced by Zeni::Image::set_Color().

Color Zeni::Color::interpolate_to ( const float &  rhs_part,
const Color rhs 
) const

Get a color that is inbetween this color and another color.

Definition at line 46 of file Color.cpp.

References a, b, Color(), g, and r.

Referenced by Zeni::Image::extract_Color(), and Zeni::Vertex3f_Color::interpolate_to().

bool Zeni::Color::operator< ( const Color rhs) const

To provide an arbitrary total ordering. Do not depend on it remaining the same in the future.

Definition at line 54 of file Color.cpp.

References a, b, g, and r.

bool Zeni::Color::operator== ( const Color rhs) const

A simple equality test. Close hits are misses.

Definition at line 61 of file Color.cpp.

References a, b, g, and r.

const float & Zeni::Color::operator[] ( const int index) const
inline

Get 'index'.

Definition at line 55 of file Color.hxx.

References assert, and r.

float & Zeni::Color::operator[] ( const int index)
inline

Get 'index'.

Definition at line 61 of file Color.hxx.

References assert, and r.

unsigned char Zeni::Color::r_ub ( ) const
inline

Get the red channel [0x00, 0xFF].

Definition at line 27 of file Color.hxx.

Referenced by Zeni::Video_DX9::clear_render_target(), get_argb(), get_bgra(), and get_rgba().

Member Data Documentation


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