Mercurial > hg > svgui
comparison layer/ColourMapper.cpp @ 536:aca01b3af29f
* Add High Gain colour map
author | Chris Cannam |
---|---|
date | Fri, 22 May 2009 15:50:10 +0000 |
parents | e1a9e478b7f2 |
children | 1a0dfcbffaf1 |
comparison
equal
deleted
inserted
replaced
535:78f9436195b1 | 536:aca01b3af29f |
---|---|
37 } | 37 } |
38 | 38 |
39 int | 39 int |
40 ColourMapper::getColourMapCount() | 40 ColourMapper::getColourMapCount() |
41 { | 41 { |
42 return 11; | 42 return 12; |
43 } | 43 } |
44 | 44 |
45 QString | 45 QString |
46 ColourMapper::getColourMapName(int n) | 46 ColourMapper::getColourMapName(int n) |
47 { | 47 { |
58 case Sunset: return tr("Sunset"); | 58 case Sunset: return tr("Sunset"); |
59 case FruitSalad: return tr("Fruit Salad"); | 59 case FruitSalad: return tr("Fruit Salad"); |
60 case Banded: return tr("Banded"); | 60 case Banded: return tr("Banded"); |
61 case Highlight: return tr("Highlight"); | 61 case Highlight: return tr("Highlight"); |
62 case Printer: return tr("Printer"); | 62 case Printer: return tr("Printer"); |
63 case HighGain: return tr("High Gain"); | |
63 } | 64 } |
64 | 65 |
65 return tr("<unknown>"); | 66 return tr("<unknown>"); |
66 } | 67 } |
67 | 68 |
178 r = 0.f; | 179 r = 0.f; |
179 } | 180 } |
180 r = g = b = 1.f - r; | 181 r = g = b = 1.f - r; |
181 hsv = false; | 182 hsv = false; |
182 break; | 183 break; |
184 | |
185 case HighGain: | |
186 if (norm <= 1.f / 256.f) { | |
187 norm = 0.f; | |
188 } else { | |
189 norm = 0.1f + (powf(((norm - 0.5f) * 2.f), 3.f) + 1.f) / 2.081f; | |
190 } | |
191 // now as for Sunset | |
192 r = (norm - 0.24f) * 2.38f; | |
193 if (r > 1.f) r = 1.f; | |
194 if (r < 0.f) r = 0.f; | |
195 g = (norm - 0.64f) * 2.777f; | |
196 if (g > 1.f) g = 1.f; | |
197 if (g < 0.f) g = 0.f; | |
198 b = (3.6f * norm); | |
199 if (norm > 0.277f) b = 2.f - b; | |
200 if (b > 1.f) b = 1.f; | |
201 if (b < 0.f) b = 0.f; | |
202 hsv = false; | |
203 /* | |
204 if (r > 1.f) r = 1.f; | |
205 r = g = b = 1.f - r; | |
206 hsv = false; | |
207 */ | |
208 break; | |
183 } | 209 } |
184 | 210 |
185 if (hsv) { | 211 if (hsv) { |
186 return QColor::fromHsvF(h, s, v); | 212 return QColor::fromHsvF(h, s, v); |
187 } else { | 213 } else { |
227 case Highlight: | 253 case Highlight: |
228 return Qt::red; | 254 return Qt::red; |
229 | 255 |
230 case Printer: | 256 case Printer: |
231 return Qt::red; | 257 return Qt::red; |
258 | |
259 case HighGain: | |
260 return Qt::red; | |
232 } | 261 } |
233 | 262 |
234 return Qt::white; | 263 return Qt::white; |
235 } | 264 } |
236 | 265 |
242 | 271 |
243 switch (map) { | 272 switch (map) { |
244 | 273 |
245 case BlackOnWhite: | 274 case BlackOnWhite: |
246 case Printer: | 275 case Printer: |
276 case HighGain: | |
247 return true; | 277 return true; |
248 | 278 |
249 default: | 279 default: |
250 return false; | 280 return false; |
251 } | 281 } |