svgui  1.9
ColourMapper.h
Go to the documentation of this file.
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 
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 {
48  };
49 
50  int getMap() const { return m_map; }
51  float getMinValue() const { return m_min; }
52  float getMaxValue() const { return m_max; }
53 
54  static int getColourMapCount();
55  static QString getColourMapName(int n);
56 
57  QColor map(float value) const;
58 
59  QColor getContrastingColour() const; // for cursors etc
60  bool hasLightBackground() const;
61 
62 protected:
63  int m_map;
64  float m_min;
65  float m_max;
66 };
67 
68 #endif
69 
float getMinValue() const
Definition: ColourMapper.h:51
int getMap() const
Definition: ColourMapper.h:50
static int getColourMapCount()
virtual ~ColourMapper()
A class for mapping intensity values onto various colour maps.
Definition: ColourMapper.h:27
QColor map(float value) const
QColor getContrastingColour() const
ColourMapper(int map, float minValue, float maxValue)
bool hasLightBackground() const
float getMaxValue() const
Definition: ColourMapper.h:52
static QString getColourMapName(int n)