lxgui
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lxgui::gui::color Class Reference

Holds a single color (float RGBA, 128 bits) More...

#include <gui_color.hpp>

Classes

struct  hls
 
struct  hsv
 

Public Types

using channel = float
 

Public Member Functions

constexpr color ()=default
 
constexpr color (channel nr, channel ng, channel nb, channel na=1.0f) noexcept
 
 color (const std::string &s)
 
hls to_hls () const noexcept
 
hsv to_hsv () const noexcept
 
bool operator== (const color &c) const noexcept
 
bool operator!= (const color &c) const noexcept
 
void operator+= (const color &c) noexcept
 
void operator-= (const color &c) noexcept
 
void operator*= (const color &c) noexcept
 
void operator*= (float f) noexcept
 

Static Public Member Functions

static constexpr color from_bytes (std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a=255u) noexcept
 
static color from_hls (const hls &hls) noexcept
 
static color from_hsv (const hsv &hsv) noexcept
 

Public Attributes

channel r = 1.0f
 
channel g = 1.0f
 
channel b = 1.0f
 
channel a = 1.0f
 

Static Public Attributes

static const color empty
 
static const color white
 
static const color black
 
static const color red
 
static const color green
 
static const color blue
 
static const color grey
 

Detailed Description

Holds a single color (float RGBA, 128 bits)

Definition at line 12 of file gui_color.hpp.

Member Typedef Documentation

◆ channel

Definition at line 14 of file gui_color.hpp.

Constructor & Destructor Documentation

◆ color() [1/3]

constexpr lxgui::gui::color::color ( )
constexprdefault

◆ color() [2/3]

constexpr lxgui::gui::color::color ( channel  nr,
channel  ng,
channel  nb,
channel  na = 1.0f 
)
inlineconstexprnoexcept

Definition at line 25 of file gui_color.hpp.

◆ color() [3/3]

lxgui::gui::color::color ( const std::string &  s)
explicit

Definition at line 21 of file gui_color.cpp.

Member Function Documentation

◆ from_bytes()

static constexpr color lxgui::gui::color::from_bytes ( std::uint8_t  r,
std::uint8_t  g,
std::uint8_t  b,
std::uint8_t  a = 255u 
)
inlinestaticconstexprnoexcept

Definition at line 51 of file gui_color.hpp.

◆ from_hls()

color lxgui::gui::color::from_hls ( const hls hls)
staticnoexcept

Definition at line 108 of file gui_color.cpp.

◆ from_hsv()

color lxgui::gui::color::from_hsv ( const hsv hsv)
staticnoexcept

Definition at line 133 of file gui_color.cpp.

◆ operator!=()

bool lxgui::gui::color::operator!= ( const color c) const
noexcept

Definition at line 160 of file gui_color.cpp.

◆ operator*=() [1/2]

void lxgui::gui::color::operator*= ( const color c)
noexcept

Definition at line 178 of file gui_color.cpp.

◆ operator*=() [2/2]

void lxgui::gui::color::operator*= ( float  f)
noexcept

Definition at line 185 of file gui_color.cpp.

◆ operator+=()

void lxgui::gui::color::operator+= ( const color c)
noexcept

Definition at line 164 of file gui_color.cpp.

◆ operator-=()

void lxgui::gui::color::operator-= ( const color c)
noexcept

Definition at line 171 of file gui_color.cpp.

◆ operator==()

bool lxgui::gui::color::operator== ( const color c) const
noexcept

Definition at line 156 of file gui_color.cpp.

◆ to_hls()

color::hls lxgui::gui::color::to_hls ( ) const
noexcept

Definition at line 26 of file gui_color.cpp.

◆ to_hsv()

color::hsv lxgui::gui::color::to_hsv ( ) const
noexcept

Definition at line 62 of file gui_color.cpp.

Member Data Documentation

◆ a

channel lxgui::gui::color::a = 1.0f

Definition at line 40 of file gui_color.hpp.

◆ b

channel lxgui::gui::color::b = 1.0f

Definition at line 40 of file gui_color.hpp.

◆ black

const color lxgui::gui::color::black
static

Definition at line 44 of file gui_color.hpp.

◆ blue

const color lxgui::gui::color::blue
static

Definition at line 47 of file gui_color.hpp.

◆ empty

const color lxgui::gui::color::empty
static

Definition at line 42 of file gui_color.hpp.

◆ g

channel lxgui::gui::color::g = 1.0f

Definition at line 40 of file gui_color.hpp.

◆ green

const color lxgui::gui::color::green
static

Definition at line 46 of file gui_color.hpp.

◆ grey

const color lxgui::gui::color::grey
static

Definition at line 48 of file gui_color.hpp.

◆ r

channel lxgui::gui::color::r = 1.0f

Definition at line 40 of file gui_color.hpp.

◆ red

const color lxgui::gui::color::red
static

Definition at line 45 of file gui_color.hpp.

◆ white

const color lxgui::gui::color::white
static

Definition at line 43 of file gui_color.hpp.


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