Creates a list of around 36 different colors, where one is easily distinguished from the preceding one. More...
#include <mitkColorSequenceCycleH.h>


Public Member Functions | |
| ColorSequenceCycleH () | |
| virtual | ~ColorSequenceCycleH () |
| virtual Color | GetNextColor () |
| Return another color. | |
| virtual void | GoToBegin () |
| Rewind to first color. | |
| virtual void | ChangeHueValueByCycleSteps (int steps) |
| Increase the used Hue value. This can be done by steps ( = steps * 60 increase of Hue ) or absolute ( 0.0 < Hue < 360.0). Can also be used to decrease the Hue; Values < 0 are cropped to 0. Note: This does not change the other values, i.e. the color cycle. Therefor, the method can just be used to skip steps (i.e. colors) in a cycle. Use SetColorCycle if you want to change other values. | |
| virtual void | ChangeHueValueByAbsoluteNumber (float number) |
| virtual void | SetColorCycle (unsigned short cycle) |
| Set the color cycle. The color cycle has to be an integer value between 0 and 5 (see class description for an explanation). Use this in combination with the hue value cahnge to generate your dream colors... | |
Protected Attributes | |
| float | color_h |
| float | color_s |
| float | color_v |
| unsigned short | color_cycle |
Creates a list of around 36 different colors, where one is easily distinguished from the preceding one.
The list of colors starts with a fully saturated, full valued red (Hue = 0 = 360). After that the sequence is generated like this:
Finally repeat colors.
Definition at line 39 of file mitkColorSequenceCycleH.h.
| mitk::ColorSequenceCycleH::ColorSequenceCycleH | ( | ) |
Definition at line 23 of file mitkColorSequenceCycleH.cpp.
References color_cycle, color_h, color_s, and color_v.
{
color_h = -60.0; // after the first increase this will yield red
color_s = 1.0; // full saturation
color_v = 1.0; // full value
color_cycle = 0;
}
| mitk::ColorSequenceCycleH::~ColorSequenceCycleH | ( | ) | [virtual] |
Definition at line 31 of file mitkColorSequenceCycleH.cpp.
{
// nothing to do
}
| void mitk::ColorSequenceCycleH::ChangeHueValueByAbsoluteNumber | ( | float | number ) | [virtual] |
Definition at line 110 of file mitkColorSequenceCycleH.cpp.
References color_h.
{
color_h += number;
}
| void mitk::ColorSequenceCycleH::ChangeHueValueByCycleSteps | ( | int | steps ) | [virtual] |
Increase the used Hue value. This can be done by steps ( = steps * 60 increase of Hue ) or absolute ( 0.0 < Hue < 360.0). Can also be used to decrease the Hue; Values < 0 are cropped to 0. Note: This does not change the other values, i.e. the color cycle. Therefor, the method can just be used to skip steps (i.e. colors) in a cycle. Use SetColorCycle if you want to change other values.
Definition at line 105 of file mitkColorSequenceCycleH.cpp.
References color_h.
{
color_h += (float)(steps*60.0);
}
| Color mitk::ColorSequenceCycleH::GetNextColor | ( | ) | [virtual] |
Return another color.
Implements mitk::ColorSequence.
Definition at line 36 of file mitkColorSequenceCycleH.cpp.
References color_cycle, color_h, color_s, color_v, and mitk::ColorConversions::Hsv2Rgb().
Referenced by SetColorCycle().
{
color_h += 60.0;
if ( color_h < 0.0 ) color_h = 0.0;
if (color_h >= 360.0)
{
if ( color_cycle == 0 )
{
color_h = 30.0;
color_s = 1.0;
color_v = 1.0;
color_cycle = 1;
}
else if (color_cycle == 1)
{
color_h = 0.0;
color_s = 0.5;
color_v = 1.0;
color_cycle = 2;
}
else if (color_cycle == 2)
{
color_h = 30.0;
color_s = 0.5;
color_v = 1.0;
color_cycle = 3;
}
else if (color_cycle == 3)
{
color_h = 0.0;
color_s = 1.0;
color_v = 0.5;
color_cycle = 4;
}
else if (color_cycle == 4)
{
color_h = 30.0;
color_s = 1.0;
color_v = 0.5;
color_cycle = 5;
}
else if (color_cycle == 5)
{
color_h = 0.0;
color_s = 1.0;
color_v = 1.0;
color_cycle = 0;
}
}
// convert to rgb
float r, g, b;
ColorConversions::Hsv2Rgb(color_h, color_s, color_v, r, g, b);
Color returnColor;
returnColor.Set(r, g, b);
return returnColor;
}
| void mitk::ColorSequenceCycleH::GoToBegin | ( | ) | [virtual] |
Rewind to first color.
Implements mitk::ColorSequence.
Definition at line 97 of file mitkColorSequenceCycleH.cpp.
References color_cycle, color_h, color_s, and color_v.
{
color_h = -60.0; // after the first increase this will yield red
color_s = 1.0; // full saturation
color_v = 1.0; // full value
color_cycle = 0;
}
| void mitk::ColorSequenceCycleH::SetColorCycle | ( | unsigned short | cycle ) | [virtual] |
Set the color cycle. The color cycle has to be an integer value between 0 and 5 (see class description for an explanation). Use this in combination with the hue value cahnge to generate your dream colors...
Definition at line 115 of file mitkColorSequenceCycleH.cpp.
References color_cycle, color_h, and GetNextColor().
{
if ( cycle > 5 ) cycle = 5;
color_cycle = cycle;
color_h = 360.0;
this->GetNextColor();
}
unsigned short mitk::ColorSequenceCycleH::color_cycle [protected] |
Definition at line 83 of file mitkColorSequenceCycleH.h.
Referenced by ColorSequenceCycleH(), GetNextColor(), GoToBegin(), and SetColorCycle().
float mitk::ColorSequenceCycleH::color_h [protected] |
Definition at line 79 of file mitkColorSequenceCycleH.h.
Referenced by ChangeHueValueByAbsoluteNumber(), ChangeHueValueByCycleSteps(), ColorSequenceCycleH(), GetNextColor(), GoToBegin(), and SetColorCycle().
float mitk::ColorSequenceCycleH::color_s [protected] |
Definition at line 80 of file mitkColorSequenceCycleH.h.
Referenced by ColorSequenceCycleH(), GetNextColor(), and GoToBegin().
float mitk::ColorSequenceCycleH::color_v [protected] |
Definition at line 81 of file mitkColorSequenceCycleH.h.
Referenced by ColorSequenceCycleH(), GetNextColor(), and GoToBegin().
1.7.2