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