comparison layer/ColourMapper.h @ 196:22c99c8aa1e0

* Add separate colour mapping unit; use it in spectrogram (colour 3d plot to follow) * Add another colour scheme resembling that of a noted commercial application
author Chris Cannam
date Wed, 31 Jan 2007 12:13:47 +0000
parents
children 6b023411087b
comparison
equal deleted inserted replaced
195:4a3bdde1ef13 196:22c99c8aa1e0
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006-2007 Chris Cannam and QMUL.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _COLOUR_MAPPER_H_
17 #define _COLOUR_MAPPER_H_
18
19 #include <QObject>
20 #include <QColor>
21 #include <QString>
22
23 /**
24 * A class for mapping intensity values onto various colour maps.
25 */
26
27 class ColourMapper : public QObject
28 {
29 public:
30 ColourMapper(int map, float minValue, float maxValue);
31 virtual ~ColourMapper();
32
33 enum StandardMap {
34 DefaultColours,
35 Sunset,
36 WhiteOnBlack,
37 BlackOnWhite,
38 RedOnBlue,
39 YellowOnBlack,
40 BlueOnBlack,
41 FruitSalad
42 };
43
44 int getMap() const { return m_map; }
45 float getMinValue() const { return m_min; }
46 float getMaxValue() const { return m_max; }
47
48 static int getColourMapCount();
49 static QString getColourMapName(int n);
50
51 QColor map(float value) const;
52
53 QColor getContrastingColour() const; // for cursors etc
54
55 protected:
56 int m_map;
57 float m_min;
58 float m_max;
59 };
60
61 #endif
62