![]() |
NDEVR
API Documentation
|
Represents a color in the RGB space with optional alpha transparency. More...
Public Member Functions | |
| constexpr | RGBColor () |
| Default constructor. | |
| RGBColor (const ACIColor &) | |
| Constructs an RGBColor by converting from an ACIColor. | |
| RGBColor (const fltp04 r, const fltp04 g, const fltp04 b, const fltp04 a=1.0f) | |
| Constructor to initialize color using floating-point values for each channel. | |
| RGBColor (const fltp08 r, const fltp08 g, const fltp08 b, const fltp08 a=1.0f) | |
| Constructs an RGBColor from double-precision floating-point channel values. | |
| RGBColor (const HSBColor &) | |
| Constructs an RGBColor by converting from an HSBColor. | |
| RGBColor (const HSLColor &) | |
| Constructs an RGBColor by converting from an HSLColor. | |
| RGBColor (const LABColor &) | |
| Constructs an RGBColor by converting from a LABColor. | |
| constexpr | RGBColor (const RGBColor &color) |
| Copy constructor. | |
| constexpr | RGBColor (const sint04 r, const sint04 g, const sint04 b, const sint04 a=255) |
| Constructs an RGBColor from signed integer channel values, clamping each to [0, 255]. | |
| constexpr | RGBColor (const uint01 r, const uint01 g, const uint01 b, const uint01 a=255) |
| Constructor to initialize color using integer values for each channel. | |
| RGBColor (const Vector< 1, fltp04 > &color) | |
| Constructs an RGBColor from a 1-dimensional single-precision float vector (grayscale). | |
| RGBColor (const Vector< 1, fltp08 > &color) | |
| Constructs an RGBColor from a 1-dimensional double-precision float vector (grayscale). | |
| template<class t_type> | |
| RGBColor (const Vector< 1, t_type > &color) | |
| Constructs an RGBColor from a 1-dimensional vector, using the value as a grayscale intensity. | |
| RGBColor (const Vector< 2, fltp04 > &color) | |
| Constructs an RGBColor from a 2-dimensional single-precision float vector (grayscale + alpha). | |
| RGBColor (const Vector< 2, fltp08 > &color) | |
| Constructs an RGBColor from a 2-dimensional double-precision float vector (grayscale + alpha). | |
| template<class t_type> | |
| RGBColor (const Vector< 2, t_type > &color) | |
| Constructs an RGBColor from a 2-dimensional vector (grayscale + alpha). | |
| RGBColor (const Vector< 3, fltp04 > &color) | |
| Constructs an RGBColor from a 3-dimensional single-precision float vector (RGB in [0,1]). | |
| RGBColor (const Vector< 3, fltp08 > &color) | |
| Constructs an RGBColor from a 3-dimensional double-precision float vector (RGB in [0,1]). | |
| template<class t_type> | |
| RGBColor (const Vector< 3, t_type > &color) | |
| Constructs an RGBColor from a 3-dimensional vector (RGB). | |
| RGBColor (const Vector< 4, fltp04 > &color) | |
| Constructs an RGBColor from a 4-dimensional single-precision float vector (RGBA in [0,1]). | |
| RGBColor (const Vector< 4, fltp08 > &color) | |
| Constructs an RGBColor from a 4-dimensional double-precision float vector (RGBA in [0,1]). | |
| template<class t_type> | |
| RGBColor (const Vector< 4, t_type > &color) | |
| Constructs an RGBColor from a 4-dimensional vector (RGBA). | |
| RGBColor (const XYZColor &) | |
| Constructs an RGBColor by converting from an XYZColor. | |
| RGBColor (uint04 value) | |
| Constructs an RGBColor from a packed 32-bit unsigned integer. | |
| RGBColor | contrastingColor () const |
| Returns a color that contrasts well with this color for readability. | |
| uint04 | convertTo24BitColor () const |
| Packs this color into a 24-bit unsigned integer (RGB only, no alpha). | |
| uint04 | convertToABGR32BitColor () const |
| Packs this color into a 32-bit unsigned integer in ABGR byte order. | |
| uint04 | convertToRGBA32BitColor () const |
| Packs this color into a 32-bit unsigned integer in RGBA byte order. | |
| Vector< 3, fltp04 > | get3F () const |
| Gets the RGB channels as a 3-dimensional float vector normalized to [0, 1]. | |
| Vector< 4, fltp04 > | get4F () const |
| Gets all RGBA channels as a 4-dimensional float vector normalized to [0, 1]. | |
| fltp04 | getF (uint01 channel) const |
| Gets a channel value as a normalized float in [0, 1]. | |
| String | getHexARGB () const |
| Gets the hex string representation of this color in ARGB format (e.g., "#FFFF0000"). | |
| String | getHexRGB () const |
| Gets the hex string representation of this color in RGB format (e.g., "#FF0000"). | |
| String | getHexRGBA () const |
| Gets the hex string representation of this color in RGBA format (e.g., "#FF0000FF"). | |
| TranslatedString | getName () const |
| Gets the closest known name for this color as a translated string. | |
| bool | isLight () const |
| Determines whether this color is perceptually light. | |
| fltp04 | luminance () const |
| Returns the luminance of the color. | |
| RGBColor | opaque () const |
| Returns a copy of this color with alpha set to 255 (fully opaque). | |
| size_t | operator() () const |
| Functor operator that returns the packed 32-bit RGBA representation, useful as a hash. | |
| constexpr RGBColor & | operator= (const RGBColor &color) |
| Copy assignment operator. | |
| void | setF (uint01 channel, fltp04 value) |
| Sets a channel value from a normalized float in [0, 1]. | |
| Public Member Functions inherited from Vector< 4, uint01 > | |
| constexpr decltype(auto) | as () const |
| Returns the vector as a new time of vector. | |
| constexpr uint01 | dimensionalIndex () const |
| Used with template arguments MAX or MIN, Gets the dimensional index for the value that is either max or min. | |
| constexpr uint01 | dimensionalValue () const |
| Used with template arguments MAX or MIN, Gets the dimensional value for the value that is either max or min. | |
| constexpr t_magnitude_type | magnitude () const |
| Vectors are commonly used to model forces such as wind, sea current, gravity, and electromagnetism. | |
| constexpr uint01 | magnitudeSquared () const |
| Vectors are commonly used to model forces such as wind, sea current, gravity, and electromagnetism. | |
| constexpr Vector< t_dims, t_norm_type > | normalized (Vector< t_dims, t_norm_type > value_if_nan=Constant< Vector< t_dims, t_norm_type > >::Invalid) const |
| Gets the normalized, or unit length representation of this vector. | |
| constexpr | operator uint01 & () |
| For Single dimensional objects, they may also be considered a scaler, thus allow implicit conversion from a vector to a scaler when the dimension of the vector is 1. | |
| constexpr Vector< t_dims, uint01 > | operator- () const |
| Negation operator. | |
| constexpr Vector< t_dims, uint01 > & | operator= (const uint01 &scaler) |
| Assignment operator. | |
| constexpr uint01 & | operator[] (uint01 dimension_index) |
| Accesses the value of a certain dimension. | |
| constexpr uint01 | product () const |
| Returns the product, or value of each dimension multiplied together. | |
| constexpr uint01 | sum () const |
| Returns the sum, or value of each dimension added together. | |
Static Public Member Functions | |
| static RGBColor | Average (const RGBColor &a, const RGBColor &b, const RGBColor &c) |
| Computes the average of three colors in RGB space. | |
| static RGBColor | Average (const RGBColor &a, const RGBColor &b, fltp04 percent=0.5f) |
| Computes a weighted average of two colors in RGB space. | |
| static RGBColor | AverageLAB (const RGBColor &a, const RGBColor &b, fltp04 percent=0.5f) |
| Computes a weighted average of two colors in perceptually uniform LAB space. | |
| static RGBColor | create24BitColor (uint04 color_24) |
| Creates an RGBColor from a packed 24-bit RGB color value. | |
| static RGBColor | CreateARGB32BitColor (uint04 color_32) |
| Creates an RGBColor from a packed 32-bit ARGB color value. | |
| static RGBColor | CreateRGBA32BitColor (uint04 color_32) |
| Creates an RGBColor from a packed 32-bit RGBA color value. | |
| static RGBColor | FromHexARGB (StringView hex) |
| Creates an RGBColor from a hex string in ARGB format. | |
| Static Public Member Functions inherited from Vector< 4, uint01 > | |
| static constexpr uint01 | NumberOfDimensions () |
| Number of dimensions in this vector class. | |
| static constexpr uint01 | Type () |
| Returns the type of this class. | |
Static Public Attributes | |
| static const uint01 | a_pos = 3 |
| The index of the alpha channel in the RGBA color struct. | |
| static const uint01 | b_pos = 2 |
| The index of the blue channel in the RGBA color struct. | |
| static const uint01 | g_pos = 1 |
| The index of the green channel in the RGBA color struct. | |
| static const uint01 | r_pos = 0 |
| The index of the red channel in the RGBA color struct. | |
Additional Inherited Members | |
| Protected Attributes inherited from Vector< 4, uint01 > | |
| uint01 | m_values [t_dims] |
| The values[t dims]. | |
Represents a color in the RGB space with optional alpha transparency.
Extends the Vector class to include specific methods for RGB manipulation, providing flexibility for use in graphics and image processing applications.
Definition at line 56 of file RGBColor.h.
|
inlineconstexpr |
Default constructor.
Initializes all channels to 0 (transparent black).
Definition at line 68 of file RGBColor.h.
Referenced by RGBColor(), Average(), Average(), AverageLAB(), contrastingColor(), create24BitColor(), CreateARGB32BitColor(), CreateRGBA32BitColor(), FromHexARGB(), opaque(), and operator=().
|
inlineexplicit |
Constructs an RGBColor from a packed 32-bit unsigned integer.
| [in] | value | Packed 32-bit RGBA color value. |
Definition at line 75 of file RGBColor.h.
|
inlineconstexpr |
Constructs an RGBColor from signed integer channel values, clamping each to [0, 255].
| [in] | r | Red channel value. |
| [in] | g | Green channel value. |
| [in] | b | Blue channel value. |
| [in] | a | Alpha channel value (default is 255, fully opaque). |
Definition at line 85 of file RGBColor.h.
|
inlineconstexpr |
Constructor to initialize color using integer values for each channel.
| r | Red channel value (0-255). |
| g | Green channel value (0-255). |
| b | Blue channel value (0-255). |
| a | Alpha channel value (0-255, default is 255). |
Definition at line 99 of file RGBColor.h.
Constructor to initialize color using floating-point values for each channel.
| r | Red channel value (0.0f-1.0f). |
| g | Green channel value (0.0f-1.0f). |
| b | Blue channel value (0.0f-1.0f). |
| a | Alpha channel value (0.0f-1.0f, default is 1.0f). |
Constructs an RGBColor from double-precision floating-point channel values.
| [in] | r | Red channel value (0.0-1.0). |
| [in] | g | Green channel value (0.0-1.0). |
| [in] | b | Blue channel value (0.0-1.0). |
| [in] | a | Alpha channel value (0.0-1.0, default is 1.0). |
|
inlineconstexpr |
Copy constructor.
| [in] | color | The RGBColor to copy. |
Definition at line 122 of file RGBColor.h.
References RGBColor().
|
inline |
Constructs an RGBColor from a 1-dimensional vector, using the value as a grayscale intensity.
| [in] | color | Single-channel vector used for R, G, and B. Alpha defaults to 255. |
Definition at line 131 of file RGBColor.h.
|
inline |
Constructs an RGBColor from a 2-dimensional vector (grayscale + alpha).
| [in] | color | Two-channel vector where [0] is used as grayscale for R, G, B and [1] is alpha. |
Definition at line 139 of file RGBColor.h.
References cast().
|
inline |
Constructs an RGBColor from a 3-dimensional vector (RGB).
Alpha defaults to 255.
| [in] | color | Three-channel vector providing R, G, and B values. |
Definition at line 147 of file RGBColor.h.
References Vector< 4, uint01 >::as().
|
inline |
Constructs an RGBColor from a 4-dimensional vector (RGBA).
| [in] | color | Four-channel vector providing R, G, B, and A values. |
Definition at line 155 of file RGBColor.h.
References Vector< 4, uint01 >::as().
|
explicit |
Constructs an RGBColor from a 4-dimensional single-precision float vector (RGBA in [0,1]).
| [in] | color | Four-channel float vector providing R, G, B, and A values. |
|
explicit |
Constructs an RGBColor from a 4-dimensional double-precision float vector (RGBA in [0,1]).
| [in] | color | Four-channel double vector providing R, G, B, and A values. |
|
explicit |
Constructs an RGBColor from a 3-dimensional single-precision float vector (RGB in [0,1]).
| [in] | color | Three-channel float vector providing R, G, and B values. |
|
explicit |
Constructs an RGBColor from a 3-dimensional double-precision float vector (RGB in [0,1]).
| [in] | color | Three-channel double vector providing R, G, and B values. |
|
explicit |
Constructs an RGBColor from a 2-dimensional single-precision float vector (grayscale + alpha).
| [in] | color | Two-channel float vector where [0] is grayscale and [1] is alpha. |
|
explicit |
Constructs an RGBColor from a 2-dimensional double-precision float vector (grayscale + alpha).
| [in] | color | Two-channel double vector where [0] is grayscale and [1] is alpha. |
|
explicit |
Constructs an RGBColor from a 1-dimensional single-precision float vector (grayscale).
| [in] | color | Single-channel float vector used as grayscale intensity. |
|
explicit |
Constructs an RGBColor from a 1-dimensional double-precision float vector (grayscale).
| [in] | color | Single-channel double vector used as grayscale intensity. |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
Computes the average of three colors in RGB space.
| [in] | a | The first color. |
| [in] | b | The second color. |
| [in] | c | The third color. |
References RGBColor().
Computes a weighted average of two colors in RGB space.
| [in] | a | The first color. |
| [in] | b | The second color. |
| [in] | percent | The blend factor where 0.0 returns a and 1.0 returns b (default is 0.5). |
References RGBColor().
|
static |
Computes a weighted average of two colors in perceptually uniform LAB space.
| [in] | a | The first color. |
| [in] | b | The second color. |
| [in] | percent | The blend factor where 0.0 returns a and 1.0 returns b (default is 0.5). |
References RGBColor().
| RGBColor RGBColor::contrastingColor | ( | ) | const |
Returns a color that contrasts well with this color for readability.
References RGBColor().
| uint04 RGBColor::convertTo24BitColor | ( | ) | const |
Packs this color into a 24-bit unsigned integer (RGB only, no alpha).
| uint04 RGBColor::convertToABGR32BitColor | ( | ) | const |
Packs this color into a 32-bit unsigned integer in ABGR byte order.
| uint04 RGBColor::convertToRGBA32BitColor | ( | ) | const |
Packs this color into a 32-bit unsigned integer in RGBA byte order.
Referenced by operator()().
Creates an RGBColor from a packed 24-bit RGB color value.
Alpha defaults to 255.
| [in] | color_24 | The packed 24-bit color in RGB byte order. |
References RGBColor().
Creates an RGBColor from a packed 32-bit ARGB color value.
| [in] | color_32 | The packed 32-bit color in ARGB byte order. |
References RGBColor().
Creates an RGBColor from a packed 32-bit RGBA color value.
| [in] | color_32 | The packed 32-bit color in RGBA byte order. |
References RGBColor().
|
static |
Creates an RGBColor from a hex string in ARGB format.
| [in] | hex | The hex string to parse (e.g., "#FFFF0000" or "FFFF0000"). |
References RGBColor().
| Vector< 3, fltp04 > RGBColor::get3F | ( | ) | const |
Gets the RGB channels as a 3-dimensional float vector normalized to [0, 1].
| Vector< 4, fltp04 > RGBColor::get4F | ( | ) | const |
Gets all RGBA channels as a 4-dimensional float vector normalized to [0, 1].
Gets a channel value as a normalized float in [0, 1].
| [in] | channel | The channel index (r_pos, g_pos, b_pos, or a_pos). |
Definition at line 240 of file RGBColor.h.
References inverse_255, and Vector< 4, uint01 >::m_values.
| String RGBColor::getHexARGB | ( | ) | const |
Gets the hex string representation of this color in ARGB format (e.g., "#FFFF0000").
| String RGBColor::getHexRGB | ( | ) | const |
Gets the hex string representation of this color in RGB format (e.g., "#FF0000").
| String RGBColor::getHexRGBA | ( | ) | const |
Gets the hex string representation of this color in RGBA format (e.g., "#FF0000FF").
| TranslatedString RGBColor::getName | ( | ) | const |
Gets the closest known name for this color as a translated string.
| bool RGBColor::isLight | ( | ) | const |
Determines whether this color is perceptually light.
| fltp04 RGBColor::luminance | ( | ) | const |
Returns the luminance of the color.
|
inline |
Returns a copy of this color with alpha set to 255 (fully opaque).
Definition at line 230 of file RGBColor.h.
References RGBColor(), b_pos, g_pos, Vector< 4, uint01 >::m_values, and r_pos.
|
inline |
Functor operator that returns the packed 32-bit RGBA representation, useful as a hash.
Definition at line 322 of file RGBColor.h.
References convertToRGBA32BitColor().
Copy assignment operator.
| [in] | color | The RGBColor to assign from. |
Definition at line 331 of file RGBColor.h.
References RGBColor(), Vector< t_dims, t_type >::m_values, and Vector< 4, uint01 >::m_values.
Sets a channel value from a normalized float in [0, 1].
| [in] | channel | The channel index (r_pos, g_pos, b_pos, or a_pos). |
| [in] | value | The normalized float value to set. |
Definition at line 249 of file RGBColor.h.
References cast(), and Vector< 4, uint01 >::m_values.