|
namespace | ghassanpl::colors |
| Contains the basic colors as variables and functions.
|
|
enum class | ghassanpl::color_space { linear_rgba
, srgb
, hsva
, rgbe
} |
| Implementation note: These functions use the .xyzw members instead of the .rgba members because accessing the latter is not constexpr. More...
|
|
using | ghassanpl::color_rgba_t = glm::vec4 |
| Represents a color in RGBA color space, with 0.0-1.0 float elements.
|
|
using | ghassanpl::color_hsva_t = named< glm::vec4, "color_hsva"> |
| Represents a color in HSVA color space, with H=0.0-6.0, S=0.0-1.0, V=0.0-1.0, A=0.0-1.0 float elements.
|
|
using | ghassanpl::color_t = color_rgba_t |
| Default color_t type is RGBA.
|
|
using | ghassanpl::color_rgba_u32_t = named< uint32_t, "color_rgba_u32"> |
| Represent a packed RGBA color with 8 bits per pixel.
|
|
using | ghassanpl::color_abgr_u32_t = named< uint32_t, "color_abgr_u32"> |
| Represent a packed ABGR color with 8 bits per pixel.
|
|
constexpr color_t | ghassanpl::premultiplied (color_t const &color) |
| Returns the color multiplied by its own alpha.
|
|
constexpr color_t | ghassanpl::saturated (color_t const &color) |
| Returns a color with all elements clamped between 0 and 1.
|
|
constexpr color_t | ghassanpl::lighten (color_t const &color, float coef) |
| Returns a color lightened by a coefficient.
|
|
constexpr color_t | ghassanpl::contrast (color_t const &color, float contrast) |
| Returns a color with its contrast changed.
|
|
constexpr color_t | ghassanpl::contrast2 (color_t const &color, float contrast) |
| Returns a color with its contrast changed This uses a differen algorithm and contrast value than contrast.
|
|
constexpr color_t | ghassanpl::gamma_correct (color_t const &color, const float gamma) |
| Returns a gamma corrected color.
|
|
constexpr color_t | ghassanpl::inverted (color_t const &color) |
| Returns an inverted color, i.e. with (1.0-x) on all of its elements, excluding its alpha.
|
|
constexpr color_t | ghassanpl::contrasting (color_t const &color) |
| Returns a color that's a good contrasting color for the original.
|
|
constexpr float | ghassanpl::luminance (color_t const &color) |
| Get brightness of color.
|
|
constexpr color_t | ghassanpl::desaturated (color_t const &color, float desaturation) |
| Returns a color sapped of desaturation percent (0-1) of its saturation.
|
|
constexpr color_t | ghassanpl::from_u32_rgb (uint32_t rgb) |
| Gets a color from an RGB 8bpp integer, with R being most significant.
|
|
constexpr color_t | ghassanpl::from_u32_bgr (uint32_t rgb) |
| Gets a color from an BGR 8bpp integer, with R being least significant.
|
|
constexpr color_t | ghassanpl::from_u32_rgba (uint32_t rgb) |
| Gets a color from an RGBA 8bpp integer, with R being most significant.
|
|
constexpr color_t | ghassanpl::from_u32_bgra (uint32_t rgb) |
| Gets a color from an BGRA 8bpp integer, with A being least significant, and B being most significant.
|
|
constexpr color_t | ghassanpl::from_u32_argb (uint32_t rgb) |
| Gets a color from an ARGB 8bpp integer, with A being most significant, and B being least significant.
|
|
constexpr color_t | ghassanpl::from_u32_abgr (uint32_t rgb) |
| Gets a color from an ABGR 8bpp integer, with A being most significant, and R being least significant.
|
|
constexpr uint32_t | ghassanpl::to_u32_argb (color_t const &rgba) |
| Creates an 8bpp ARGB integer from a color.
|
|
constexpr uint32_t | ghassanpl::to_u32_abgr (color_t const &rgba) |
| Creates an 8bpp ABGR integer from a color.
|
|
constexpr uint32_t | ghassanpl::to_u32_rgba (color_t const &rgba) |
| Creates an 8bpp RGBA integer from a color.
|
|
constexpr uint32_t | ghassanpl::to_u32_bgra (color_t const &rgba) |
| Creates an 8bpp BGRA integer from a color.
|
|
constexpr uint32_t | ghassanpl::to_u32_rgb (color_t const &rgba) |
| Creates a 32 bitbpp RGB integer from a color, with the most significant 8 bits set to 0.
|
|
constexpr uint32_t | ghassanpl::to_u32_bgr (color_t const &rgba) |
| Creates a 32 bitbpp BGR integer from a color, with the most significant 8 bits set to 0.
|
|
template<std::same_as< color_rgba_u32_t > TO> |
constexpr TO | ghassanpl::named_cast (color_rgba_t const &from) |
|
template<typename TO , typename FROM > |
TO | ghassanpl::color_cast (FROM const &from) |
|
constexpr glm::tvec4< uint8_t > | ghassanpl::to_u8 (color_t const &rgba) |
| Returns the color as a glm::vec4 of uint8_t s.
|
|
constexpr color_t | ghassanpl::to_rgb (color_hsva_t const &hsva) |
| Converts a HSVA color to RGBA space.
|
|
constexpr color_hsva_t | ghassanpl::to_hsv (color_t const &rgba) |
| Converts an RGBA color to HSVA space.
|
|
constexpr color_rgba_t | ghassanpl::from_html (const char *str, size_t n) |
| Converts a HTML color string (like #FBA or fafafa) to an RGBA color.
|
|
consteval color_rgba_t | ghassanpl::operator""_rgb (const char *str, size_t n) |
| Converts a HTML color string (like #FBA or fafafa) to an RGBA color.
|
|
constexpr color_rgba_t | ghassanpl::from_html (std::string_view html) |
| Converts a HTML color string (like #FBA or fafafa) to an RGBA color.
|
|
Colors and things.