#include
<MColor.h>
This class is used to store values of color attributes. Its structure is compatible with that of the internal T4dFltVector class. Right now, this class provides no more functionality than the MFltVector class, but it is used because Rendering plans to employ more advanced color models in the future. In these models, colors cannot necessarily be represented as an RGB triple.
apiMeshShapeUI.cpp, cvColorNode.cpp, cvColorShader.cpp, D3DResourceManager.cpp, D3DViewportRenderer.cpp, hlslShader.cpp, hwAnisotropicShader_NV20.cpp, hwColorPerVertexShader.cpp, hwToonShader_NV20.cpp, hwUnlitShader.cpp, pnTrianglesNode.cpp, pnTrianglesNode.h, scanDagCmd.cpp, scanDagSyntax.cpp, ShadingConnection.cpp, ShadingConnection.h, simpleFluidEmitter.cpp, and volumeLightCmd.cpp.
Public Types |
|
enum | MColorType { kRGB, kHSV, kCMY, kCMYK } |
Defines color space. More... |
|
Public Member Functions |
|
MColor () | |
Default class contructor. |
|
MColor (const MColor &src) | |
Copy contructor. |
|
MColor (float rr, float gg, float bb=0.0, float aa=1.0) | |
RGB contructor. |
|
MColor (const float d[3]) | |
RGB contructor. |
|
MColor (float alpha) | |
Alpha contructor. |
|
MColor (MColorType colorModel, unsigned char c1, unsigned char c2, unsigned char c3, unsigned char alpha=255U) | |
Color space contructor. |
|
MColor (MColorType colorModel, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short alpha=65535U) | |
Color space contructor. |
|
MColor (MColorType colorModel, float c1, float c2, float c3, float alpha=1.0) | |
Color space contructor. |
|
MColor (MColorType colorModel, double c1, double c2, double c3, double alpha=1.0) | |
Color space contructor. |
|
~MColor () | |
Class destructor. |
|
MColor & | operator= (const MColor &src) |
Assignment operator. |
|
float | operator() (unsigned int i) const |
Index operator. |
|
float | operator[] (unsigned int i) const |
Index operator. |
|
MColor & | operator*= (float scalar) |
In place multiply operator. |
|
MColor | operator* (float scalar) const |
Multiply operator. |
|
MColor & | operator*= (const MColor &other) |
In place multiply operator. |
|
MColor | operator* (const MColor &other) const |
Multiply operator. |
|
MColor & | operator/= (float scalar) |
In place divide operator. |
|
MColor | operator/ (float scalar) const |
Divide operator. |
|
MColor & | operator+= (const MColor &other) |
In place add operator. |
|
MColor | operator+ (const MColor &other) const |
Add operator. |
|
MColor | operator- () const |
Unary minus operator. |
|
MColor | operator- (const MColor &other) const |
Substraction operator. |
|
bool | operator== (const MColor &other) const |
Equality operator. |
|
bool | operator!= (const MColor &other) const |
Inequality operator. |
|
bool | get (float d[3]) const |
Color component accessor. |
|
bool | get (MColorType colorModel, float &, float &, float &) const |
Color component accessor. |
|
bool | get (MColorType colorModel, float &, float &, float &, float &alpha) const |
Color component accessor. |
|
bool | set (MColorType colorModel, float, float, float, float alpha=1.0) |
Color component assigment. |
|
float & | operator() (unsigned int i) |
Index operator. NO SCRIPT SUPPORT. |
|
float & | operator[] (unsigned int i) |
Index operator. NO SCRIPT SUPPORT. |
|
Public Attributes |
|
float | r |
The red component of the color. |
|
float | g |
The green component of the color. |
|
float | b |
The blue component of the color. |
|
float | a |
The alpha component of the color. |
|
Friends |
|
OPENMAYA_EXPORT MColor | operator* (float scalar, const MColor &other) |
Multiply operator. NO SCRIPT SUPPORT.
|
|
OPENMAYA_EXPORT std::ostream & | operator<< (std::ostream &os, const MColor &c) |
Print operator. NO SCRIPT SUPPORT. |
enum MColor::MColorType |
MColor::MColor | ( | ) | [inline] |
Default class contructor.
Initializes the object to a black opaque color.
MColor::MColor | ( | const MColor & | src | ) | [inline] |
Copy contructor.
Create a new color and initialize it to the same values as the given color.
[in] | src | The color object to copy. |
MColor::MColor | ( | float | rr, | |
float | gg, | |||
float | bb = 0.0 , |
|||
float | aa = 1.0 |
|||
) | [inline] |
RGB contructor.
Initializes the color with the explicit r, g, b, and a values provided as arguments.
[in] | rr | The r component of the color. |
[in] | gg | The g component of the color. |
[in] | bb | The b component of the color. Defaults to 0.0. |
[in] | aa | The a component of the color. Defaults to 1.0. |
MColor::MColor | ( | const float | d[3] | ) | [inline] |
RGB contructor.
Initializes the color with the explicit red, green and blue values provided in the given float array. The alpha value will be 1.0: The color is opaque.
[in] | d | The 3 element array containing the initial red, green, and blue values. |
MColor::MColor | ( | float | alpha | ) | [inline] |
Alpha contructor.
Initializes a black color with transparency. The r, g, b components are set to 0.
[in] | alpha | The transparency component of the color. |
MColor::MColor | ( | MColor::MColorType | colorModel, | |
unsigned char | c1, | |||
unsigned char | c2, | |||
unsigned char | c3, | |||
unsigned char | alpha = 255U |
|||
) |
Color space contructor.
Initializes the color with the given color model using unsigned int data in range [0-255].
[in] | colorModel | The color model. |
[in] | c1 | First component of color. |
[in] | c2 | Second component of color. |
[in] | c3 | Third component of color. |
[in] | alpha | Transparency. Defaults to opaque (255). |
MColor::MColor | ( | MColor::MColorType | colorModel, | |
unsigned short | c1, | |||
unsigned short | c2, | |||
unsigned short | c3, | |||
unsigned short | alpha = 65535U |
|||
) |
Color space contructor.
Initializes the color with the given color model using unsigned int data in range [0-65535].
[in] | colorModel | The color model. |
[in] | c1 | First component of color. |
[in] | c2 | Second component of color. |
[in] | c3 | Third component of color. |
[in] | alpha | Transparency. Defaults to opaque (65535). |
MColor::MColor | ( | MColor::MColorType | colorModel, | |
float | c1, | |||
float | c2, | |||
float | c3, | |||
float | alpha = 1.0 |
|||
) |
Color space contructor.
Initializes the color with the given color model using float data in range [0-1.0].
[in] | colorModel | The color model. |
[in] | c1 | First component of color. |
[in] | c2 | Second component of color. |
[in] | c3 | Third component of color. |
[in] | alpha | Transparency. Defaults to opaque (1.0). |
MColor::MColor | ( | MColor::MColorType | colorModel, | |
double | c1, | |||
double | c2, | |||
double | c3, | |||
double | alpha = 1.0 |
|||
) |
Color space contructor.
Class constructor. Initializes the color with the given color model using double precision data in range [0-1.0].
[in] | colorModel | The color model. |
[in] | c1 | First component of color. |
[in] | c2 | Second component of color. |
[in] | c3 | Third component of color. |
[in] | alpha | Transparency. Defaults to opaque (1.0). |
MColor::~MColor | ( | ) |
Class destructor.
Deallocates the memory.
Assignment operator.
Copies a color.
[in] | src | The color object to copy. |
float MColor::operator() | ( | unsigned int | i | ) | const [inline] |
Index operator.
Accessor to one component of the color.
[in] | i | Value indicating which component to return. |
float MColor::operator[] | ( | unsigned int | i | ) | const [inline] |
Index operator.
Accessor to one component of the color.
[in] | i | Value indicating which component to return. |
MColor & MColor::operator*= | ( | float | scalar | ) |
In place multiply operator.
[in] | scalar | Color multiplication factor. |
MColor MColor::operator* | ( | float | scalar | ) | const |
In place multiply operator.
Performs a componentwise multiplication of two colors.
[in] | other | Color to be multiplied with this color. |
Multiply operator.
Performs a componentwise multiplication of two colors.
[in] | other | Color to be multiplied with this color. |
MColor & MColor::operator/= | ( | float | scalar | ) |
In place divide operator.
[in] | scalar | Color division factor. |
MColor MColor::operator/ | ( | float | scalar | ) | const |
Divide operator.
[in] | scalar | Color division factor. |
In place add operator.
[in] | other | Color to be added to this color. |
Add operator.
[in] | other | Color to be added to this color. |
MColor MColor::operator- | ( | ) | const |
Unary minus operator.
Negates the value of each of the red, green and blue components of the color. Transparency is set to opaque.
Substraction operator.
[in] | other | Color to be subtracted from this color. |
bool MColor::operator== | ( | const MColor & | other | ) | const |
Equality operator.
Compares the r, g, and b components of two color.
[in] | other | Color to which this color will be compared. |
bool MColor::operator!= | ( | const MColor & | other | ) | const |
Inequality operator.
Compares the r, g, and b components of two color.
[in] | other | Color to which this color will be compared. |
bool MColor::get | ( | float | d[3] | ) | const [inline] |
Color component accessor.
Extracts the r, g, and b components of the color and places them in elements 0, 1, and 2 of the float array passed.
[out] | d | The array of 3 floats into which the results are placed. |
bool MColor::get | ( | MColor::MColorType | colorModel, | |
float & | c1, | |||
float & | c2, | |||
float & | c3 | |||
) | const |
Color component accessor.
Retrieves the values of 3 components of the color using the specified color model.
[in] | colorModel | The color model. |
[out] | c1 | Storage for the first component of color. |
[out] | c2 | Storage for the second component of color. |
[out] | c3 | Storage for the third component of color. |
bool MColor::get | ( | MColor::MColorType | colorModel, | |
float & | c1, | |||
float & | c2, | |||
float & | c3, | |||
float & | alpha | |||
) | const |
Color component accessor.
Retrieves the values of 4 components of the color using the specified color model.
[in] | colorModel | The color model. |
[out] | c1 | Storage for the first component of color. |
[out] | c2 | Storage for the second component of color. |
[out] | c3 | Storage for the third component of color. |
[out] | alpha | Storage for the alpha component of color. |
bool MColor::set | ( | MColor::MColorType | colorModel, | |
float | c1, | |||
float | c2, | |||
float | c3, | |||
float | alpha = 1.0 |
|||
) |
Color component assigment.
Sets the values of the color components using the specified color model.
[in] | colorModel | The color model. |
[in] | c1 | First component of color. |
[in] | c2 | Second component of color. |
[in] | c3 | Third component of color. |
[in] | alpha | Alpha component of color. |
float & MColor::operator() | ( | unsigned int | i | ) | [inline] |
Index operator. NO SCRIPT SUPPORT.
Accessor to one component of the color.
[in] | i | Value indicating which component to return. |
float & MColor::operator[] | ( | unsigned int | i | ) | [inline] |
Index operator. NO SCRIPT SUPPORT.
Accessor to one component of the color.
[in] | i | Value indicating which component to return. |
Multiply operator. NO SCRIPT SUPPORT.
The scalar multiplication operator that allows the scalar value to preceed the color.
[in] | scalar | Color multiplication factor. |
[in] | other | Color object to be multiplied. |
OPENMAYA_EXPORT std::ostream& operator<< | ( | std::ostream & | os, | |
const MColor & | c | |||
) | [friend] |
Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |