C++ API Reference: MColorMixingSpaceHelper Class Reference

Introduced in 2023.0 More...

#include <MColorMixingSpaceHelper.h>

Public Types

enum  Direction { kForward = 0, kInverse }
 Color transform direction. More...
 

Public Member Functions

MStatus refresh ()
 Re-initializes the color mixing helper, for example after a configuration change. More...
 
MStringArray getMixingSpaceNames (MStatus *returnedStatus=nullptr) const
 Returns the list of available mixing spaces for the current color management configuration. More...
 
MStatus setMixingSpace (const MString &name)
 Sets the mixing space to be used by MColorPickerUtilities::applyMixingTransform() and the slider methods. More...
 
MString mixingSpace () const
 Returns the current mixing space.
 
bool mixingSpaceHasViews () const
 Returns true if the current mixing space supports viewws.
 
MStringArray getViewNames (MStatus *returnedStatus=nullptr) const
 Returns the list of available views for the current color management configuration. More...
 
MStatus setView (const MString &name)
 Sets the view to be used by MColorPickerUtilities::applyMixingTransform() and the slider methods. More...
 
MString view () const
 Returns the current view.
 
MColor applyMixingTransform (const MColor &inputColor, Direction direction, MStatus *returnedStatus=nullptr) const
 Applies the mixing transform to an input color. More...
 
float mixingToSlider (float mixingPosition, float minPos, float maxPos) const
 Converts a mixing space component value to its normalized color slider position. More...
 
float sliderToMixing (float sliderPosition, float minPos, float maxPos) const
 Converts normalized slider position to mixing space value. More...
 

Detailed Description

Introduced in 2023.0

2023.0:
Introduced in this version.

Helper class for implementing correct color pickers that use widgets such as sliders and color wheels to mix colors

Create an instance and set the mixing color space to transform a color or evaluate sliders.

Note
All methods return the input color or the appropriate linear slider values when Maya color management is disabled.

Member Enumeration Documentation

enum Direction

Color transform direction.

Enumerator
kForward 

apply the color transform

kInverse 

invert the color transform

Member Function Documentation

MStatus refresh ( )

Re-initializes the color mixing helper, for example after a configuration change.

Returns
Status code.
MStringArray getMixingSpaceNames ( MStatus returnedStatus = nullptr) const

Returns the list of available mixing spaces for the current color management configuration.

Parameters
[out]returnedStatusStatus code
Returns
List of avaialble mixing spaces
MStatus setMixingSpace ( const MString name)

Sets the mixing space to be used by MColorPickerUtilities::applyMixingTransform() and the slider methods.

Parameters
[in]nameThe color space name as one of the values by getMixingSpaceNames()
Returns
kSuccess if mixing space name is valid, otherwise kInvalidParameter
MStringArray getViewNames ( MStatus returnedStatus = nullptr) const

Returns the list of available views for the current color management configuration.

Parameters
[out]returnedStatusStatus code
Returns
List of avaialble views
MStatus setView ( const MString name)

Sets the view to be used by MColorPickerUtilities::applyMixingTransform() and the slider methods.

Parameters
[in]nameThe view name as one of the values by getViewNames()
Returns
kSuccess if view name is valid, otherwise kInvalidParameter
MColor applyMixingTransform ( const MColor inputColor,
Direction  direction,
MStatus returnedStatus = nullptr 
) const

Applies the mixing transform to an input color.

The mixing space must have been previously set.

Parameters
[in]inputColorThe input color to transform
[in]directionThe direction of the transform,
[out]returnedStatusStatus code.
Returns
Returns the transformed color, or the input color if color management is turned off
float mixingToSlider ( float  mixingPosition,
float  minPos,
float  maxPos 
) const

Converts a mixing space component value to its normalized color slider position.

Parameters
[in]mixingPositionThe mixing color value to convert
[in]minPosLeft edge mixing value for the slider
[in]maxPosRight edge mixing value for the slider
Returns
The slider position to display
float sliderToMixing ( float  sliderPosition,
float  minPos,
float  maxPos 
) const

Converts normalized slider position to mixing space value.

Parameters
[in]sliderPositionThe position of the slider within minPos and maxPos
[in]minPosLeft edge mixing value for the slider
[in]maxPosRight edge mixing value for the slider
Returns
The color component value for the given slider position

The documentation for this class was generated from the following files:
  • MColorMixingSpaceHelper.h
  • MColorMixingSpaceHelper.cpp