00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _PALETTE_H_
00022 #define _PALETTE_H_
00023
00024 #include <QtCore/QFile>
00025 #include <QtGui/QLinearGradient>
00026
00031 class Palette
00032 {
00033 private:
00034 QLinearGradient m_gradient;
00035
00036 public:
00042 Palette( const QColor _color_begin = Qt::black, const QColor _color_end = Qt::white );
00043
00049 void setColor( qreal _position, QColor _color );
00054 void removeColorAt( unsigned int _index );
00060 QColor colorAt( unsigned int _index ) const;
00066 void setColorAt( unsigned int _index, QColor _color );
00072 qreal colorPosition( unsigned int _index ) const;
00078 void setColorPosition( unsigned int _index, qreal _position );
00079
00084 const QLinearGradient& linearGradient() const { return m_gradient; }
00085
00092 QImage generateImage( unsigned int _width, unsigned int _height = 1 ) const;
00093
00099 int load( QFile& _file );
00105 int save( QFile& _file ) const;
00106
00107 };
00108
00109 #endif //_PALETTE_H_