|
cgv
|
Implementation of a color_scale with a continuous input domain and output range using a continuous_color_scheme. More...
#include <color_scale.h>
Public Member Functions | |
| continuous_color_scale () | |
| Construct using default arguments. | |
| continuous_color_scale (const continuous_color_scheme &scheme) | |
| Construct using the given color scheme. | |
| bool | is_discrete () const override |
| See color_scale::is_discrete(). | |
| bool | is_opaque () const override |
| See color_scale::is_opaque(). | |
| void | set_domain (cgv::vec2 domain) override |
| See color_scale::set_domain(). | |
| void | set_transform (ContinuousMappingTransform transform) |
| Set the transform used to map scalars to colors. | |
| ContinuousMappingTransform | get_transform () const |
| Get the transform used to map scalars to colors. | |
| virtual void | set_pow_exponent (float exponent) |
| Set the exponent for power scales. | |
| float | get_pow_exponent () const |
| Get the exponent for power scales. | |
| virtual void | set_log_base (float base) |
| Set the base for logarithmic scales. | |
| float | get_log_base () const |
| Get the base for logarithmic scales. | |
| virtual void | set_diverging (bool diverging) |
| Set whether the scale uses a diverging mapping. | |
| bool | is_diverging () const |
| Get whether the scale uses a diverging mapping. | |
| virtual void | set_midpoint (float midpoint) |
| Set the midpoint for diverging scales. | |
| float | get_midpoint () const |
| Get the midpoint for diverging scales. | |
| float | normalize_value (float value) const override |
| See color_scale::normalize_value() | |
| cgv::rgb | get_mapped_color (float value) const override |
| See color_scale::get_mapped_value() | |
| std::vector< cgv::rgba > | quantize (size_t count) const override |
| See color_scale::quantize(). | |
| std::vector< float > | get_ticks (size_t request_count) const override |
| See color_scale::get_ticks(). | |
| void | set_scheme (const continuous_color_scheme &scheme) |
| Set the color scheme used as this scale's color ramp. | |
| continuous_color_scheme | get_scheme () const |
| Get the color scheme used as this scale's color ramp. | |
Public Member Functions inherited from cgv::media::color_scale | |
| virtual | ~color_scale () |
| Destruct this color scale. | |
| cgv::vec2 | get_domain () const |
| Get the input domain of scalars that will be mapped. | |
| virtual void | set_clamped (bool clamped) |
| Set whether the input values are clamped to the domain before mapping. | |
| bool | is_clamped () const |
| Get whether the input values are clamped to the domain before mapping. | |
| virtual void | set_reversed (bool reverse) |
| Set whether the output color ramp is reversed. | |
| bool | is_reversed () const |
| Get whether the output color ramp is reversed. | |
| virtual void | set_unknown_color (cgv::rgba color) |
| Set the color returned for scalars outside the domain if clamping is disabled. | |
| cgv::rgba | get_unknown_color () const |
| Get the color returned for scalars outside the domain if clamping is disabled. | |
| virtual cgv::rgba | map_value (float value) const |
| Map a value through the scale and return a RGBA color. | |
| virtual float | get_mapped_opacity (float value) const |
| Map a value through the scale and return an opacity. | |
| virtual cgv::rgba | get_indexed_color (size_t index) const |
| Map a discrete index through the lookup table and return a RGBA color. | |
| virtual size_t | get_indexed_color_count () const |
| return the number of available indexed colors. | |
| cgv::data::time_point | get_modified_time () const |
| Get the time point of the last modification of this object. | |
Additional Inherited Members | |
Protected Member Functions inherited from cgv::media::color_scale | |
| void | modified () |
| Update the object's modified time. | |
| bool | is_unknown (float value) const |
| Test whether the value is outside the domain according to the mapping options. | |
| float | map_range_safe (float value, float in_left, float in_right, float out_left, float out_right) const |
| Remap a scalar value from an input range to and output range while safely handling empty ranges. | |
Implementation of a color_scale with a continuous input domain and output range using a continuous_color_scheme.
The scale supports mapping input values to colors using one of the transforms defined in ContinuousMappingTransform.
Definition at line 221 of file color_scale.h.
|
inline |
Construct using default arguments.
Definition at line 224 of file color_scale.h.
|
inline |
Construct using the given color scheme.
| scheme | The color scheme used as the color ramp. |
Definition at line 229 of file color_scale.h.
|
inline |
|
overridevirtual |
See color_scale::get_mapped_value()
Reimplemented from cgv::media::color_scale.
Definition at line 138 of file color_scale.cxx.
References cgv::media::color_scale::get_unknown_color(), cgv::media::continuous_color_scheme::interpolate(), cgv::media::color_scale::is_unknown(), and normalize_value().
|
inline |
Get the midpoint for diverging scales.
Definition at line 313 of file color_scale.h.
|
inline |
Get the exponent for power scales.
Definition at line 273 of file color_scale.h.
|
inline |
Get the color scheme used as this scale's color ramp.
Definition at line 337 of file color_scale.h.
|
overridevirtual |
Implements cgv::media::color_scale.
Definition at line 154 of file color_scale.cxx.
References cgv::media::color_scale::get_domain().
|
inline |
Get the transform used to map scalars to colors.
See also set_transform().
Definition at line 259 of file color_scale.h.
|
inlineoverridevirtual |
See color_scale::is_discrete().
Implements cgv::media::color_scale.
Definition at line 233 of file color_scale.h.
|
inline |
Get whether the scale uses a diverging mapping.
Definition at line 300 of file color_scale.h.
|
inlineoverridevirtual |
Reimplemented from cgv::media::color_scale.
Definition at line 239 of file color_scale.h.
|
overridevirtual |
See color_scale::normalize_value()
Reimplemented from cgv::media::color_scale.
Definition at line 80 of file color_scale.cxx.
References cgv::media::color_scale::get_domain(), cgv::media::color_scale::is_clamped(), cgv::media::color_scale::is_reversed(), and cgv::media::color_scale::map_range_safe().
Referenced by get_mapped_color().
|
overridevirtual |
Implements cgv::media::color_scale.
Definition at line 144 of file color_scale.cxx.
References cgv::media::continuous_color_scheme::get_interpolator(), and cgv::media::color_scale::is_reversed().
|
virtual |
Set whether the scale uses a diverging mapping.
Diverging scales apply the transform mirrored around the midpoint.
| diverging | Set to true to enable diverging mapping. |
Definition at line 66 of file color_scale.cxx.
References cgv::media::color_scale::modified().
|
overridevirtual |
See color_scale::set_domain().
Reimplemented from cgv::media::color_scale.
Definition at line 40 of file color_scale.cxx.
References cgv::media::color_scale::set_domain().
|
virtual |
Set the base for logarithmic scales.
Only used if get_transform() returns ContinuousMappingTransform::kLog. Defaults to 10.
| exponent | The exponent. |
Definition at line 58 of file color_scale.cxx.
References cgv::media::color_scale::modified().
|
virtual |
Set the midpoint for diverging scales.
Only used if get_diverging() returns true. The midpoint should be inside the scales's domain.
| midpoint | The midpoint. |
Definition at line 73 of file color_scale.cxx.
References cgv::media::color_scale::modified().
|
virtual |
Set the exponent for power scales.
Only used if get_transform() returns ContinuousMappingTransform::kPow. Defaults to 1.
| exponent | The exponent. |
Definition at line 51 of file color_scale.cxx.
References cgv::media::color_scale::modified().
| void cgv::media::continuous_color_scale::set_scheme | ( | const continuous_color_scheme & | scheme | ) |
Set the color scheme used as this scale's color ramp.
| scheme | The color scheme. |
Definition at line 163 of file color_scale.cxx.
References cgv::media::color_scale::modified().
| void cgv::media::continuous_color_scale::set_transform | ( | ContinuousMappingTransform | transform | ) |
Set the transform used to map scalars to colors.
Power and log scales support negative domains. For scales with power or log transform and negative domains, input and output values are implicitly multiplied by -1. Log scale domains must be strictly-positive or strictly-negative; the domain must not include or cross zero. The behavior of the scale is undefined if a negative value is passed to a log scale with a positive domain or vice versa.
| transform | The transform type. |
Definition at line 45 of file color_scale.cxx.
References cgv::media::color_scale::modified().