annotate layer/ColourMapper.h @ 1024:3bce4c45b681
spectrogram-minor-refactor
Rearrange cache update calculations so as to use the actual painted width returned by paint functions (though they only ever return the same width as requested, at this point)
author |
Chris Cannam |
date |
Mon, 25 Jan 2016 15:52:26 +0000 |
parents |
9c890b7dfa83 |
children |
65b183494331 |
rev |
line source |
Chris@376
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@376
|
2
|
Chris@376
|
3 /*
|
Chris@376
|
4 Sonic Visualiser
|
Chris@376
|
5 An audio file viewer and annotation editor.
|
Chris@376
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@376
|
7 This file copyright 2006-2007 Chris Cannam and QMUL.
|
Chris@376
|
8
|
Chris@376
|
9 This program is free software; you can redistribute it and/or
|
Chris@376
|
10 modify it under the terms of the GNU General Public License as
|
Chris@376
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@376
|
12 License, or (at your option) any later version. See the file
|
Chris@376
|
13 COPYING included with this distribution for more information.
|
Chris@376
|
14 */
|
Chris@376
|
15
|
Chris@376
|
16 #ifndef _COLOUR_MAPPER_H_
|
Chris@376
|
17 #define _COLOUR_MAPPER_H_
|
Chris@376
|
18
|
Chris@376
|
19 #include <QObject>
|
Chris@376
|
20 #include <QColor>
|
Chris@376
|
21 #include <QString>
|
Chris@376
|
22
|
Chris@376
|
23 /**
|
Chris@376
|
24 * A class for mapping intensity values onto various colour maps.
|
Chris@376
|
25 */
|
Chris@376
|
26
|
Chris@376
|
27 class ColourMapper : public QObject
|
Chris@376
|
28 {
|
Chris@376
|
29 Q_OBJECT
|
Chris@376
|
30
|
Chris@376
|
31 public:
|
Chris@902
|
32 ColourMapper(int map, double minValue, double maxValue);
|
Chris@376
|
33 virtual ~ColourMapper();
|
Chris@376
|
34
|
Chris@376
|
35 enum StandardMap {
|
Chris@1017
|
36 Green,
|
Chris@376
|
37 Sunset,
|
Chris@376
|
38 WhiteOnBlack,
|
Chris@376
|
39 BlackOnWhite,
|
Chris@1017
|
40 Cherry,
|
Chris@1017
|
41 Wasp,
|
Chris@1017
|
42 Ice,
|
Chris@376
|
43 FruitSalad,
|
Chris@376
|
44 Banded,
|
Chris@376
|
45 Highlight,
|
Chris@536
|
46 Printer,
|
Chris@1015
|
47 HighGain
|
Chris@376
|
48 };
|
Chris@376
|
49
|
Chris@376
|
50 int getMap() const { return m_map; }
|
Chris@902
|
51 double getMinValue() const { return m_min; }
|
Chris@902
|
52 double getMaxValue() const { return m_max; }
|
Chris@376
|
53
|
Chris@376
|
54 static int getColourMapCount();
|
Chris@376
|
55 static QString getColourMapName(int n);
|
Chris@376
|
56
|
Chris@902
|
57 QColor map(double value) const;
|
Chris@376
|
58
|
Chris@376
|
59 QColor getContrastingColour() const; // for cursors etc
|
Chris@376
|
60 bool hasLightBackground() const;
|
Chris@376
|
61
|
Chris@376
|
62 protected:
|
Chris@376
|
63 int m_map;
|
Chris@902
|
64 double m_min;
|
Chris@902
|
65 double m_max;
|
Chris@376
|
66 };
|
Chris@376
|
67
|
Chris@376
|
68 #endif
|
Chris@376
|
69
|