annotate layer/ColourMapper.h @ 235:efadb9d2b2c6

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