Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
iv::color::utils Namespace Reference

Functions

std::string colorToHex (iv::types::color value, const bool hasAlpha)
 
std::optional< iv::types::colorhexToColor (const std::string_view hex)
 
double getAlpha (const iv::types::color hexValue)
 
iv::types::color removeAlpha (const iv::types::color hexValue)
 
iv::types::color colorBorder (const iv::types::color colorState)
 Provides a border color.
 
static void prvGetRGB (const uint32_t rgb, double *r, double *g, double *b)
 Private function that gets the RGB's values by parameters.
 
void prvDarkenColor (const double r, const double g, const double b, const double factorDarken, double *rDarken, double *gDarken, double *bDarken)
 Private function that darken the RGB colors.
 
uint32_t darkenColorRgb (const uint32_t rgb, const double factorDarken)
 Get a darker version of the given RGB.
 
iv::types::color darkenColorArgb (const iv::types::color argb, const double factorDarken)
 
void prvIlluminateColor (const double r, const double g, const double b, const double factorIlluminate, double *rIlluminate, double *gIlluminate, double *bIlluminate)
 Private Function that illuminate the RGB color given.
 
iv::types::color illuminateColorRgb (const iv::types::color rgb, const double factorIlluminate)
 Get a brighter version of the given RGB.
 
bool isDarkColorRgb (const uint32_t rgb)
 Check if the provided RGB is dark.
 
bool isIlluminateColorRgb (const uint32_t rgb)
 Check if the provided RGB is illuminated.
 
template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
iv::types::color compactRgb (T r, T g, T b, T a)
 Returns an ARGB value according to the values given as unsigned char.
 
template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
iv::types::color compactRgb (T r, T g, T b)
 Returns an ARGB value according to the values given as unsigned char.
 
template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
void hexToBgr (iv::types::color hexValue, T *b_out, T *g_out, T *r_out, std::optional< T > alpha_out=std::nullopt)
 
template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
void hexToRgb (iv::types::color hexValue, T *r_out, T *g_out, T *b_out, std::optional< std::reference_wrapper< T > > alpha_out=std::nullopt)
 
template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
void rgbToHex (T r, T g, T b, T alpha, iv::types::color *hexValue_out)
 
template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
iv::types::color addAlpha (iv::types::color hexValue, T alpha)
 
template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
iv::types::color changeAlpha (iv::types::color hexValue, T alpha)
 
void getRgb2Char (iv::types::color color, unsigned char *r, unsigned char *g, unsigned char *b)
 Get unsigned char values from a 2 Bytes color.
 

Function Documentation

◆ addAlpha()

template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
iv::types::color iv::color::utils::addAlpha ( iv::types::color hexValue,
T alpha )

◆ changeAlpha()

template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
iv::types::color iv::color::utils::changeAlpha ( iv::types::color hexValue,
T alpha )

◆ colorBorder()

iv::types::color iv::color::utils::colorBorder ( const iv::types::color colorState)

Provides a border color.

Parameters
colorStateThe color state
Returns
uint32_t The color that fits best according to the given color

◆ colorToHex()

std::string iv::color::utils::colorToHex ( iv::types::color value,
const bool hasAlpha )

◆ compactRgb() [1/2]

template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
iv::types::color iv::color::utils::compactRgb ( T r,
T g,
T b )

Returns an ARGB value according to the values given as unsigned char.

Parameters
rThe red value
gThe green value
bThe blue value
Returns
color The resultant ARGB value

◆ compactRgb() [2/2]

template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
iv::types::color iv::color::utils::compactRgb ( T r,
T g,
T b,
T a )

Returns an ARGB value according to the values given as unsigned char.

Parameters
rThe red value
gThe green value
bThe blue value
aThe alpha value
Returns
color The resultant ARGB value

◆ darkenColorArgb()

iv::types::color iv::color::utils::darkenColorArgb ( const iv::types::color argb,
const double factorDarken )

◆ darkenColorRgb()

uint32_t iv::color::utils::darkenColorRgb ( const uint32_t rgb,
const double factorDarken )

Get a darker version of the given RGB.

Parameters
rgbThe initial RGB to modify
factorDarkenThe dark factor
Returns
uint32_t The resultant darken RGB value

◆ getAlpha()

double iv::color::utils::getAlpha ( const iv::types::color hexValue)

◆ getRgb2Char()

void iv::color::utils::getRgb2Char ( iv::types::color color,
unsigned char * r,
unsigned char * g,
unsigned char * b )

Get unsigned char values from a 2 Bytes color.

Parameters
colorThe given 2 Bytes color
rThe variable where save the Red value
gThe variable where save the Green value
bThe variable where save the Blue value

◆ hexToBgr()

template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
void iv::color::utils::hexToBgr ( iv::types::color hexValue,
T * b_out,
T * g_out,
T * r_out,
std::optional< T > alpha_out = std::nullopt )

◆ hexToColor()

std::optional< iv::types::color > iv::color::utils::hexToColor ( const std::string_view hex)

◆ hexToRgb()

template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
void iv::color::utils::hexToRgb ( iv::types::color hexValue,
T * r_out,
T * g_out,
T * b_out,
std::optional< std::reference_wrapper< T > > alpha_out = std::nullopt )

◆ illuminateColorRgb()

iv::types::color iv::color::utils::illuminateColorRgb ( const iv::types::color rgb,
const double factorIlluminate )

Get a brighter version of the given RGB.

Parameters
rgbThe initial RGB to modify
factorIlluminateThe illuminate factor
Returns
uint32_t The resultant brighter RGB value

◆ isDarkColorRgb()

bool iv::color::utils::isDarkColorRgb ( const uint32_t rgb)

Check if the provided RGB is dark.

Parameters
rgbThe provided RGB color
Returns
true if the color is under the threshold

◆ isIlluminateColorRgb()

bool iv::color::utils::isIlluminateColorRgb ( const uint32_t rgb)

Check if the provided RGB is illuminated.

Parameters
rgbThe provided RGB color
Returns
true if the color is over the threshold

◆ prvDarkenColor()

void iv::color::utils::prvDarkenColor ( const double r,
const double g,
const double b,
const double factorDarken,
double * rDarken,
double * gDarken,
double * bDarken )

Private function that darken the RGB colors.

Parameters
rThe initial Red value
gThe initial Green value
bThe initial Blue value
factorDarkenThe Darken factor (between 0 and 1)
rDarkenThe resultant Red value
gDarkenThe resultant Green value
bDarkenThe resultant Blue value

◆ prvGetRGB()

static void iv::color::utils::prvGetRGB ( const uint32_t rgb,
double * r,
double * g,
double * b )
static

Private function that gets the RGB's values by parameters.

Parameters
rgbThe given RGB value
rThe variable where save the Red value
gThe variable where save the Green value
bThe variable where save the Blue value

◆ prvIlluminateColor()

void iv::color::utils::prvIlluminateColor ( const double r,
const double g,
const double b,
const double factorIlluminate,
double * rIlluminate,
double * gIlluminate,
double * bIlluminate )

Private Function that illuminate the RGB color given.

Parameters
rThe initial Red value
gThe initial Green value
bThe initial Blue value
factorIlluminateThe Illuminate factor
rIlluminateThe resultant Red value
gIlluminateThe resultant Green value
bIlluminateThe resultant Blue value

◆ removeAlpha()

iv::types::color iv::color::utils::removeAlpha ( const iv::types::color hexValue)

◆ rgbToHex()

template<typename T >
requires ((std::is_floating_point_v<T> && std::numeric_limits<T>::is_iec559 && (std::numeric_limits<T>::radix == 2)) || (std::is_unsigned_v<T> && sizeof(T) == 1))
void iv::color::utils::rgbToHex ( T r,
T g,
T b,
T alpha,
iv::types::color * hexValue_out )