ColourMapper.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006-2007 Chris Cannam and QMUL.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #ifndef _COLOUR_MAPPER_H_
00017 #define _COLOUR_MAPPER_H_
00018 
00019 #include <QObject>
00020 #include <QColor>
00021 #include <QString>
00022 
00027 class ColourMapper : public QObject
00028 {
00029     Q_OBJECT
00030 
00031 public:
00032     ColourMapper(int map, float minValue, float maxValue);
00033     virtual ~ColourMapper();
00034 
00035     enum StandardMap {
00036         DefaultColours,
00037         Sunset,
00038         WhiteOnBlack,
00039         BlackOnWhite,
00040         RedOnBlue,
00041         YellowOnBlack,
00042         BlueOnBlack,
00043         FruitSalad,
00044         Banded,
00045         Highlight,
00046         Printer
00047     };
00048 
00049     int getMap() const { return m_map; }
00050     float getMinValue() const { return m_min; }
00051     float getMaxValue() const { return m_max; }
00052 
00053     static int getColourMapCount();
00054     static QString getColourMapName(int n);
00055 
00056     QColor map(float value) const;
00057 
00058     QColor getContrastingColour() const; // for cursors etc
00059     bool hasLightBackground() const;
00060 
00061 protected:
00062     int m_map;
00063     float m_min;
00064     float m_max;
00065 };
00066 
00067 #endif
00068 

Generated on Wed Feb 20 15:45:25 2008 for SonicVisualiser by  doxygen 1.5.1