comparison layer/ColourScale.h @ 1079:7ebfb61b1701 spectrogram-minor-refactor

More filling in render & cache code
author Chris Cannam
date Thu, 30 Jun 2016 15:46:14 +0100
parents 65b183494331
children ea5ae9dd10ba
comparison
equal deleted inserted replaced
1078:ee01a4062747 1079:7ebfb61b1701
70 ColourScale(Parameters parameters); 70 ColourScale(Parameters parameters);
71 ~ColourScale(); 71 ~ColourScale();
72 72
73 ColourScale(const ColourScale &) = default; 73 ColourScale(const ColourScale &) = default;
74 ColourScale &operator=(const ColourScale &) = default; 74 ColourScale &operator=(const ColourScale &) = default;
75
76 /**
77 * Return the general type of scale this is.
78 */
79 Scale getScale() const;
75 80
76 /** 81 /**
77 * Return a pixel number (in the range 0-255 inclusive) 82 * Return a pixel number (in the range 0-255 inclusive)
78 * 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
79 * values below the threshold supplied in the constructor. All 84 * values below the threshold supplied in the constructor. All
80 * other values are mapped onto the range 1-255. 85 * other values are mapped onto the range 1-255.
81 */ 86 */
82 int getPixel(double value); 87 int getPixel(double value) const;
83 88
84 /** 89 /**
85 * Return the colour for the given pixel number (which must be in 90 * Return the colour for the given pixel number (which must be in
86 * the range 0-255). The pixel 0 is always the background 91 * the range 0-255). The pixel 0 is always the background
87 * colour. Other pixels are mapped taking into account the given 92 * colour. Other pixels are mapped taking into account the given
88 * colourmap rotation (which is also a value in the range 0-255). 93 * colourmap rotation (which is also a value in the range 0-255).
89 */ 94 */
90 QColor getColourForPixel(int pixel, int rotation); 95 QColor getColourForPixel(int pixel, int rotation) const;
91 96
92 /** 97 /**
93 * Return the colour corresponding to the given value. This is 98 * Return the colour corresponding to the given value. This is
94 * equivalent to getColourForPixel(getPixel(value), rotation). 99 * equivalent to getColourForPixel(getPixel(value), rotation).
95 */ 100 */
96 QColor getColour(double value, int rotation) { 101 QColor getColour(double value, int rotation) const {
97 return getColourForPixel(getPixel(value), rotation); 102 return getColourForPixel(getPixel(value), rotation);
98 } 103 }
99 104
100 private: 105 private:
101 Parameters m_params; 106 Parameters m_params;