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@1199: #ifndef SV_COLOUR_MAPPER_H Chris@1199: #define SV_COLOUR_MAPPER_H Chris@376: Chris@376: #include Chris@376: #include Chris@376: #include Chris@1199: #include Chris@376: Chris@376: /** Chris@376: * A class for mapping intensity values onto various colour maps. Chris@376: */ Chris@1071: class ColourMapper Chris@376: { Chris@376: public: Chris@902: ColourMapper(int map, double minValue, double maxValue); Chris@1071: ~ColourMapper(); Chris@1071: Chris@1071: ColourMapper(const ColourMapper &) = default; Chris@1071: ColourMapper &operator=(const ColourMapper &) = default; Chris@376: Chris@376: enum StandardMap { Chris@1017: Green, Chris@376: Sunset, Chris@376: WhiteOnBlack, Chris@376: BlackOnWhite, Chris@1017: Cherry, Chris@1017: Wasp, Chris@1017: Ice, Chris@376: FruitSalad, Chris@376: Banded, Chris@376: Highlight, Chris@536: Printer, Chris@1015: HighGain Chris@376: }; Chris@376: Chris@376: int getMap() const { return m_map; } Chris@902: double getMinValue() const { return m_min; } Chris@902: double getMaxValue() const { return m_max; } Chris@376: Chris@376: static int getColourMapCount(); Chris@376: static QString getColourMapName(int n); Chris@376: Chris@902: QColor map(double value) const; Chris@376: Chris@376: QColor getContrastingColour() const; // for cursors etc Chris@376: bool hasLightBackground() const; Chris@376: Chris@1199: QPixmap getExamplePixmap(QSize size) const; Chris@1199: Chris@376: protected: Chris@376: int m_map; Chris@902: double m_min; Chris@902: double m_max; Chris@376: }; Chris@376: Chris@376: #endif Chris@376: