Mercurial > hg > svgui
annotate layer/ColourMapper.h @ 1241:b7d3bd4ff43b
Overrides
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Wed, 22 Feb 2017 11:19:51 +0000 |
parents | 73d43e410a6b |
children | d79e21855aef |
rev | line source |
---|---|
Chris@376 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@376 | 2 |
Chris@376 | 3 /* |
Chris@376 | 4 Sonic Visualiser |
Chris@376 | 5 An audio file viewer and annotation editor. |
Chris@376 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@376 | 7 This file copyright 2006-2007 Chris Cannam and QMUL. |
Chris@376 | 8 |
Chris@376 | 9 This program is free software; you can redistribute it and/or |
Chris@376 | 10 modify it under the terms of the GNU General Public License as |
Chris@376 | 11 published by the Free Software Foundation; either version 2 of the |
Chris@376 | 12 License, or (at your option) any later version. See the file |
Chris@376 | 13 COPYING included with this distribution for more information. |
Chris@376 | 14 */ |
Chris@376 | 15 |
Chris@1199 | 16 #ifndef SV_COLOUR_MAPPER_H |
Chris@1199 | 17 #define SV_COLOUR_MAPPER_H |
Chris@376 | 18 |
Chris@376 | 19 #include <QObject> |
Chris@376 | 20 #include <QColor> |
Chris@376 | 21 #include <QString> |
Chris@1199 | 22 #include <QPixmap> |
Chris@376 | 23 |
Chris@376 | 24 /** |
Chris@376 | 25 * A class for mapping intensity values onto various colour maps. |
Chris@376 | 26 */ |
Chris@1071 | 27 class ColourMapper |
Chris@376 | 28 { |
Chris@376 | 29 public: |
Chris@902 | 30 ColourMapper(int map, double minValue, double maxValue); |
Chris@1071 | 31 ~ColourMapper(); |
Chris@1071 | 32 |
Chris@1071 | 33 ColourMapper(const ColourMapper &) = default; |
Chris@1071 | 34 ColourMapper &operator=(const ColourMapper &) = default; |
Chris@376 | 35 |
Chris@376 | 36 enum StandardMap { |
Chris@1017 | 37 Green, |
Chris@376 | 38 Sunset, |
Chris@376 | 39 WhiteOnBlack, |
Chris@376 | 40 BlackOnWhite, |
Chris@1017 | 41 Cherry, |
Chris@1017 | 42 Wasp, |
Chris@1017 | 43 Ice, |
Chris@376 | 44 FruitSalad, |
Chris@376 | 45 Banded, |
Chris@376 | 46 Highlight, |
Chris@536 | 47 Printer, |
Chris@1015 | 48 HighGain |
Chris@376 | 49 }; |
Chris@376 | 50 |
Chris@376 | 51 int getMap() const { return m_map; } |
Chris@902 | 52 double getMinValue() const { return m_min; } |
Chris@902 | 53 double getMaxValue() const { return m_max; } |
Chris@376 | 54 |
Chris@376 | 55 static int getColourMapCount(); |
Chris@376 | 56 static QString getColourMapName(int n); |
Chris@376 | 57 |
Chris@902 | 58 QColor map(double value) const; |
Chris@376 | 59 |
Chris@376 | 60 QColor getContrastingColour() const; // for cursors etc |
Chris@376 | 61 bool hasLightBackground() const; |
Chris@376 | 62 |
Chris@1199 | 63 QPixmap getExamplePixmap(QSize size) const; |
Chris@1199 | 64 |
Chris@376 | 65 protected: |
Chris@376 | 66 int m_map; |
Chris@902 | 67 double m_min; |
Chris@902 | 68 double m_max; |
Chris@376 | 69 }; |
Chris@376 | 70 |
Chris@376 | 71 #endif |
Chris@376 | 72 |