annotate 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
rev   line source
Chris@277 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@277 2
Chris@277 3 /*
Chris@277 4 Sonic Visualiser
Chris@277 5 An audio file viewer and annotation editor.
Chris@277 6 Centre for Digital Music, Queen Mary, University of London.
Chris@277 7 This file copyright 2006-2007 Chris Cannam and QMUL.
Chris@277 8
Chris@277 9 This program is free software; you can redistribute it and/or
Chris@277 10 modify it under the terms of the GNU General Public License as
Chris@277 11 published by the Free Software Foundation; either version 2 of the
Chris@277 12 License, or (at your option) any later version. See the file
Chris@277 13 COPYING included with this distribution for more information.
Chris@277 14 */
Chris@277 15
Chris@277 16 #ifndef _COLOUR_MAPPER_H_
Chris@277 17 #define _COLOUR_MAPPER_H_
Chris@277 18
Chris@277 19 #include <QObject>
Chris@277 20 #include <QColor>
Chris@277 21 #include <QString>
Chris@277 22
Chris@277 23 /**
Chris@277 24 * A class for mapping intensity values onto various colour maps.
Chris@277 25 */
Chris@277 26
Chris@277 27 class ColourMapper : public QObject
Chris@277 28 {
Chris@277 29 Q_OBJECT
Chris@277 30
Chris@277 31 public:
Chris@277 32 ColourMapper(int map, float minValue, float maxValue);
Chris@277 33 virtual ~ColourMapper();
Chris@277 34
Chris@277 35 enum StandardMap {
Chris@277 36 DefaultColours,
Chris@277 37 Sunset,
Chris@277 38 WhiteOnBlack,
Chris@277 39 BlackOnWhite,
Chris@277 40 RedOnBlue,
Chris@277 41 YellowOnBlack,
Chris@277 42 BlueOnBlack,
Chris@277 43 FruitSalad,
Chris@277 44 Banded,
Chris@277 45 Highlight,
Chris@277 46 Printer
Chris@277 47 };
Chris@277 48
Chris@277 49 int getMap() const { return m_map; }
Chris@277 50 float getMinValue() const { return m_min; }
Chris@277 51 float getMaxValue() const { return m_max; }
Chris@277 52
Chris@277 53 static int getColourMapCount();
Chris@277 54 static QString getColourMapName(int n);
Chris@277 55
Chris@277 56 QColor map(float value) const;
Chris@277 57
Chris@277 58 QColor getContrastingColour() const; // for cursors etc
Chris@277 59 bool hasLightBackground() const;
Chris@277 60
Chris@277 61 protected:
Chris@277 62 int m_map;
Chris@277 63 float m_min;
Chris@277 64 float m_max;
Chris@277 65 };
Chris@277 66
Chris@277 67 #endif
Chris@277 68