Mercurial > hg > svgui
comparison layer/ColourScale.h @ 1105:ea5ae9dd10ba spectrogram-minor-refactor
Convert ColourScaleType into an enum class
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2016 16:52:16 +0100 |
parents | 7ebfb61b1701 |
children | 4e7ed3252d80 |
comparison
equal
deleted
inserted
replaced
1104:46cc4644206d | 1105:ea5ae9dd10ba |
---|---|
16 #ifndef COLOUR_SCALE_H | 16 #ifndef COLOUR_SCALE_H |
17 #define COLOUR_SCALE_H | 17 #define COLOUR_SCALE_H |
18 | 18 |
19 #include "ColourMapper.h" | 19 #include "ColourMapper.h" |
20 | 20 |
21 enum class ColourScaleType { | |
22 Linear, | |
23 Meter, | |
24 Log, | |
25 Phase, | |
26 PlusMinusOne, | |
27 Absolute | |
28 }; | |
29 | |
21 /** | 30 /** |
22 * Map values within a range onto a set of colours, with a given | 31 * Map values within a range onto a set of colours, with a given |
23 * distribution (linear, log etc) and optional colourmap rotation. | 32 * distribution (linear, log etc) and optional colourmap rotation. |
24 */ | 33 */ |
25 class ColourScale | 34 class ColourScale |
26 { | 35 { |
27 public: | 36 public: |
28 enum Scale { | |
29 LinearColourScale, | |
30 MeterColourScale, | |
31 LogColourScale, | |
32 PhaseColourScale, | |
33 PlusMinusOneScale, | |
34 AbsoluteScale | |
35 }; | |
36 | |
37 struct Parameters { | 37 struct Parameters { |
38 Parameters() : colourMap(0), scale(LinearColourScale), | 38 Parameters() : colourMap(0), scale(ColourScaleType::Linear), |
39 minValue(0.0), maxValue(1.0), | 39 minValue(0.0), maxValue(1.0), |
40 threshold(0.0), gain(1.0) { } | 40 threshold(0.0), gain(1.0) { } |
41 | 41 |
42 /** A colour map index as used by ColourMapper */ | 42 /** A colour map index as used by ColourMapper */ |
43 int colourMap; | 43 int colourMap; |
44 | 44 |
45 /** Distribution for the scale */ | 45 /** Distribution for the scale */ |
46 Scale scale; | 46 ColourScaleType scale; |
47 | 47 |
48 /** Minimum value in source range */ | 48 /** Minimum value in source range */ |
49 double minValue; | 49 double minValue; |
50 | 50 |
51 /** Maximum value in source range. Must be > minValue */ | 51 /** Maximum value in source range. Must be > minValue */ |
74 ColourScale &operator=(const ColourScale &) = default; | 74 ColourScale &operator=(const ColourScale &) = default; |
75 | 75 |
76 /** | 76 /** |
77 * Return the general type of scale this is. | 77 * Return the general type of scale this is. |
78 */ | 78 */ |
79 Scale getScale() const; | 79 ColourScaleType getScale() const; |
80 | 80 |
81 /** | 81 /** |
82 * Return a pixel number (in the range 0-255 inclusive) | 82 * Return a pixel number (in the range 0-255 inclusive) |
83 * corresponding to the given value. The pixel 0 is used only for | 83 * corresponding to the given value. The pixel 0 is used only for |
84 * values below the threshold supplied in the constructor. All | 84 * values below the threshold supplied in the constructor. All |