Property for storing RGB color values.
More...
#include <mitkColorProperty.h>
|
| | mitkClassMacro (ColorProperty, BaseProperty) |
| |
| Pointer | Clone () const |
| |
| | mitkNewMacro1Param (ColorProperty, const float *) |
| |
| | mitkNewMacro1Param (ColorProperty, const mitk::Color &) |
| |
| | mitkNewMacro3Param (ColorProperty, const float, const float, const float) |
| |
| const mitk::Color & | GetColor () const |
| | Get the color value. More...
|
| |
| const mitk::Color & | GetValue () const |
| | Get the color value (alias for GetColor()). More...
|
| |
| std::string | GetValueAsString () const override |
| | Return the color as a human-readable string. More...
|
| |
| void | SetColor (const mitk::Color &color) |
| | Set the color value. More...
|
| |
| void | SetValue (const mitk::Color &color) |
| | Set the color value (alias for SetColor()). More...
|
| |
| void | SetColor (float red, float green, float blue) |
| | Set the color from individual RGB components. More...
|
| |
| bool | ToJSON (nlohmann::json &j) const override |
| | Serialize the color to JSON as a three-element array [r, g, b]. More...
|
| |
| bool | FromJSON (const nlohmann::json &j) override |
| | Deserialize the color from a JSON three-element array [r, g, b]. More...
|
| |
| BaseProperty & | operator= (const BaseProperty &property) |
| | Assign a property value to this instance. More...
|
| |
| | mitkClassMacroItkParent (BaseProperty, itk::Object) |
| |
| Pointer | Clone () const |
| |
| bool | operator== (const BaseProperty &property) const |
| | Compare two properties for equality. More...
|
| |
| BaseProperty & | operator= (const BaseProperty &property) |
| | Assign a property value to this instance. More...
|
| |
| bool | AssignProperty (const BaseProperty &property) |
| | Assign a property value to this instance and report success. More...
|
| |
Property for storing RGB color values.
Stores an RGB color with float precision (each component 0.0f to 1.0f). Used to associate a rendering color with a DataNode.
- Note
- If you want to apply the mitk::ColorProperty to an mitk::Image, make sure to set the mitk::RenderingModeProperty to a mode which supports color (e.g. LOOKUPTABLE_LEVELWINDOW_COLOR). For an example, see mitkImageVtkMapper2DColorTest.cpp in Core/Code/Rendering.
- See also
- BaseProperty
-
RenderingModeProperty
Definition at line 61 of file mitkColorProperty.h.
◆ ValueType
◆ ColorProperty() [1/5]
| mitk::ColorProperty::ColorProperty |
( |
| ) |
|
|
protected |
◆ ColorProperty() [2/5]
| mitk::ColorProperty::ColorProperty |
( |
const ColorProperty & |
other | ) |
|
|
protected |
◆ ColorProperty() [3/5]
| mitk::ColorProperty::ColorProperty |
( |
const float |
red, |
|
|
const float |
green, |
|
|
const float |
blue |
|
) |
| |
|
protected |
◆ ColorProperty() [4/5]
| mitk::ColorProperty::ColorProperty |
( |
const float |
color[3] | ) |
|
|
protected |
◆ ColorProperty() [5/5]
| mitk::ColorProperty::ColorProperty |
( |
const mitk::Color & |
color | ) |
|
|
protected |
◆ Clone()
| Pointer mitk::ColorProperty::Clone |
( |
| ) |
const |
◆ FromJSON()
Deserialize the color from a JSON three-element array [r, g, b].
- Parameters
-
| [in] | j | The JSON array containing the RGB values. |
- Returns
- Always
true.
Implements mitk::BaseProperty.
◆ GetColor()
| const mitk::Color& mitk::ColorProperty::GetColor |
( |
| ) |
const |
Get the color value.
- Returns
- A const reference to the stored color.
◆ GetValue()
| const mitk::Color& mitk::ColorProperty::GetValue |
( |
| ) |
const |
Get the color value (alias for GetColor()).
- Returns
- A const reference to the stored color.
◆ GetValueAsString()
| std::string mitk::ColorProperty::GetValueAsString |
( |
| ) |
const |
|
overridevirtual |
Return the color as a human-readable string.
- Returns
- A string representation of the RGB values.
Reimplemented from mitk::BaseProperty.
◆ mitkClassMacro()
◆ mitkCloneMacro()
◆ mitkNewMacro1Param() [1/2]
| mitk::ColorProperty::mitkNewMacro1Param |
( |
ColorProperty |
, |
|
|
const float * |
|
|
) |
| |
◆ mitkNewMacro1Param() [2/2]
◆ mitkNewMacro3Param()
| mitk::ColorProperty::mitkNewMacro3Param |
( |
ColorProperty |
, |
|
|
const float |
, |
|
|
const float |
, |
|
|
const float |
|
|
) |
| |
◆ New()
| static Pointer mitk::ColorProperty::New |
( |
| ) |
|
|
static |
◆ operator=()
Assign a property value to this instance.
Performs a polymorphic assignment from the given property. The assignment succeeds only if the source and target properties are of the same type. The subclass-specific Assign() method is called to perform the actual value copy.
Subclasses must implement Assign(const BaseProperty&) and call the superclass Assign method for proper handling. The copy assignment operator of the subclass should be disabled and the base class operator should be made visible using "using" statements.
- Parameters
-
| [in] | property | The property whose value should be assigned to this instance. |
- Returns
- A reference to this property.
- See also
- AssignProperty
-
Assign
◆ SetColor() [1/2]
| void mitk::ColorProperty::SetColor |
( |
const mitk::Color & |
color | ) |
|
Set the color value.
Marks the property as modified if the new color differs from the current one.
- Parameters
-
| [in] | color | The new color to set. |
◆ SetColor() [2/2]
| void mitk::ColorProperty::SetColor |
( |
float |
red, |
|
|
float |
green, |
|
|
float |
blue |
|
) |
| |
Set the color from individual RGB components.
- Parameters
-
| [in] | red | Red component (0.0f to 1.0f). |
| [in] | green | Green component (0.0f to 1.0f). |
| [in] | blue | Blue component (0.0f to 1.0f). |
◆ SetValue()
| void mitk::ColorProperty::SetValue |
( |
const mitk::Color & |
color | ) |
|
Set the color value (alias for SetColor()).
- Parameters
-
| [in] | color | The new color to set. |
◆ ToJSON()
Serialize the color to JSON as a three-element array [r, g, b].
- Parameters
-
| [out] | j | The JSON object to write the value into. |
- Returns
- Always
true.
Implements mitk::BaseProperty.
◆ m_Color
The documentation for this class was generated from the following file: