Chris@196: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@196: Chris@196: /* Chris@196: Sonic Visualiser Chris@196: An audio file viewer and annotation editor. Chris@196: Centre for Digital Music, Queen Mary, University of London. Chris@196: This file copyright 2006-2007 Chris Cannam and QMUL. Chris@196: Chris@196: This program is free software; you can redistribute it and/or Chris@196: modify it under the terms of the GNU General Public License as Chris@196: published by the Free Software Foundation; either version 2 of the Chris@196: License, or (at your option) any later version. See the file Chris@196: COPYING included with this distribution for more information. Chris@196: */ Chris@196: Chris@196: #ifndef _COLOUR_MAPPER_H_ Chris@196: #define _COLOUR_MAPPER_H_ Chris@196: Chris@196: #include Chris@196: #include Chris@196: #include Chris@196: Chris@196: /** Chris@196: * A class for mapping intensity values onto various colour maps. Chris@196: */ Chris@196: Chris@196: class ColourMapper : public QObject Chris@196: { Chris@222: Q_OBJECT Chris@222: Chris@196: public: Chris@196: ColourMapper(int map, float minValue, float maxValue); Chris@196: virtual ~ColourMapper(); Chris@196: Chris@196: enum StandardMap { Chris@196: DefaultColours, Chris@196: Sunset, Chris@196: WhiteOnBlack, Chris@196: BlackOnWhite, Chris@196: RedOnBlue, Chris@196: YellowOnBlack, Chris@196: BlueOnBlack, Chris@197: FruitSalad, Chris@197: Banded, Chris@197: Highlight Chris@196: }; Chris@196: Chris@196: int getMap() const { return m_map; } Chris@196: float getMinValue() const { return m_min; } Chris@196: float getMaxValue() const { return m_max; } Chris@196: Chris@196: static int getColourMapCount(); Chris@196: static QString getColourMapName(int n); Chris@196: Chris@196: QColor map(float value) const; Chris@196: Chris@196: QColor getContrastingColour() const; // for cursors etc Chris@196: Chris@196: protected: Chris@196: int m_map; Chris@196: float m_min; Chris@196: float m_max; Chris@196: }; Chris@196: Chris@196: #endif Chris@196: