Core 1.0
|
Color with alpha channel in RGB space. More...
#include <color.h>
Public Member Functions | |
Color (const double &=0.0) | |
Creates a greyscale color. More... | |
Color (unsigned long) | |
Creates a color given a compact color representation. More... | |
Color (const double &, const double &, const double &, const double &=1.0) | |
Creates a color given each of these components. More... | |
Color (int, int, int, int=255) | |
Create a color given integer components. More... | |
Color (const QColor &) | |
Create a color from Qt representation. More... | |
Color (const QRgb &) | |
Create a color from Qt representation. More... | |
~Color () | |
Empty. | |
Color | Pow (const double &=2.2) |
Apply gamma correction. More... | |
Color & | operator+= (const Color &) |
Overloaded operator. | |
Color | Scale (const Color &) const |
Scale. More... | |
Color & | operator*= (const double &) |
Destructive scalar multiply. | |
Color | Clamp (const Color &=Color::Black, const Color &=Color::White) const |
Clamp a color between two bounds. More... | |
double | Luminance () const |
Compute the luminance. | |
unsigned long | Cast () const |
Returns a compact color format of the RGB-alpha system value of the color. | |
constexpr double & | operator[] (int) |
Returns the ith channel of the spectrum. More... | |
constexpr double | operator[] (int) const |
Returns a copy of the ith channel of the spectrum. More... | |
QColor | GetQt () const |
Create a Qt color from a color. More... | |
Static Public Member Functions | |
static Color | Min (const Color &, const Color &) |
Returns the minimum value of each component. More... | |
static Color | Max (const Color &, const Color &) |
Returns the maximum value of each component. More... | |
static Color | Lerp (const double &, const Color &, const Color &) |
Linear interpolation between two colors. More... | |
static Color | Get (const QVector< Color > &, const double &t) |
Compute a color in a discretized array of colors. More... | |
static QColor | LerpQt (const QColor &, const QColor &, const double &, int) |
Interpolate two Qt colors in the prescribed space. More... | |
static Color | BiCubic (const double &, const double &, const Color &, const Color &, const Color &, const Color &, const Color &, const Color &, const Color &, const Color &, const Color &, const Color &, const Color &, const Color &, const Color &=Color::Black, const Color &=Color::Black, const Color &=Color::Black, const Color &=Color::Black) |
Bi-cubic interpolation between four values, given partial derivatives. More... | |
static Color | Bilinear (const Color &, const Color &, const Color &, const Color &, const double &, const double &) |
Bi-linear interpolation between four colors. More... | |
static const Color | Grey (const double &) |
Grey. More... | |
Static Public Attributes | |
static const Color | Black |
Black. | |
static const Color | White |
White. | |
static const Color | Red |
Red. | |
static const Color | Blue |
Blue. | |
static const Color | Transparent |
Transparent. | |
Protected Attributes | |
double | c [4] |
Array of color components; includes an alpha channel. | |
Friends | |
Color | operator+ (const Color &, const Color &) |
Overloaded sum operator. | |
Color | operator- (const Color &, const Color &) |
Overloaded difference operator. | |
Color | operator* (const Color &, const double &) |
Overloaded product by a scalar operator. | |
Color | operator* (const double &, const Color &) |
Overloaded product by a scalar operator. More... | |
Color | operator/ (const Color &, const double &) |
Overloaded division by a scalar operator. More... | |
std::ostream & | operator<< (std::ostream &, const Color &) |
Overloaded output-stream operator. More... | |
Color with alpha channel in RGB space.
Colors are represented using double.
Several constructors exist, two of them may be confusing:
|
inlineexplicit |
Creates a greyscale color.
Initializes all the components to the given value except the opacity coefficient wich is set to 1.0.
v | Grey value. |
|
inlineexplicit |
Creates a color given a compact color representation.
x | Color compacted into an unsigned long. |
|
inlineexplicit |
Creates a color given each of these components.
r,g,b | Red, green and blue components. |
a | Alpha channel, set to 1.0 (opaque) as default. |
|
inlineexplicit |
Create a color given integer components.
r,g,b | Red, green and blue components. |
a | Alpha channel, set to 255 (opaque) as default. |
|
explicit |
Create a color from Qt representation.
c | Color in Qt. |
|
explicit |
Create a color from Qt representation.
c | Color in Qt. |
|
static |
Bi-cubic interpolation between four values, given partial derivatives.
The values are given in trigonometric order.
u,v | Interpolation coefficients. |
a00,a10,a11,a01 | Interpolated values. |
u00,u10,u11,u01,v00,v10,v11,v01 | Partial derivatives with respect to u and v. |
x00,x10,x11,x01 | Cross derivatives. |
|
static |
Bi-linear interpolation between four colors.
a00,a10,a11,a01 | Interpolated colors. |
u,v | Interpolation coefficients. |
|
inline |
Clamp a color between two bounds.
a,b | Color bounds. |
Compute a color in a discretized array of colors.
c | Array of colors. |
t | Interpolation factor. |
|
inline |
|
inlinestatic |
Linear interpolation between two colors.
Interpolation is performed in RGB space.
Note that the following lines are equivalent:
|
static |
Interpolate two Qt colors in the prescribed space.
The color space can be QColor::Rgb, QColor::Hsv, QColor::Cmyk or QColor::Hsl.
a,b | Colors. |
t | Interpolation parameter. |
s | Color space. |
Returns the maximum value of each component.
a,b | Argument colors. |
Returns the minimum value of each component.
a,b | Argument colors. |
|
inlineconstexpr |
Returns the ith channel of the spectrum.
i | nummber of the channel queried (default=last) |
|
inlineconstexpr |
Returns a copy of the ith channel of the spectrum.
i | nummber of the channel queried (default=last) |
Color Color::Pow | ( | const double & | gamma = 2.2 | ) |
Apply gamma correction.
gamma | Exponential coefficient. |
Overloaded product by a scalar operator.
c | Color. |
a | Scalar. |
Overloaded division by a scalar operator.
c | Color. |
a | Scalar. |