qwt_color_map.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_COLOR_MAP_H
11 #define QWT_COLOR_MAP_H
12 
13 #include "qwt_global.h"
14 #include <qcolor.h>
15 
16 class QwtInterval;
17 
18 #if QT_VERSION < 0x060000
19 template< typename T > class QVector;
20 #endif
21 
38 {
39  public:
45  enum Format
46  {
48  RGB,
49 
60  Indexed
61  };
62 
63  explicit QwtColorMap( Format = QwtColorMap::RGB );
64  virtual ~QwtColorMap();
65 
66  void setFormat( Format );
67  Format format() const;
68 
76  virtual QRgb rgb( const QwtInterval& interval, double value ) const = 0;
77 
78  virtual uint colorIndex( int numColors,
79  const QwtInterval& interval, double value ) const;
80 
81  QColor color( const QwtInterval&, double value ) const;
82  virtual QVector< QRgb > colorTable( int numColors ) const;
83  virtual QVector< QRgb > colorTable256() const;
84 
85  private:
86  Q_DISABLE_COPY(QwtColorMap)
87 
88  Format m_format;
89 };
90 
99 {
100  public:
105  enum Mode
106  {
109 
111  ScaledColors
112  };
113 
115 
116  QwtLinearColorMap( const QColor& from, const QColor& to,
118 
119  virtual ~QwtLinearColorMap();
120 
121  void setMode( Mode );
122  Mode mode() const;
123 
124  void setColorInterval( const QColor& color1, const QColor& color2 );
125  void addColorStop( double value, const QColor& );
126  QVector< double > colorStops() const;
127 
128  QColor color1() const;
129  QColor color2() const;
130 
131  virtual QRgb rgb( const QwtInterval&,
132  double value ) const QWT_OVERRIDE;
133 
134  virtual uint colorIndex( int numColors,
135  const QwtInterval&, double value ) const QWT_OVERRIDE;
136 
137  class ColorStops;
138 
139  private:
140  class PrivateData;
142 };
143 
148 {
149  public:
150  explicit QwtAlphaColorMap( const QColor& = QColor( Qt::gray ) );
151  virtual ~QwtAlphaColorMap();
152 
153  void setAlphaInterval( int alpha1, int alpha2 );
154 
155  int alpha1() const;
156  int alpha2() const;
157 
158  void setColor( const QColor& );
159  QColor color() const;
160 
161  virtual QRgb rgb( const QwtInterval&,
162  double value ) const QWT_OVERRIDE;
163 
164  private:
165  class PrivateData;
167 };
168 
181 {
182  public:
184  virtual ~QwtHueColorMap();
185 
186  void setHueInterval( int hue1, int hue2 ); // direction ?
187  void setSaturation( int saturation );
188  void setValue( int value );
189  void setAlpha( int alpha );
190 
191  int hue1() const;
192  int hue2() const;
193  int saturation() const;
194  int value() const;
195  int alpha() const;
196 
197  virtual QRgb rgb( const QwtInterval&,
198  double value ) const QWT_OVERRIDE;
199 
200  private:
201  class PrivateData;
203 };
204 
215 {
216  public:
218  virtual ~QwtSaturationValueColorMap();
219 
220  void setHue( int hue );
221  void setSaturationInterval( int sat1, int sat2 );
222  void setValueInterval( int value1, int value2 );
223  void setAlpha( int alpha );
224 
225  int hue() const;
226  int saturation1() const;
227  int saturation2() const;
228  int value1() const;
229  int value2() const;
230  int alpha() const;
231 
232  virtual QRgb rgb( const QwtInterval&,
233  double value ) const QWT_OVERRIDE;
234 
235  private:
236  class PrivateData;
238 };
239 
248 inline QColor QwtColorMap::color( const QwtInterval& interval, double value ) const
249 {
250  return QColor::fromRgba( rgb( interval, value ) );
251 }
252 
258 {
259  return m_format;
260 }
261 
262 #endif
color
color
Definition: color.h:16
QwtColorMap::Format
Format
Definition: qwt_color_map.h:45
QwtLinearColorMap::FixedColors
@ FixedColors
Return the color from the next lower color stop.
Definition: qwt_color_map.h:108
QwtLinearColorMap
QwtLinearColorMap builds a color map from color stops.
Definition: qwt_color_map.h:98
QwtSaturationValueColorMap
QwtSaturationValueColorMap varies the saturation and/or value for a given hue in the HSV color model.
Definition: qwt_color_map.h:214
QVector
Definition: qwt_clipper.h:23
rgb
Definition: color.h:192
qwt_global.h
QwtAlphaColorMap::m_data
PrivateData * m_data
Definition: qwt_color_map.h:165
QwtLinearColorMap::Mode
Mode
Definition: qwt_color_map.h:105
QwtColorMap::RGB
@ RGB
The map is intended to map into RGB values.
Definition: qwt_color_map.h:48
QwtLinearColorMap::PrivateData
Definition: qwt_color_map.cpp:338
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:22
QwtColorMap::color
QColor color(const QwtInterval &, double value) const
Definition: qwt_color_map.h:248
QwtHueColorMap::PrivateData
Definition: qwt_color_map.cpp:640
QwtAlphaColorMap
QwtAlphaColorMap varies the alpha value of a color.
Definition: qwt_color_map.h:147
QwtColorMap::format
Format format() const
Definition: qwt_color_map.h:257
format
auto format(const text_style &ts, const S &format_str, const Args &... args) -> std::basic_string< Char >
Definition: color.h:543
QwtAlphaColorMap::PrivateData
Definition: qwt_color_map.cpp:511
QwtSaturationValueColorMap::m_data
PrivateData * m_data
Definition: qwt_color_map.h:236
QwtColorMap::rgb
virtual QRgb rgb(const QwtInterval &interval, double value) const =0
QwtHueColorMap::m_data
PrivateData * m_data
Definition: qwt_color_map.h:201
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtColorMap
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:37
QwtHueColorMap
QwtHueColorMap varies the hue value of the HSV color model.
Definition: qwt_color_map.h:180
QwtSaturationValueColorMap::PrivateData
Definition: qwt_color_map.cpp:895
QwtLinearColorMap::m_data
PrivateData * m_data
Definition: qwt_color_map.h:140
QwtColorMap::m_format
Format m_format
Definition: qwt_color_map.h:88


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45