This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
ofColor represents a color in openFrameworks. More...
#include <ofColor.h>
Public Member Functions | |
int | getHex () const |
void | setHex (int hexColor, float alpha) |
Setters | |
void | set (float red, float green, float blue, float alpha=limit()) |
Set an ofColor_ by using RGB values. | |
void | set (float gray, float alpha=limit()) |
Set a grayscale ofColor_ by specifying a single number. | |
void | set (const ofColor_< PixelType > &color) |
Set an ofColor_ from an existing ofColor_. | |
void | setHex (int hexColor, float alpha=limit()) |
Set an ofColor_ from a hexadecimal representation. | |
void | setHue (float hue) |
Set the hue of this color. | |
void | setHueAngle (float angle) |
Set the hue angle of this color. | |
void | setSaturation (float saturation) |
Set the saturation of this color. | |
void | setBrightness (float brightness) |
Set the brightness of this color. | |
void | setHsb (float hue, float saturation, float brightness, float alpha=limit()) |
Set the color using HSB components. | |
Modifiers | |
ofColor_< PixelType > & | clamp () |
Clamp values between 0 and the limit(). | |
ofColor_< PixelType > & | invert () |
Invert the R, G and B components. | |
ofColor_< PixelType > & | normalize () |
Normalize the R, G and B components. | |
ofColor_< PixelType > & | lerp (const ofColor_< PixelType > &target, float amount) |
A linear interpolation between all components of two colors. | |
Public Attributes | ||
Data Accessors | ||
union { | ||
struct { | ||
PixelType r | ||
The red color component. More... | ||
PixelType g | ||
The green color component. More... | ||
PixelType b | ||
The blue color component. More... | ||
PixelType a | ||
The alpha color component. More... | ||
} | ||
PixelType v [4] | ||
The pixel values as an array. More... | ||
}; | ||
A union representing the internal data. | ||
Static Public Attributes | |
Predefined Colors | |
A collection of static colors defined by name. These constants allow the user to access colors by name. For example, if using ofColor, one might set a color in the following way: ofColor myColor = ofColor::white;
// myColor is now full white (255,255,255,255).
static const ofColor_< unsigned char > white Definition ofColor.h:594 The list of colors is based upon the CSS names colors and can be viewed here. | |
static const ofColor_< PixelType > | white |
static const ofColor_< PixelType > | gray |
static const ofColor_< PixelType > | black |
static const ofColor_< PixelType > | red |
static const ofColor_< PixelType > | green |
static const ofColor_< PixelType > | blue |
static const ofColor_< PixelType > | cyan |
static const ofColor_< PixelType > | magenta |
static const ofColor_< PixelType > | yellow |
static const ofColor_< PixelType > | aliceBlue |
static const ofColor_< PixelType > | antiqueWhite |
static const ofColor_< PixelType > | aqua |
static const ofColor_< PixelType > | aquamarine |
static const ofColor_< PixelType > | azure |
static const ofColor_< PixelType > | beige |
static const ofColor_< PixelType > | bisque |
static const ofColor_< PixelType > | blanchedAlmond |
static const ofColor_< PixelType > | blueViolet |
static const ofColor_< PixelType > | brown |
static const ofColor_< PixelType > | burlyWood |
static const ofColor_< PixelType > | cadetBlue |
static const ofColor_< PixelType > | chartreuse |
static const ofColor_< PixelType > | chocolate |
static const ofColor_< PixelType > | coral |
static const ofColor_< PixelType > | cornflowerBlue |
static const ofColor_< PixelType > | cornsilk |
static const ofColor_< PixelType > | crimson |
static const ofColor_< PixelType > | darkBlue |
static const ofColor_< PixelType > | darkCyan |
static const ofColor_< PixelType > | darkGoldenRod |
static const ofColor_< PixelType > | darkGray |
static const ofColor_< PixelType > | darkGrey |
static const ofColor_< PixelType > | darkGreen |
static const ofColor_< PixelType > | darkKhaki |
static const ofColor_< PixelType > | darkMagenta |
static const ofColor_< PixelType > | darkOliveGreen |
static const ofColor_< PixelType > | darkOrange |
static const ofColor_< PixelType > | darkOrchid |
static const ofColor_< PixelType > | darkRed |
static const ofColor_< PixelType > | darkSalmon |
static const ofColor_< PixelType > | darkSeaGreen |
static const ofColor_< PixelType > | darkSlateBlue |
static const ofColor_< PixelType > | darkSlateGray |
static const ofColor_< PixelType > | darkSlateGrey |
static const ofColor_< PixelType > | darkTurquoise |
static const ofColor_< PixelType > | darkViolet |
static const ofColor_< PixelType > | deepPink |
static const ofColor_< PixelType > | deepSkyBlue |
static const ofColor_< PixelType > | dimGray |
static const ofColor_< PixelType > | dimGrey |
static const ofColor_< PixelType > | dodgerBlue |
static const ofColor_< PixelType > | fireBrick |
static const ofColor_< PixelType > | floralWhite |
static const ofColor_< PixelType > | forestGreen |
static const ofColor_< PixelType > | fuchsia |
static const ofColor_< PixelType > | gainsboro |
static const ofColor_< PixelType > | ghostWhite |
static const ofColor_< PixelType > | gold |
static const ofColor_< PixelType > | goldenRod |
static const ofColor_< PixelType > | grey |
static const ofColor_< PixelType > | greenYellow |
static const ofColor_< PixelType > | honeyDew |
static const ofColor_< PixelType > | hotPink |
static const ofColor_< PixelType > | indianRed |
static const ofColor_< PixelType > | indigo |
static const ofColor_< PixelType > | ivory |
static const ofColor_< PixelType > | khaki |
static const ofColor_< PixelType > | lavender |
static const ofColor_< PixelType > | lavenderBlush |
static const ofColor_< PixelType > | lawnGreen |
static const ofColor_< PixelType > | lemonChiffon |
static const ofColor_< PixelType > | lightBlue |
static const ofColor_< PixelType > | lightCoral |
static const ofColor_< PixelType > | lightCyan |
static const ofColor_< PixelType > | lightGoldenRodYellow |
static const ofColor_< PixelType > | lightGray |
static const ofColor_< PixelType > | lightGrey |
static const ofColor_< PixelType > | lightGreen |
static const ofColor_< PixelType > | lightPink |
static const ofColor_< PixelType > | lightSalmon |
static const ofColor_< PixelType > | lightSeaGreen |
static const ofColor_< PixelType > | lightSkyBlue |
static const ofColor_< PixelType > | lightSlateGray |
static const ofColor_< PixelType > | lightSlateGrey |
static const ofColor_< PixelType > | lightSteelBlue |
static const ofColor_< PixelType > | lightYellow |
static const ofColor_< PixelType > | lime |
static const ofColor_< PixelType > | limeGreen |
static const ofColor_< PixelType > | linen |
static const ofColor_< PixelType > | maroon |
static const ofColor_< PixelType > | mediumAquaMarine |
static const ofColor_< PixelType > | mediumBlue |
static const ofColor_< PixelType > | mediumOrchid |
static const ofColor_< PixelType > | mediumPurple |
static const ofColor_< PixelType > | mediumSeaGreen |
static const ofColor_< PixelType > | mediumSlateBlue |
static const ofColor_< PixelType > | mediumSpringGreen |
static const ofColor_< PixelType > | mediumTurquoise |
static const ofColor_< PixelType > | mediumVioletRed |
static const ofColor_< PixelType > | midnightBlue |
static const ofColor_< PixelType > | mintCream |
static const ofColor_< PixelType > | mistyRose |
static const ofColor_< PixelType > | moccasin |
static const ofColor_< PixelType > | navajoWhite |
static const ofColor_< PixelType > | navy |
static const ofColor_< PixelType > | oldLace |
static const ofColor_< PixelType > | olive |
static const ofColor_< PixelType > | oliveDrab |
static const ofColor_< PixelType > | orange |
static const ofColor_< PixelType > | orangeRed |
static const ofColor_< PixelType > | orchid |
static const ofColor_< PixelType > | paleGoldenRod |
static const ofColor_< PixelType > | paleGreen |
static const ofColor_< PixelType > | paleTurquoise |
static const ofColor_< PixelType > | paleVioletRed |
static const ofColor_< PixelType > | papayaWhip |
static const ofColor_< PixelType > | peachPuff |
static const ofColor_< PixelType > | peru |
static const ofColor_< PixelType > | pink |
static const ofColor_< PixelType > | plum |
static const ofColor_< PixelType > | powderBlue |
static const ofColor_< PixelType > | purple |
static const ofColor_< PixelType > | rosyBrown |
static const ofColor_< PixelType > | royalBlue |
static const ofColor_< PixelType > | saddleBrown |
static const ofColor_< PixelType > | salmon |
static const ofColor_< PixelType > | sandyBrown |
static const ofColor_< PixelType > | seaGreen |
static const ofColor_< PixelType > | seaShell |
static const ofColor_< PixelType > | sienna |
static const ofColor_< PixelType > | silver |
static const ofColor_< PixelType > | skyBlue |
static const ofColor_< PixelType > | slateBlue |
static const ofColor_< PixelType > | slateGray |
static const ofColor_< PixelType > | slateGrey |
static const ofColor_< PixelType > | snow |
static const ofColor_< PixelType > | springGreen |
static const ofColor_< PixelType > | steelBlue |
static const ofColor_< PixelType > | blueSteel |
static const ofColor_< PixelType > | tan |
static const ofColor_< PixelType > | teal |
static const ofColor_< PixelType > | thistle |
static const ofColor_< PixelType > | tomato |
static const ofColor_< PixelType > | turquoise |
static const ofColor_< PixelType > | violet |
static const ofColor_< PixelType > | wheat |
static const ofColor_< PixelType > | whiteSmoke |
static const ofColor_< PixelType > | yellowGreen |
Create an ofColor | |
ofColor_ () | |
Construct a default white color. | |
ofColor_ (float red, float green, float blue, float alpha=limit()) | |
Construct an ofColor_ by using channel values. | |
ofColor_ (float gray, float alpha=limit()) | |
Construct a grayscale ofColor_ by specifying a single number. | |
template<typename SrcType > | |
ofColor_ (const ofColor_< SrcType > &color) | |
Construct an ofColor_ from an existing ofColor_. | |
ofColor_ (const ofColor_< PixelType > &color, float alpha) | |
Construct an ofColor_ from an existing ofColor_. | |
static ofColor_< PixelType > | fromHsb (float hue, float saturation, float brightness, float alpha=limit()) |
Create an ofColor_ from an HSB representation. | |
static ofColor_< PixelType > | fromHex (int hexColor, float alpha=limit()) |
Create an ofColor_ from a hexadecimal value. | |
Getters | |
ofColor_< PixelType > | getClamped () const |
A non-destructive version of clamp(). | |
ofColor_< PixelType > | getInverted () const |
A non-destructive version of invert(). | |
ofColor_< PixelType > | getNormalized () const |
A non-destructive version of normalize(). | |
ofColor_< PixelType > | getLerped (const ofColor_< PixelType > &target, float amount) const |
A non-destructive version of lerp(). | |
int | getHex () const |
Get a 24-bit hexadecimal representation of the RGB color. | |
float | getHue () const |
Get the Hue of this color. | |
float | getHueAngle () const |
Get the Hue angle of this color. | |
float | getSaturation () const |
Get the Saturation of this color. | |
float | getBrightness () const |
Calculate the brightness of of the R, G and B components. | |
float | getLightness () const |
Calculate the lightness of the R, G and B components. | |
void | getHsb (float &hue, float &saturation, float &brightness) const |
Extract the hue, saturation and brightness (HSB) from this color. | |
static float | limit () |
Get the maximum value of a color component. | |
Operators | |
template<typename SrcType > | |
ofColor_< PixelType > & | operator= (const ofColor_< SrcType > &color) |
Assign a color using an existing color. | |
ofColor_< PixelType > & | operator= (float value) |
Assign a color using a grayscale value. | |
bool | operator== (const ofColor_< PixelType > &color) const |
Test two colors for equality. | |
bool | operator!= (const ofColor_< PixelType > &color) const |
Test two colors for inequality. | |
ofColor_< PixelType > | operator+ (const ofColor_< PixelType > &color) const |
Clamped addition operator. | |
ofColor_< PixelType > | operator+ (float color) const |
Clamped addition operator. | |
ofColor_< PixelType > & | operator+= (const ofColor_< PixelType > &color) |
Clamped addition operator. | |
ofColor_< PixelType > & | operator+= (float color) |
Clamped addition operator. | |
ofColor_< PixelType > | operator- (const ofColor_< PixelType > &color) const |
Clamped subtraction operator. | |
ofColor_< PixelType > | operator- (float value) const |
Clamped subtraction operator. | |
ofColor_< PixelType > & | operator-= (const ofColor_< PixelType > &color) |
Clamped subtraction operator. | |
ofColor_< PixelType > & | operator-= (float color) |
Clamped subtraction operator. | |
ofColor_< PixelType > | operator* (const ofColor_< PixelType > &color) const |
Clamped multiplication operator. | |
ofColor_< PixelType > | operator* (float value) const |
Clamped scalar multiplication operator. | |
ofColor_< PixelType > & | operator*= (const ofColor_< PixelType > &color) |
Clamped multiplication operator. | |
ofColor_< PixelType > & | operator*= (float value) |
Clamped scalar multiplication operator. | |
ofColor_< PixelType > | operator/ (const ofColor_< PixelType > &color) const |
Clamped division operator. | |
ofColor_< PixelType > | operator/ (float value) const |
Clamped scalar division operator. | |
ofColor_< PixelType > & | operator/= (const ofColor_< PixelType > &color) |
Clamped division operator. | |
ofColor_< PixelType > & | operator/= (float value) |
Clamped scalar division operator. | |
const PixelType & | operator[] (std::size_t n) const |
Array subscript operator. | |
PixelType & | operator[] (std::size_t n) |
Array subscript operator. | |
std::ostream & | operator<< (std::ostream &os, const ofColor_< PixelType > &color) |
An output stream operator. | |
std::istream & | operator>> (std::istream &is, ofColor_< PixelType > &color) |
An input stream operator. | |
Detailed Description
class ofColor_< PixelType >
ofColor represents a color in openFrameworks.
The default ofColor uses unsigned char values [0,255], but use ofFloatColor for floating point values [0.0,1.0], or ofShortColor for unsigned short ints [0,[65,535]]. ofColor can be represented by an RGB value, an HSB value or a hex value.
- Template Parameters
-
PixelType The data type used to represent a single pixel value.
Constructor & Destructor Documentation
◆ ofColor_() [1/5]
|
inline |
Construct a default white color.
◆ ofColor_() [2/5]
ofColor_< PixelType >::ofColor_ | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = limit() |
||
) |
Construct an ofColor_ by using channel values.
- Parameters
-
red The red component. green The green component. blue The blue component. alpha The alpha component.
◆ ofColor_() [3/5]
ofColor_< PixelType >::ofColor_ | ( | float | gray, |
float | alpha = limit() |
||
) |
Construct a grayscale ofColor_ by specifying a single number.
- Parameters
-
gray A grayscale value. alpha The opacity of the color.
◆ ofColor_() [4/5]
ofColor_< PixelType >::ofColor_ | ( | const ofColor_< SrcType > & | color | ) |
◆ ofColor_() [5/5]
ofColor_< PixelType >::ofColor_ | ( | const ofColor_< PixelType > & | color, |
float | alpha | ||
) |
Member Function Documentation
◆ clamp()
◆ fromHex()
|
static |
Create an ofColor_ from a hexadecimal value.
- Parameters
-
hexColor A color in hexadecimal form. alpha The alpha value of the color.
◆ fromHsb()
|
static |
Create an ofColor_ from an HSB representation.
- Parameters
-
hue The hue of the color. saturation The saturation of the color. brightness The brightness of the color. alpha The alpha value of the color.
◆ getBrightness()
float ofColor_< PixelType >::getBrightness | ( | ) | const |
Calculate the brightness of of the R, G and B components.
Brightness is simply the maximum of the three color components. This method of calculating brightness is used by Photoshop (HSB) and Processing (HSB). Note that brightness is also called "Value".
- Returns
- the brightness in the range 0 - limit().
◆ getClamped()
◆ getHex() [1/2]
|
inline |
Get a 24-bit hexadecimal representation of the RGB color.
- Warning
- This method does not encode the alpha component.
- Returns
- An integer representing an RGB color.
◆ getHex() [2/2]
|
inline |
◆ getHsb()
void ofColor_< PixelType >::getHsb | ( | float & | hue, |
float & | saturation, | ||
float & | brightness | ||
) | const |
Extract the hue, saturation and brightness (HSB) from this color.
◆ getHue()
float ofColor_< PixelType >::getHue | ( | ) | const |
◆ getHueAngle()
float ofColor_< PixelType >::getHueAngle | ( | ) | const |
Get the Hue angle of this color.
The color is converted from the default RGB to an HSB color space and the resulting Hue angle is returned. The resulting hue value will always be returned in degrees in the range 0 - 360.
- Returns
- The Hue angle in the range 0 - 360.
◆ getInverted()
◆ getLerped()
ofColor_< PixelType > ofColor_< PixelType >::getLerped | ( | const ofColor_< PixelType > & | target, |
float | amount | ||
) | const |
A non-destructive version of lerp().
- Parameters
-
target The target color corresponding to an amount of 1.0. amount The amount (between 0.0 and 1.0) to interpolate. A value of 0.0 will yield an unchanged color. A value of 1.0 will yield the target color.
- Returns
- A copy of this color, lerped.
- See also
- lerp()
◆ getLightness()
float ofColor_< PixelType >::getLightness | ( | ) | const |
Calculate the lightness of the R, G and B components.
Lightness is simply the average of the three color components. This method of calculating lightness is used by the Lab and HSL color spaces.
- Returns
- the lightness in the range 0 - limit().
◆ getNormalized()
A non-destructive version of normalize().
- See also
- normalize()
- Returns
- A copy of this color, normalized.
◆ getSaturation()
float ofColor_< PixelType >::getSaturation | ( | ) | const |
◆ invert()
Invert the R, G and B components.
Performs an inversion operation on the color by replacing the red, green and blue components with their original value subtracted from the limit().
- Returns
- A reference to itself.
◆ lerp()
ofColor_< PixelType > & ofColor_< PixelType >::lerp | ( | const ofColor_< PixelType > & | target, |
float | amount | ||
) |
A linear interpolation between all components of two colors.
The linear interpolation is carried out on all components, R, G, B and A.
- Parameters
-
target The target color corresponding to an amount of 1.0. amount The amount (between 0.0 and 1.0) to interpolate. A value of 0.0 will yield an unchanged color. A value of 1.0 will yield the target color.
- Returns
- A reference to itself.
◆ limit()
|
inlinestatic |
Get the maximum value of a color component.
- Returns
- The value associated with a fully saturated color component.
◆ normalize()
Normalize the R, G and B components.
Performs a normalization operation on the red, green and blue components by scaling them by brightness of the original color divided by the limit(). The brightness is calculated by finding the maximum of original red, green and blue components. In short: ofColor / (brightness / limit())
- Returns
- A reference to itself.
◆ operator!=()
bool ofColor_< PixelType >::operator!= | ( | const ofColor_< PixelType > & | color | ) | const |
Test two colors for inequality.
- Returns
- true iff any of the R, G, B or A components are not equal.
◆ operator*() [1/2]
ofColor_< PixelType > ofColor_< PixelType >::operator* | ( | const ofColor_< PixelType > & | color | ) | const |
Clamped multiplication operator.
Multiply two colors by multiplying and clamping their R, G and B components.
- Warning
- The alpha component is ignored.
- Parameters
-
color The color to multiply.
- Returns
- The new clamped color.
◆ operator*() [2/2]
ofColor_< PixelType > ofColor_< PixelType >::operator* | ( | float | value | ) | const |
Clamped scalar multiplication operator.
Multiply the R, G and B components by a scaler and clamp each.
- Warning
- The alpha component is ignored.
- Parameters
-
value The value to multiply.
- Returns
- The new clamped color.
◆ operator*=() [1/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator*= | ( | const ofColor_< PixelType > & | color | ) |
Clamped multiplication operator.
Multiply two colors by multiplying and clamping their R, G and B components.
- Warning
- The alpha component is ignored.
- Parameters
-
color The color to multiply.
- Returns
- A reference to itself, the new clamped color.
◆ operator*=() [2/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator*= | ( | float | value | ) |
Clamped scalar multiplication operator.
Multiply the R, G and B components by a scaler and clamp each.
- Warning
- The alpha component is ignored.
- Parameters
-
value The scaler value.
- Returns
- A reference to itself, the new clamped color.
◆ operator+() [1/2]
ofColor_< PixelType > ofColor_< PixelType >::operator+ | ( | const ofColor_< PixelType > & | color | ) | const |
Clamped addition operator.
Add two colors by summing and clamping their R, G and B components.
- Warning
- The alpha component is ignored.
- Parameters
-
color The color to add.
- Returns
- The new clamped color.
◆ operator+() [2/2]
ofColor_< PixelType > ofColor_< PixelType >::operator+ | ( | float | color | ) | const |
Clamped addition operator.
Add a value to each of the R, G and B components and clamp each.
- Warning
- The alpha component is ignored.
- Parameters
-
color The value to add.
- Returns
- The new clamped color.
◆ operator+=() [1/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator+= | ( | const ofColor_< PixelType > & | color | ) |
Clamped addition operator.
Add two colors by summing and clamping their R, G and B components.
- Warning
- The alpha component is ignored.
- Parameters
-
color The color to add.
- Returns
- A reference to itself, the new clamped color.
◆ operator+=() [2/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator+= | ( | float | color | ) |
Clamped addition operator.
Add a value to each of the R, G and B components and clamp each.
- Warning
- The alpha component is ignored.
- Parameters
-
color The value to add.
- Returns
- A reference to itself, the new clamped color.
◆ operator-() [1/2]
ofColor_< PixelType > ofColor_< PixelType >::operator- | ( | const ofColor_< PixelType > & | color | ) | const |
Clamped subtraction operator.
Subtract two colors by subtracting and clamping their R, G and B components.
- Warning
- The alpha component is ignored.
- Parameters
-
color The color to subtract.
- Returns
- The new clamped color.
◆ operator-() [2/2]
ofColor_< PixelType > ofColor_< PixelType >::operator- | ( | float | value | ) | const |
Clamped subtraction operator.
Subtract a value from each of the R, G and B components and clamp each.
- Warning
- The alpha component is ignored.
- Parameters
-
value The value to subtract.
- Returns
- The new clamped color.
◆ operator-=() [1/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator-= | ( | const ofColor_< PixelType > & | color | ) |
Clamped subtraction operator.
Add two colors by subtracting and clamping their R, G and B components.
- Parameters
-
color The color to subtract.
- Returns
- A reference to itself, the new clamped color.
◆ operator-=() [2/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator-= | ( | float | color | ) |
Clamped subtraction operator.
Subtract a value to each of the R, G and B components and clamp each.
- Warning
- The alpha component is ignored.
- Parameters
-
color The value to subtract.
- Returns
- A reference to itself, the new clamped color.
◆ operator/() [1/2]
ofColor_< PixelType > ofColor_< PixelType >::operator/ | ( | const ofColor_< PixelType > & | color | ) | const |
Clamped division operator.
Divide two colors by treating the passed color components as divisors.
- Warning
- The alpha component is ignored.
- Parameters
-
color The divisor color.
- Returns
- The new clamped color.
◆ operator/() [2/2]
ofColor_< PixelType > ofColor_< PixelType >::operator/ | ( | float | value | ) | const |
Clamped scalar division operator.
Divide each of the R, G and B components by a scalar and clamp each.
- Warning
- The alpha component is ignored.
- Parameters
-
value The divisor value.
- Returns
- The new clamped color.
◆ operator/=() [1/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator/= | ( | const ofColor_< PixelType > & | color | ) |
Clamped division operator.
Divide two colors by treating the passed color components as divisors.
- Parameters
-
color The divisor color.
- Returns
- A reference to itself, the new clamped color.
◆ operator/=() [2/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator/= | ( | float | value | ) |
Clamped scalar division operator.
Divide each of the R, G and B components by a scalar and clamp each.
- Warning
- The alpha component is ignored.
- Parameters
-
value The divisor value.
- Returns
- A reference to itself, the new clamped color.
◆ operator=() [1/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator= | ( | const ofColor_< SrcType > & | color | ) |
Assign a color using an existing color.
R, G, B and A components are set to the the values of the assigned color.
- Warning
- Depending on the PixelType and SrcType used, color precision may be lost when converting a higher precision to a lower precision representation.
- Parameters
-
color The color to assign.
- Returns
- A reference to itself.
◆ operator=() [2/2]
ofColor_< PixelType > & ofColor_< PixelType >::operator= | ( | float | value | ) |
Assign a color using a grayscale value.
- Parameters
-
value The grayscale value.
- Returns
- A reference to itself.
◆ operator==()
bool ofColor_< PixelType >::operator== | ( | const ofColor_< PixelType > & | color | ) | const |
Test two colors for equality.
- Returns
- true iff the R, G, B and A components are all equal.
◆ operator[]() [1/2]
PixelType & ofColor_< PixelType >::operator[] | ( | std::size_t | n | ) |
Array subscript operator.
If n is 0 returns .r, if 1 returns .g, if 2 returns .b, if 3 returns alpha.
- Parameters
-
n An index 0-3 of the component to get.
- Returns
- The value of the requested component.
◆ operator[]() [2/2]
const PixelType & ofColor_< PixelType >::operator[] | ( | std::size_t | n | ) | const |
Array subscript operator.
If n is 0 returns .r, if 1 returns .g, if 2 returns .b, if 3 returns alpha.
- Parameters
-
n An index 0-3 of the component to get.
- Returns
- The value of the requested component.
◆ set() [1/3]
◆ set() [2/3]
Set a grayscale ofColor_ by specifying a single number.
- Parameters
-
gray A grayscale value. alpha The opacity of the color.
◆ set() [3/3]
void ofColor_< PixelType >::set | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = limit() |
||
) |
Set an ofColor_ by using RGB values.
- Parameters
-
red The red component. green The green component. blue The blue component. alpha The alpha component.
◆ setBrightness()
void ofColor_< PixelType >::setBrightness | ( | float | brightness | ) |
Set the brightness of this color.
- Parameters
-
brightness A brightness value to set in the range of 0 - limit().
◆ setHex() [1/2]
|
inline |
◆ setHex() [2/2]
|
inline |
Set an ofColor_ from a hexadecimal representation.
- Warning
- The alpha value should not be packed in the hexColor and must be specified separately.
- Parameters
-
hexColor An RGB color in hexadecimal form. alpha The alpha value of the color.
◆ setHsb()
◆ setHue()
void ofColor_< PixelType >::setHue | ( | float | hue | ) |
Set the hue of this color.
- Parameters
-
hue A hue value to set in the range of 0 - limit().
◆ setHueAngle()
void ofColor_< PixelType >::setHueAngle | ( | float | angle | ) |
Set the hue angle of this color.
- Parameters
-
angle A hue angle value to set in the range of 0 - 360 degrees.
◆ setSaturation()
void ofColor_< PixelType >::setSaturation | ( | float | saturation | ) |
Set the saturation of this color.
This method uses HSB not HSL. So red desaturated is white, not gray
- Parameters
-
saturation A saturation value value in the range of 0 - limit().
Friends And Related Symbol Documentation
◆ operator<<
|
friend |
An output stream operator.
Colors can be serialized into comma separated values (CSV) using the output stream operator.
- Parameters
-
os An output stream reference. color The color to write to the output stream.
- Returns
- The passed output stream reference, useful for method chaining.
◆ operator>>
|
friend |
An input stream operator.
Colors can be deserialized from comma separated values (CSV) input stream using the input stream operator.
- Parameters
-
is An input stream reference. color The color to fill with the input stream.
- Returns
- The passed input stream reference, useful for method chaining.
Member Data Documentation
◆ [union]
◆ a
PixelType ofColor_< PixelType >::a |
The alpha color component.
◆ aliceBlue
◆ antiqueWhite
|
static |
◆ aqua
◆ aquamarine
◆ azure
◆ b
PixelType ofColor_< PixelType >::b |
The blue color component.
◆ beige
◆ bisque
◆ black
◆ blanchedAlmond
|
static |
◆ blue
◆ blueSteel
◆ blueViolet
◆ brown
◆ burlyWood
◆ cadetBlue
◆ chartreuse
◆ chocolate
◆ coral
◆ cornflowerBlue
|
static |
◆ cornsilk
◆ crimson
◆ cyan
◆ darkBlue
◆ darkCyan
◆ darkGoldenRod
|
static |
◆ darkGray
◆ darkGreen
◆ darkGrey
◆ darkKhaki
◆ darkMagenta
◆ darkOliveGreen
|
static |
◆ darkOrange
◆ darkOrchid
◆ darkRed
◆ darkSalmon
◆ darkSeaGreen
|
static |
◆ darkSlateBlue
|
static |
◆ darkSlateGray
|
static |
◆ darkSlateGrey
|
static |
◆ darkTurquoise
|
static |
◆ darkViolet
◆ deepPink
◆ deepSkyBlue
◆ dimGray
◆ dimGrey
◆ dodgerBlue
◆ fireBrick
◆ floralWhite
◆ forestGreen
◆ fuchsia
◆ g
PixelType ofColor_< PixelType >::g |
The green color component.
◆ gainsboro
◆ ghostWhite
◆ gold
◆ goldenRod
◆ gray
◆ green
◆ greenYellow
◆ grey
◆ honeyDew
◆ hotPink
◆ indianRed
◆ indigo
◆ ivory
◆ khaki
◆ lavender
◆ lavenderBlush
|
static |
◆ lawnGreen
◆ lemonChiffon
|
static |
◆ lightBlue
◆ lightCoral
◆ lightCyan
◆ lightGoldenRodYellow
|
static |
◆ lightGray
◆ lightGreen
◆ lightGrey
◆ lightPink
◆ lightSalmon
◆ lightSeaGreen
|
static |
◆ lightSkyBlue
|
static |
◆ lightSlateGray
|
static |
◆ lightSlateGrey
|
static |
◆ lightSteelBlue
|
static |
◆ lightYellow
◆ lime
◆ limeGreen
◆ linen
◆ magenta
◆ maroon
◆ mediumAquaMarine
|
static |
◆ mediumBlue
◆ mediumOrchid
|
static |
◆ mediumPurple
|
static |
◆ mediumSeaGreen
|
static |
◆ mediumSlateBlue
|
static |
◆ mediumSpringGreen
|
static |
◆ mediumTurquoise
|
static |
◆ mediumVioletRed
|
static |
◆ midnightBlue
|
static |
◆ mintCream
◆ mistyRose
◆ moccasin
◆ navajoWhite
◆ navy
◆ oldLace
◆ olive
◆ oliveDrab
◆ orange
◆ orangeRed
◆ orchid
◆ paleGoldenRod
|
static |
◆ paleGreen
◆ paleTurquoise
|
static |
◆ paleVioletRed
|
static |
◆ papayaWhip
◆ peachPuff
◆ peru
◆ pink
◆ plum
◆ powderBlue
◆ purple
◆ r
PixelType ofColor_< PixelType >::r |
The red color component.
◆ red
◆ rosyBrown
◆ royalBlue
◆ saddleBrown
◆ salmon
◆ sandyBrown
◆ seaGreen
◆ seaShell
◆ sienna
◆ silver
◆ skyBlue
◆ slateBlue
◆ slateGray
◆ slateGrey
◆ snow
◆ springGreen
◆ steelBlue
◆ tan
◆ teal
◆ thistle
◆ tomato
◆ turquoise
◆ v
PixelType ofColor_< PixelType >::v[4] |
The pixel values as an array.
◆ violet
◆ wheat
◆ white
◆ whiteSmoke
◆ yellow
◆ yellowGreen
The documentation for this class was generated from the following files:
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/gl/ofLight.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/types/ofColor.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/types/ofColor.cpp