Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.h @ 1125:50324fca1328 spectrogram-minor-refactor
Scale range matching
author | Chris Cannam |
---|---|
date | Mon, 01 Aug 2016 15:06:16 +0100 |
parents | 94370157b265 |
children | 998e31e92dbe |
comparison
equal
deleted
inserted
replaced
1124:b71a0491d287 | 1125:50324fca1328 |
---|---|
62 colourScale(ColourScale::Parameters()), | 62 colourScale(ColourScale::Parameters()), |
63 normalization(ColumnNormalization::None), | 63 normalization(ColumnNormalization::None), |
64 binDisplay(BinDisplay::AllBins), | 64 binDisplay(BinDisplay::AllBins), |
65 binScale(BinScale::Linear), | 65 binScale(BinScale::Linear), |
66 alwaysOpaque(false), | 66 alwaysOpaque(false), |
67 interpolate(false), //!!! separate out x-interpolate and y-interpolate? the spectrogram actually does (or used to) | 67 interpolate(false), |
68 invertVertical(false), | 68 invertVertical(false), |
69 scaleFactor(1.0), | |
69 colourRotation(0) { } | 70 colourRotation(0) { } |
70 | 71 |
71 ColourScale colourScale; // complete ColourScale object by value | 72 /** A complete ColourScale object by value, used for colour |
73 * map conversion. Note that the final display gain setting is | |
74 * also encapsulated here. */ | |
75 ColourScale colourScale; | |
76 | |
77 /** Type of column normalization. */ | |
72 ColumnNormalization normalization; | 78 ColumnNormalization normalization; |
79 | |
80 /** Selection of bins to display. */ | |
73 BinDisplay binDisplay; | 81 BinDisplay binDisplay; |
82 | |
83 /** Scale for vertical bin spacing (linear or logarithmic). */ | |
74 BinScale binScale; | 84 BinScale binScale; |
85 | |
86 /** Whether cells should always be opaque. If false, then | |
87 * large cells (when zoomed in a long way) will be rendered | |
88 * translucent in order not to obscure anything in a layer | |
89 * beneath. */ | |
75 bool alwaysOpaque; | 90 bool alwaysOpaque; |
91 | |
92 /** Whether to apply smoothing when rendering cells at more | |
93 * than one pixel per cell. !!! todo: decide about separating | |
94 * out x-interpolate and y-interpolate as the spectrogram | |
95 * actually does (or used to) | |
96 */ | |
76 bool interpolate; | 97 bool interpolate; |
98 | |
99 /** Whether to render the whole caboodle upside-down. */ | |
77 bool invertVertical; | 100 bool invertVertical; |
101 | |
102 /** Initial scale factor (e.g. for FFT scaling). This factor | |
103 * is applied to all values read from the underlying model | |
104 * *before* magnitude ranges are calculated, in contrast to | |
105 * the display gain found in the ColourScale parameter. */ | |
106 double scaleFactor; | |
107 | |
108 /** Colourmap rotation, in the range 0-255. */ | |
78 int colourRotation; | 109 int colourRotation; |
79 }; | 110 }; |
80 | 111 |
81 Colour3DPlotRenderer(Sources sources, Parameters parameters) : | 112 Colour3DPlotRenderer(Sources sources, Parameters parameters) : |
82 m_sources(sources), | 113 m_sources(sources), |
119 * std::logic_error exception. The model must be ready and the | 150 * std::logic_error exception. The model must be ready and the |
120 * layer requesting the render must not be dormant in its view, so | 151 * layer requesting the render must not be dormant in its view, so |
121 * that the LayerGeometryProvider returns valid results; it is the | 152 * that the LayerGeometryProvider returns valid results; it is the |
122 * caller's responsibility to ensure these. | 153 * caller's responsibility to ensure these. |
123 */ | 154 */ |
124 RenderResult render(const LayerGeometryProvider *v, QPainter &paint, QRect rect); | 155 RenderResult render(const LayerGeometryProvider *v, |
156 QPainter &paint, QRect rect); | |
125 | 157 |
126 /** | 158 /** |
127 * Render the requested area using the given painter, obtaining | 159 * Render the requested area using the given painter, obtaining |
128 * geometry (e.g. start frame) from the stored | 160 * geometry (e.g. start frame) from the stored |
129 * LayerGeometryProvider. | 161 * LayerGeometryProvider. |
180 */ | 212 */ |
181 bool willRenderOpaque(const LayerGeometryProvider *v) { | 213 bool willRenderOpaque(const LayerGeometryProvider *v) { |
182 return decideRenderType(v) != DirectTranslucent; | 214 return decideRenderType(v) != DirectTranslucent; |
183 } | 215 } |
184 | 216 |
217 /** | |
218 * Return the colour corresponding to the given value. | |
219 * \see ColourScale::getPixel | |
220 * \see ColourScale::getColour | |
221 */ | |
222 QColor getColour(double value) const { | |
223 return m_params.colourScale.getColour(value, m_params.colourRotation); | |
224 } | |
225 | |
185 private: | 226 private: |
186 Sources m_sources; | 227 Sources m_sources; |
187 Parameters m_params; | 228 Parameters m_params; |
188 | 229 |
189 // Draw buffer is the target of each partial repaint. It is always | 230 // Draw buffer is the target of each partial repaint. It is always |