annotate layer/ColourMapper.h @ 196:22c99c8aa1e0

* Add separate colour mapping unit; use it in spectrogram (colour 3d plot to follow) * Add another colour scheme resembling that of a noted commercial application
author Chris Cannam
date Wed, 31 Jan 2007 12:13:47 +0000
parents
children 6b023411087b
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@196 29 public:
Chris@196 30 ColourMapper(int map, float minValue, float maxValue);
Chris@196 31 virtual ~ColourMapper();
Chris@196 32
Chris@196 33 enum StandardMap {
Chris@196 34 DefaultColours,
Chris@196 35 Sunset,
Chris@196 36 WhiteOnBlack,
Chris@196 37 BlackOnWhite,
Chris@196 38 RedOnBlue,
Chris@196 39 YellowOnBlack,
Chris@196 40 BlueOnBlack,
Chris@196 41 FruitSalad
Chris@196 42 };
Chris@196 43
Chris@196 44 int getMap() const { return m_map; }
Chris@196 45 float getMinValue() const { return m_min; }
Chris@196 46 float getMaxValue() const { return m_max; }
Chris@196 47
Chris@196 48 static int getColourMapCount();
Chris@196 49 static QString getColourMapName(int n);
Chris@196 50
Chris@196 51 QColor map(float value) const;
Chris@196 52
Chris@196 53 QColor getContrastingColour() const; // for cursors etc
Chris@196 54
Chris@196 55 protected:
Chris@196 56 int m_map;
Chris@196 57 float m_min;
Chris@196 58 float m_max;
Chris@196 59 };
Chris@196 60
Chris@196 61 #endif
Chris@196 62