comparison layer/ColourMapper.cpp @ 1017:9c890b7dfa83 colourschemes

Add default spectrogram colours to prefs
author Chris Cannam
date Wed, 20 Jan 2016 11:43:16 +0000
parents 6a8084c72e7a
children 65b183494331
comparison
equal deleted inserted replaced
1016:6a8084c72e7a 1017:9c890b7dfa83
31 for (const auto &s: strs) converted.push_back(QColor(s)); 31 for (const auto &s: strs) converted.push_back(QColor(s));
32 reverse(converted.begin(), converted.end()); 32 reverse(converted.begin(), converted.end());
33 return converted; 33 return converted;
34 } 34 }
35 35
36 static vector<QColor> xRay = convertStrings({ 36 static vector<QColor> ice = convertStrings({
37 // Based on ColorBrewer ylGnBu 37 // Based on ColorBrewer ylGnBu
38 "#ffffff", "#ffff00", "#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", 38 "#ffffff", "#ffff00", "#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5",
39 "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081", "#042040" 39 "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081", "#042040"
40 }); 40 });
41 41
42 static vector<QColor> cherryPie = convertStrings({ 42 static vector<QColor> cherry = convertStrings({
43 "#f7f7f7", "#fddbc7", "#f4a582", "#d6604d", "#b2182b", "#dd3497", 43 "#f7f7f7", "#fddbc7", "#f4a582", "#d6604d", "#b2182b", "#dd3497",
44 "#ae017e", "#7a0177", "#49006a" 44 "#ae017e", "#7a0177", "#49006a"
45 }); 45 });
46 46
47 static void 47 static void
87 { 87 {
88 if (n >= getColourMapCount()) return tr("<unknown>"); 88 if (n >= getColourMapCount()) return tr("<unknown>");
89 StandardMap map = (StandardMap)n; 89 StandardMap map = (StandardMap)n;
90 90
91 switch (map) { 91 switch (map) {
92 case DefaultColours: return tr("Green"); 92 case Green: return tr("Green");
93 case WhiteOnBlack: return tr("White on Black"); 93 case WhiteOnBlack: return tr("White on Black");
94 case BlackOnWhite: return tr("Black on White"); 94 case BlackOnWhite: return tr("Black on White");
95 case CherryPie: return tr("Cherry"); 95 case Cherry: return tr("Cherry");
96 case YellowOnBlack: return tr("Wasp"); 96 case Wasp: return tr("Wasp");
97 case XRay: return tr("X-Ray"); 97 case Ice: return tr("Ice");
98 case Sunset: return tr("Sunset"); 98 case Sunset: return tr("Sunset");
99 case FruitSalad: return tr("Fruit Salad"); 99 case FruitSalad: return tr("Fruit Salad");
100 case Banded: return tr("Banded"); 100 case Banded: return tr("Banded");
101 case Highlight: return tr("Highlight"); 101 case Highlight: return tr("Highlight");
102 case Printer: return tr("Printer"); 102 case Printer: return tr("Printer");
121 if (m_map >= getColourMapCount()) return Qt::black; 121 if (m_map >= getColourMapCount()) return Qt::black;
122 StandardMap map = (StandardMap)m_map; 122 StandardMap map = (StandardMap)m_map;
123 123
124 switch (map) { 124 switch (map) {
125 125
126 case DefaultColours: 126 case Green:
127 h = blue - norm * 2.0 * pieslice; 127 h = blue - norm * 2.0 * pieslice;
128 s = 0.5f + norm/2.0; 128 s = 0.5f + norm/2.0;
129 v = norm; 129 v = norm;
130 break; 130 break;
131 131
137 case BlackOnWhite: 137 case BlackOnWhite:
138 r = g = b = 1.0 - norm; 138 r = g = b = 1.0 - norm;
139 hsv = false; 139 hsv = false;
140 break; 140 break;
141 141
142 case CherryPie: 142 case Cherry:
143 hsv = false; 143 hsv = false;
144 mapDiscrete(norm, cherryPie, r, g, b); 144 mapDiscrete(norm, cherry, r, g, b);
145 break; 145 break;
146 146
147 case YellowOnBlack: 147 case Wasp:
148 h = 0.15; 148 h = 0.15;
149 s = 1.0; 149 s = 1.0;
150 v = norm; 150 v = norm;
151 break; 151 break;
152 152
231 r = g = b = 1.0 - r; 231 r = g = b = 1.0 - r;
232 hsv = false; 232 hsv = false;
233 */ 233 */
234 break; 234 break;
235 235
236 case XRay: 236 case Ice:
237 hsv = false; 237 hsv = false;
238 mapDiscrete(norm, xRay, r, g, b); 238 mapDiscrete(norm, ice, r, g, b);
239 } 239 }
240 240
241 if (hsv) { 241 if (hsv) {
242 return QColor::fromHsvF(h, s, v); 242 return QColor::fromHsvF(h, s, v);
243 } else { 243 } else {
251 if (m_map >= getColourMapCount()) return Qt::white; 251 if (m_map >= getColourMapCount()) return Qt::white;
252 StandardMap map = (StandardMap)m_map; 252 StandardMap map = (StandardMap)m_map;
253 253
254 switch (map) { 254 switch (map) {
255 255
256 case DefaultColours: 256 case Green:
257 return QColor(255, 150, 50); 257 return QColor(255, 150, 50);
258 258
259 case WhiteOnBlack: 259 case WhiteOnBlack:
260 return Qt::red; 260 return Qt::red;
261 261
262 case BlackOnWhite: 262 case BlackOnWhite:
263 return Qt::darkGreen; 263 return Qt::darkGreen;
264 264
265 case CherryPie: 265 case Cherry:
266 return Qt::green; 266 return Qt::green;
267 267
268 case YellowOnBlack: 268 case Wasp:
269 return QColor::fromHsv(240, 255, 255); 269 return QColor::fromHsv(240, 255, 255);
270 270
271 case XRay: 271 case Ice:
272 return Qt::red; 272 return Qt::red;
273 273
274 case Sunset: 274 case Sunset:
275 return Qt::white; 275 return Qt::white;
276 276
304 case BlackOnWhite: 304 case BlackOnWhite:
305 case Printer: 305 case Printer:
306 case HighGain: 306 case HighGain:
307 return true; 307 return true;
308 308
309 case DefaultColours: 309 case Green:
310 case Sunset: 310 case Sunset:
311 case WhiteOnBlack: 311 case WhiteOnBlack:
312 case CherryPie: 312 case Cherry:
313 case YellowOnBlack: 313 case Wasp:
314 case XRay: 314 case Ice:
315 case FruitSalad: 315 case FruitSalad:
316 case Banded: 316 case Banded:
317 case Highlight: 317 case Highlight:
318 318
319 default: 319 default: