39 typedef unsigned char value_t ;
40 typedef g_uint32_t cc_t ;
45 Colour( value_t
r , value_t
g , value_t
b ) ;
111 return (r<<16) | (g<<8) | (b<<0) ;
117 return Colour( (cc>>16) & 255U , (cc>>8) & 255U , (cc>>0) & 255U ) ;
122 inline bool operator==(
const Colour & p ,
const Colour & q )
124 return p.m_r == q.m_r && p.m_g == q.m_g && p.m_b == q.m_b ;
126 inline bool operator!=(
const Colour & p ,
const Colour & q )
130 inline void swap( Colour & p , Colour & q )
132 std::swap( p.m_r , q.m_r ) ;
133 std::swap( p.m_g , q.m_g ) ;
134 std::swap( p.m_b , q.m_b ) ;
136 inline std::ostream & operator<<( std::ostream & stream ,
const Colour & colour )
140 <<
static_cast<unsigned int>(colour.r()) <<
","
141 << static_cast<unsigned int>(colour.g()) <<
","
142 << static_cast<unsigned int>(colour.b()) <<
"]}" ;
value_t r() const
Returns the red value.
A simple rgb colour structure.
static Colour from(cc_t cc)
Creates a colour from a combined-component value.
value_t g() const
Returns the green value.
value_t b() const
Returns the blue value.
Colour()
Default constructor for black.
cc_t cc() const
Returns a combined-component value that incorporates the r(), g() and b() values. ...