comparison base/ColourMapper.h @ 277:3b8008d09541

* Add a colour database, and Add New Colour function to the colour combo in property box. The colour property is only correctly handled in the waveform layer so far. * Add en_GB translation, to translate those annoying Color texts in the Qt colour picker dialog.
author Chris Cannam
date Wed, 11 Jul 2007 17:21:37 +0000
parents
children
comparison
equal deleted inserted replaced
276:657825878970 277:3b8008d09541
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 Q_OBJECT
30
31 public:
32 ColourMapper(int map, float minValue, float maxValue);
33 virtual ~ColourMapper();
34
35 enum StandardMap {
36 DefaultColours,
37 Sunset,
38 WhiteOnBlack,
39 BlackOnWhite,
40 RedOnBlue,
41 YellowOnBlack,
42 BlueOnBlack,
43 FruitSalad,
44 Banded,
45 Highlight,
46 Printer
47 };
48
49 int getMap() const { return m_map; }
50 float getMinValue() const { return m_min; }
51 float getMaxValue() const { return m_max; }
52
53 static int getColourMapCount();
54 static QString getColourMapName(int n);
55
56 QColor map(float value) const;
57
58 QColor getContrastingColour() const; // for cursors etc
59 bool hasLightBackground() const;
60
61 protected:
62 int m_map;
63 float m_min;
64 float m_max;
65 };
66
67 #endif
68