#include <graphics.hpp>
Inheritance diagram for gfx::ColorCycle:
.1] and forwards the choosing of the color to its registered ColorScheme. The mapping is a 'flat-headed' saw-tooth function, where users control the period of the saw-tooth and the width of the flat sections.
Public Member Functions | |
ColorCycle (const ColorScheme *scheme, double period, double width) | |
virtual void | Set (double value) const |
Periodically map 'value' to [0. | |
double | ComputeMapping (double value) const |
Protected Attributes | |
const ColorScheme * | m_scheme |
double | m_period |
double | m_width |
double | m_half_period |
double | m_scaled_width |
double | m_scale |
gfx::ColorCycle::ColorCycle | ( | const ColorScheme * | scheme, | |
double | period, | |||
double | width | |||
) |
period | the cycle repeats with this period (ensured to be >= epsilon) |
width | the mapped value stays 0 or 1 within 'width' of N*period ('width' is trunkated to period/3) |
void gfx::ColorCycle::Set | ( | double | value | ) | const [virtual] |
Periodically map 'value' to [0.
.1] using ComputeMapping() and forward to the registered scheme.
Implements gfx::ColorScheme.
double gfx::ColorCycle::ComputeMapping | ( | double | value | ) | const |
const ColorScheme* gfx::ColorCycle::m_scheme [protected] |
double gfx::ColorCycle::m_period [protected] |
double gfx::ColorCycle::m_width [protected] |
double gfx::ColorCycle::m_half_period [protected] |
double gfx::ColorCycle::m_scaled_width [protected] |
double gfx::ColorCycle::m_scale [protected] |