Nana C++ Library. Reference for users.
What we need to use nana
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
nana::color Class Reference

Public Member Functions

 color ()=default
 
 color (colors)
 
 color (colors, double alpha)
 
 color (color_rgb)
 
 color (color_argb)
 
 color (color_rgba)
 
 color (unsigned red, unsigned green, unsigned blue, double alpha=1.0)
 
 color (std::string css_rgb)
 Initializes the color with a CSS-like rgb string. More...
 
coloralpha (double)
 Sets alpha channel. More...
 
colorfrom_rgb (unsigned red, unsigned green, unsigned blue)
 immutable alpha channel More...
 
colorfrom_hsl (double hue, double saturation, double lightness)
 immutable alpha channel More...
 
color blend (const color &blending_color, double fade_rate) const
 Blends color. More...
 
bool invisible () const
 Determines whether the color is completely transparent. More...
 
pixel_color_t px_color () const
 
pixel_argb_t argb () const
 
pixel_rgba_t rgba () const
 
const double & r () const
 
const double & g () const
 
const double & b () const
 
const double & a () const
 
bool operator== (const color &other) const
 
bool operator!= (const color &other) const
 

Friends

color operator+ (const color &, const color &)
 

Detailed Description

Examples:
a_group_impl.cpp.

Constructor & Destructor Documentation

nana::color::color ( )
default
nana::color::color ( colors  clr)
nana::color::color ( colors  clr,
double  alpha 
)
nana::color::color ( color_rgb  rgb)
nana::color::color ( color_argb  argb)
nana::color::color ( color_rgba  rgba)
nana::color::color ( unsigned  red,
unsigned  green,
unsigned  blue,
double  alpha = 1.0 
)
nana::color::color ( std::string  css_rgb)
explicit

Initializes the color with a CSS-like rgb string.

Member Function Documentation

const double & nana::color::a ( ) const
color & nana::color::alpha ( double  al)

Sets alpha channel.

pixel_argb_t nana::color::argb ( ) const
const double & nana::color::b ( ) const
color nana::color::blend ( const color blending_color,
double  fade_rate 
) const

Blends color.

Returns a color which is blended as this * (1 - fade_rate) + blending_color * fade_rate

Parameters
blending_colorColor to blend
fade_rateBlending rate for blending_color
Returns
a blended color
Examples:
a_group_impl.cpp.
color & nana::color::from_hsl ( double  hue,
double  saturation,
double  lightness 
)

immutable alpha channel

Sets color with a HSL value.

Parameters
huein range of [0, 360]
saturationin range of [0, 1]
lightnessin range of [0, 1]
color & nana::color::from_rgb ( unsigned  red,
unsigned  green,
unsigned  blue 
)

immutable alpha channel

const double & nana::color::g ( ) const
bool nana::color::invisible ( ) const

Determines whether the color is completely transparent.

bool nana::color::operator!= ( const color other) const
bool nana::color::operator== ( const color other) const
pixel_color_t nana::color::px_color ( ) const
const double & nana::color::r ( ) const
pixel_rgba_t nana::color::rgba ( ) const

Friends And Related Function Documentation

color operator+ ( const color x,
const color y 
)
friend