qwt_color_map.cpp
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 #include "qwt_color_map.h"
11 #include "qwt_math.h"
12 #include "qwt_interval.h"
13 
14 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
15 
16 /*
17  "-ftree-partial-pre" ( introduced with gcc 4.8 ) does miracles in
18  QwtColorMap::colorIndex(). When being used very often - like in
19  QwtPlotSpectrogram::renderTile() - time goes down by ~50%.
20 
21  clang 3.3 is out of the box ( -O2 ) fast for QwtColorMap::colorIndex(),
22  but also ~33% faster when rendering the image through QwtLinearColorMap::rgb()
23 */
24 
25 #define QWT_GCC_OPTIMIZE 1
26 
27 #endif
28 
29 static inline QRgb qwtHsvToRgb( int h, int s, int v, int a )
30 {
31 #if 0
32  return QColor::fromHsv( h, s, v, a ).rgb();
33 #else
34 
35  const double vs = v * s / 255.0;
36  const int p = v - qRound( vs );
37 
38  switch( h / 60 )
39  {
40  case 0:
41  {
42  const double r = ( 60 - h ) / 60.0;
43  return qRgba( v, v - qRound( r * vs ), p, a );
44  }
45  case 1:
46  {
47  const double r = ( h - 60 ) / 60.0;
48  return qRgba( v - qRound( r * vs ), v, p, a );
49  }
50  case 2:
51  {
52  const double r = ( 180 - h ) / 60.0;
53  return qRgba( p, v, v - qRound( r * vs ), a );
54  }
55  case 3:
56  {
57  const double r = ( h - 180 ) / 60.0;
58  return qRgba( p, v - qRound( r * vs ), v, a );
59  }
60  case 4:
61  {
62  const double r = ( 300 - h ) / 60.0;
63  return qRgba( v - qRound( r * vs ), p, v, a );
64  }
65  case 5:
66  default:
67  {
68  const double r = ( h - 300 ) / 60.0;
69  return qRgba( v, p, v - qRound( r * vs ), a );
70  }
71  }
72 #endif
73 }
74 
76 {
77 public:
79  d_doAlpha( false )
80  {
81  d_stops.reserve( 256 );
82  }
83 
84  void insert( double pos, const QColor &color );
85  QRgb rgb( QwtLinearColorMap::Mode, double pos ) const;
86 
87  QVector<double> stops() const;
88 
89 private:
90 
91  class ColorStop
92  {
93  public:
95  pos( 0.0 ),
96  rgb( 0 )
97  {
98  };
99 
100  ColorStop( double p, const QColor &c ):
101  pos( p ),
102  rgb( c.rgba() )
103  {
104  r = qRed( rgb );
105  g = qGreen( rgb );
106  b = qBlue( rgb );
107  a = qAlpha( rgb );
108 
109  /*
110  when mapping a value to rgb we will have to calcualate:
111  - const int v = int( ( s1.v0 + ratio * s1.vStep ) + 0.5 );
112 
113  Thus adding 0.5 ( for rounding ) can be done in advance
114  */
115  r0 = r + 0.5;
116  g0 = g + 0.5;
117  b0 = b + 0.5;
118  a0 = a + 0.5;
119 
120  rStep = gStep = bStep = aStep = 0.0;
121  posStep = 0.0;
122  }
123 
124  void updateSteps( const ColorStop &nextStop )
125  {
126  rStep = nextStop.r - r;
127  gStep = nextStop.g - g;
128  bStep = nextStop.b - b;
129  aStep = nextStop.a - a;
130  posStep = nextStop.pos - pos;
131  }
132 
133  double pos;
134  QRgb rgb;
135  int r, g, b, a;
136 
137  // precalculated values
138  double rStep, gStep, bStep, aStep;
139  double r0, g0, b0, a0;
140  double posStep;
141  };
142 
143  inline int findUpper( double pos ) const;
144  QVector<ColorStop> d_stops;
145  bool d_doAlpha;
146 };
147 
148 void QwtLinearColorMap::ColorStops::insert( double pos, const QColor &color )
149 {
150  // Lookups need to be very fast, insertions are not so important.
151  // Anyway, a balanced tree is what we need here. TODO ...
152 
153  if ( pos < 0.0 || pos > 1.0 )
154  return;
155 
156  int index;
157  if ( d_stops.size() == 0 )
158  {
159  index = 0;
160  d_stops.resize( 1 );
161  }
162  else
163  {
164  index = findUpper( pos );
165  if ( index == d_stops.size() ||
166  qAbs( d_stops[index].pos - pos ) >= 0.001 )
167  {
168  d_stops.resize( d_stops.size() + 1 );
169  for ( int i = d_stops.size() - 1; i > index; i-- )
170  d_stops[i] = d_stops[i-1];
171  }
172  }
173 
174  d_stops[index] = ColorStop( pos, color );
175  if ( color.alpha() != 255 )
176  d_doAlpha = true;
177 
178  if ( index > 0 )
179  d_stops[index-1].updateSteps( d_stops[index] );
180 
181  if ( index < d_stops.size() - 1 )
182  d_stops[index].updateSteps( d_stops[index+1] );
183 }
184 
185 inline QVector<double> QwtLinearColorMap::ColorStops::stops() const
186 {
187  QVector<double> positions( d_stops.size() );
188  for ( int i = 0; i < d_stops.size(); i++ )
189  positions[i] = d_stops[i].pos;
190  return positions;
191 }
192 
194 {
195  int index = 0;
196  int n = d_stops.size();
197 
198  const ColorStop *stops = d_stops.data();
199 
200  while ( n > 0 )
201  {
202  const int half = n >> 1;
203  const int middle = index + half;
204 
205  if ( stops[middle].pos <= pos )
206  {
207  index = middle + 1;
208  n -= half + 1;
209  }
210  else
211  n = half;
212  }
213 
214  return index;
215 }
216 
218  QwtLinearColorMap::Mode mode, double pos ) const
219 {
220  if ( pos <= 0.0 )
221  return d_stops[0].rgb;
222  if ( pos >= 1.0 )
223  return d_stops[ d_stops.size() - 1 ].rgb;
224 
225  const int index = findUpper( pos );
226  if ( mode == FixedColors )
227  {
228  return d_stops[index-1].rgb;
229  }
230  else
231  {
232  const ColorStop &s1 = d_stops[index-1];
233 
234  const double ratio = ( pos - s1.pos ) / ( s1.posStep );
235 
236  const int r = int( s1.r0 + ratio * s1.rStep );
237  const int g = int( s1.g0 + ratio * s1.gStep );
238  const int b = int( s1.b0 + ratio * s1.bStep );
239 
240  if ( d_doAlpha )
241  {
242  if ( s1.aStep )
243  {
244  const int a = int( s1.a0 + ratio * s1.aStep );
245  return qRgba( r, g, b, a );
246  }
247  else
248  {
249  return qRgba( r, g, b, s1.a );
250  }
251  }
252  else
253  {
254  return qRgb( r, g, b );
255  }
256  }
257 }
258 
264  d_format( format )
265 {
266 }
267 
270 {
271 }
272 
279 {
280  d_format = format;
281 }
282 
283 #ifdef QWT_GCC_OPTIMIZE
284 #pragma GCC push_options
285 #pragma GCC optimize("tree-partial-pre")
286 #endif
287 
297 uint QwtColorMap::colorIndex( int numColors,
298  const QwtInterval &interval, double value ) const
299 {
300 #ifdef QWT_GCC_OPTIMIZE
301  // accessing value here somehow makes gcc 4.8.1 to create
302  // significantly faster assembler code
303  if ( ((uchar *)&value)[0] ) asm("");
304  asm("");
305 #endif
306 
307  const double width = interval.width();
308  if ( width <= 0.0 )
309  return 0;
310 
311  if ( value <= interval.minValue() )
312  return 0;
313 
314  const int maxIndex = numColors - 1;
315  if ( value >= interval.maxValue() )
316  return maxIndex;
317 
318  const double v = maxIndex * ( ( value - interval.minValue() ) / width );
319  return static_cast<unsigned int>( v + 0.5 );
320 }
321 
322 #ifdef QWT_GCC_OPTIMIZE
323 #pragma GCC pop_options
324 #endif
325 
334 QVector<QRgb> QwtColorMap::colorTable256() const
335 {
336  QVector<QRgb> table( 256 );
337 
338  const QwtInterval interval( 0, 256 );
339 
340  for ( int i = 0; i < 256; i++ )
341  table[i] = rgb( interval, i );
342 
343  return table;
344 }
345 
355 QVector<QRgb> QwtColorMap::colorTable( int numColors ) const
356 {
357  QVector<QRgb> table( numColors );
358 
359  const QwtInterval interval( 0.0, 1.0 );
360 
361  const double step = 1.0 / ( numColors - 1 );
362  for ( int i = 0; i < numColors; i++ )
363  table[i] = rgb( interval, step * i );
364 
365  return table;
366 }
367 
369 {
370 public:
373 };
374 
382  QwtColorMap( format )
383 {
384  d_data = new PrivateData;
386 
387  setColorInterval( Qt::blue, Qt::yellow );
388 }
389 
398  const QColor &color2, QwtColorMap::Format format ):
399  QwtColorMap( format )
400 {
401  d_data = new PrivateData;
403  setColorInterval( color1, color2 );
404 }
405 
408 {
409  delete d_data;
410 }
411 
422 {
423  d_data->mode = mode;
424 }
425 
431 {
432  return d_data->mode;
433 }
434 
446  const QColor &color1, const QColor &color2 )
447 {
449  d_data->colorStops.insert( 0.0, color1 );
450  d_data->colorStops.insert( 1.0, color2 );
451 }
452 
463 void QwtLinearColorMap::addColorStop( double value, const QColor& color )
464 {
465  if ( value >= 0.0 && value <= 1.0 )
466  d_data->colorStops.insert( value, color );
467 }
468 
472 QVector<double> QwtLinearColorMap::colorStops() const
473 {
474  return d_data->colorStops.stops();
475 }
476 
482 {
483  return QColor( d_data->colorStops.rgb( d_data->mode, 0.0 ) );
484 }
485 
491 {
492  return QColor( d_data->colorStops.rgb( d_data->mode, 1.0 ) );
493 }
494 
504  const QwtInterval &interval, double value ) const
505 {
506  const double width = interval.width();
507  if ( width <= 0.0 )
508  return 0u;
509 
510  const double ratio = ( value - interval.minValue() ) / width;
511  return d_data->colorStops.rgb( d_data->mode, ratio );
512 }
513 
514 #ifdef QWT_GCC_OPTIMIZE
515 #pragma GCC push_options
516 #pragma GCC optimize("tree-partial-pre")
517 #endif
518 
529 uint QwtLinearColorMap::colorIndex( int numColors,
530  const QwtInterval &interval, double value ) const
531 {
532 #ifdef QWT_GCC_OPTIMIZE
533  // accessing value here somehow makes gcc 4.8.1 to create
534  // significantly faster assembler code
535  if ( ((uchar *)&value)[0] ) asm("");
536 #endif
537 
538  const double width = interval.width();
539  if ( width <= 0.0 )
540  return 0;
541 
542  if ( value <= interval.minValue() )
543  return 0;
544 
545  if ( value >= interval.maxValue() )
546  return numColors - 1;
547 
548  const double v = ( numColors - 1 ) * ( value - interval.minValue() ) / width;
549  return static_cast<unsigned int>( ( d_data->mode == FixedColors ) ? v : v + 0.5 );
550 }
551 
552 #ifdef QWT_GCC_OPTIMIZE
553 #pragma GCC pop_options
554 #endif
555 
557 {
558 public:
560  alpha1(0),
561  alpha2(255)
562  {
563  }
564 
565  int alpha1, alpha2;
566 
567  QColor color;
568  QRgb rgb;
569 
570  QRgb rgbMin;
571  QRgb rgbMax;
572 };
573 
574 
586 {
587  d_data = new PrivateData;
588  setColor( color );
589 }
590 
593 {
594  delete d_data;
595 }
596 
603 void QwtAlphaColorMap::setColor( const QColor &color )
604 {
605  d_data->color = color;
606  d_data->rgb = color.rgb() & qRgba( 255, 255, 255, 0 );
607 
608  d_data->rgbMin = d_data->rgb | ( d_data->alpha1 << 24 );
609  d_data->rgbMax = d_data->rgb | ( d_data->alpha2 << 24 );
610 }
611 
617 {
618  return d_data->color;
619 }
620 
633 {
634  d_data->alpha1 = qBound( 0, alpha1, 255 );
635  d_data->alpha2 = qBound( 0, alpha2, 255 );
636 
637  d_data->rgbMin = d_data->rgb | ( alpha1 << 24 );
638  d_data->rgbMax = d_data->rgb | ( alpha2 << 24 );
639 }
640 
646 {
647  return d_data->alpha1;
648 }
649 
655 {
656  return d_data->alpha2;
657 }
658 
667 QRgb QwtAlphaColorMap::rgb( const QwtInterval &interval, double value ) const
668 {
669  const double width = interval.width();
670  if ( width <= 0.0 )
671  return 0u;
672 
673  if ( value <= interval.minValue() )
674  return d_data->rgb;
675 
676  if ( value >= interval.maxValue() )
677  return d_data->rgbMax;
678 
679  const double ratio = ( value - interval.minValue() ) / width;
680  const int alpha = d_data->alpha1 + qRound( ratio * ( d_data->alpha2 - d_data->alpha1 ) );
681 
682  return d_data->rgb | ( alpha << 24 );
683 }
684 
686 {
687 public:
688  PrivateData();
689 
690  void updateTable();
691 
692  int hue1, hue2;
694  int value;
695  int alpha;
696 
697  QRgb rgbMin;
698  QRgb rgbMax;
699 
700  QRgb rgbTable[360];
701 };
702 
704  hue1(0),
705  hue2(359),
706  saturation(255),
707  value(255),
708  alpha(255)
709 {
710  updateTable();
711 }
712 
714 {
715  const int p = qRound( value * ( 255 - saturation ) / 255.0 );
716  const double vs = value * saturation / 255.0;
717 
718  for ( int i = 0; i < 60; i++ )
719  {
720  const double r = ( 60 - i ) / 60.0;
721  rgbTable[i] = qRgba( value, qRound( value - r * vs ), p, alpha );
722  }
723 
724  for ( int i = 60; i < 120; i++ )
725  {
726  const double r = ( i - 60 ) / 60.0;
727  rgbTable[i] = qRgba( qRound( value - r * vs ), value, p, alpha );
728  }
729 
730  for ( int i = 120; i < 180; i++ )
731  {
732  const double r = ( 180 - i ) / 60.0;
733  rgbTable[i] = qRgba( p, value, qRound( value - r * vs ), alpha );
734  }
735 
736  for ( int i = 180; i < 240; i++ )
737  {
738  const double r = ( i - 180 ) / 60.0;
739  rgbTable[i] = qRgba( p, qRound( value - r * vs ), value, alpha );
740  }
741 
742  for ( int i = 240; i < 300; i++ )
743  {
744  const double r = ( 300 - i ) / 60.0;
745  rgbTable[i] = qRgba( qRound( value - r * vs ), p, value, alpha );
746  }
747 
748  for ( int i = 300; i < 360; i++ )
749  {
750  const double r = ( i - 300 ) / 60.0;
751  rgbTable[i] = qRgba( value, p, qRound( value - r * vs ), alpha );
752  }
753 
754  rgbMin = rgbTable[ hue1 % 360 ];
755  rgbMax = rgbTable[ hue2 % 360 ];
756 }
757 
769  QwtColorMap( format )
770 {
771  d_data = new PrivateData;
772 }
773 
776 {
777  delete d_data;
778 }
779 
792 {
793  d_data->hue1 = qMax( hue1, 0 );
794  d_data->hue2 = qMax( hue2, 0 );
795 
796  d_data->rgbMin = d_data->rgbTable[ hue1 % 360 ];
797  d_data->rgbMax = d_data->rgbTable[ hue2 % 360 ];
798 }
799 
810 {
811  saturation = qBound( 0, saturation, 255 );
812 
813  if ( saturation != d_data->saturation )
814  {
816  d_data->updateTable();
817  }
818 }
819 
830 {
831  value = qBound( 0, value, 255 );
832 
833  if ( value != d_data->value )
834  {
835  d_data->value = value;
836  d_data->updateTable();
837  }
838 }
839 
851 {
852  alpha = qBound( 0, alpha, 255 );
853 
854  if ( alpha != d_data->alpha )
855  {
856  d_data->alpha = alpha;
857  d_data->updateTable();
858  }
859 }
860 
866 {
867  return d_data->hue1;
868 }
869 
875 {
876  return d_data->hue2;
877 }
878 
884 {
885  return d_data->saturation;
886 }
887 
893 {
894  return d_data->value;
895 }
896 
902 {
903  return d_data->alpha;
904 }
905 
914 QRgb QwtHueColorMap::rgb( const QwtInterval &interval, double value ) const
915 {
916  const double width = interval.width();
917  if ( width <= 0 )
918  return 0u;
919 
920  if ( value <= interval.minValue() )
921  return d_data->rgbMin;
922 
923  if ( value >= interval.maxValue() )
924  return d_data->rgbMax;
925 
926  const double ratio = ( value - interval.minValue() ) / width;
927 
928  int hue = d_data->hue1 + qRound( ratio * ( d_data->hue2 - d_data->hue1 ) );
929  if ( hue >= 360 )
930  {
931  hue -= 360;
932 
933  if ( hue >= 360 )
934  hue = hue % 360;
935  }
936 
937  return d_data->rgbTable[hue];
938 }
939 
941 {
942 public:
944  hue(0),
945  sat1(255),
946  sat2(255),
947  value1(0),
948  value2(255),
949  alpha(255),
950  tableType(Invalid)
951  {
952  updateTable();
953  }
954 
955  void updateTable()
956  {
957  tableType = Invalid;
958 
959  if ( ( value1 == value2 ) && ( sat1 != sat2 ) )
960  {
961  rgbTable.resize( 256 );
962 
963  for ( int i = 0; i < 256; i++ )
964  rgbTable[i] = qwtHsvToRgb( hue, i, value1, alpha );
965 
966  tableType = Saturation;
967  }
968  else if ( ( value1 != value2 ) && ( sat1 == sat2 ) )
969  {
970  rgbTable.resize( 256 );
971 
972  for ( int i = 0; i < 256; i++ )
973  rgbTable[i] = qwtHsvToRgb( hue, sat1, i, alpha );
974 
975  tableType = Value;
976  }
977  else
978  {
979  rgbTable.resize( 256 * 256 );
980 
981  for ( int s = 0; s < 256; s++ )
982  {
983  const int v0 = s * 256;
984 
985  for ( int v = 0; v < 256; v++ )
986  rgbTable[v0 + v] = qwtHsvToRgb( hue, s, v, alpha );
987  }
988  }
989  }
990 
991  int hue;
992  int sat1, sat2;
994  int alpha;
995 
996  enum
997  {
1000  Saturation
1001 
1002  } tableType;
1003 
1004  QVector<QRgb> rgbTable;
1005 };
1006 
1018 {
1019  d_data = new PrivateData;
1020 }
1021 
1024 {
1025  delete d_data;
1026 }
1027 
1038 {
1039  hue = hue % 360;
1040 
1041  if ( hue != d_data->hue )
1042  {
1043  d_data->hue = hue;
1044  d_data->updateTable();
1045  }
1046 }
1047 
1062  int saturation1, int saturation2 )
1063 {
1064  saturation1 = qBound( 0, saturation1, 255 );
1065  saturation2 = qBound( 0, saturation2, 255 );
1066 
1067  if ( ( saturation1 != d_data->sat1 ) || ( saturation2 != d_data->sat2 ) )
1068  {
1069  d_data->sat1 = saturation1;
1070  d_data->sat2 = saturation2;
1071 
1072  d_data->updateTable();
1073  }
1074 }
1075 
1088 void QwtSaturationValueColorMap::setValueInterval( int value1, int value2 )
1089 {
1090  value1 = qBound( 0, value1, 255 );
1091  value2 = qBound( 0, value2, 255 );
1092 
1093  if ( ( value1 != d_data->value1 ) || ( value2 != d_data->value2 ) )
1094  {
1095  d_data->value1 = value1;
1096  d_data->value2 = value2;
1097 
1098  d_data->updateTable();
1099  }
1100 }
1101 
1113 {
1114  alpha = qBound( 0, alpha, 255 );
1115 
1116  if ( alpha != d_data->alpha )
1117  {
1118  d_data->alpha = alpha;
1119  d_data->updateTable();
1120  }
1121 }
1122 
1128 {
1129  return d_data->hue;
1130 }
1131 
1137 {
1138  return d_data->sat1;
1139 }
1140 
1146 {
1147  return d_data->sat2;
1148 }
1149 
1155 {
1156  return d_data->value1;
1157 }
1158 
1164 {
1165  return d_data->value2;
1166 }
1167 
1173 {
1174  return d_data->alpha;
1175 }
1176 
1186  const QwtInterval &interval, double value ) const
1187 {
1188  const double width = interval.width();
1189  if ( width <= 0 )
1190  return 0u;
1191 
1192  const QRgb *rgbTable = d_data->rgbTable.constData();
1193 
1194  switch( d_data->tableType )
1195  {
1196  case PrivateData::Saturation:
1197  {
1198  if ( value <= interval.minValue() )
1199  return d_data->rgbTable[d_data->sat1];
1200 
1201  if ( value >= interval.maxValue() )
1202  return d_data->rgbTable[d_data->sat2];
1203 
1204  const double ratio = ( value - interval.minValue() ) / width;
1205  const int sat = d_data->sat1
1206  + qRound( ratio * ( d_data->sat2 - d_data->sat1 ) );
1207 
1208  return rgbTable[sat];
1209  }
1210  case PrivateData::Value:
1211  {
1212  if ( value <= interval.minValue() )
1213  return d_data->rgbTable[d_data->value1];
1214 
1215  if ( value >= interval.maxValue() )
1216  return d_data->rgbTable[d_data->value2];
1217 
1218  const double ratio = ( value - interval.minValue() ) / width;
1219  const int v = d_data->value1 +
1220  qRound( ratio * ( d_data->value2 - d_data->value1 ) );
1221 
1222  return rgbTable[ v ];
1223  }
1224  default:
1225  {
1226  int s, v;
1227  if ( value <= interval.minValue() )
1228  {
1229  s = d_data->sat1;
1230  v = d_data->value1;
1231  }
1232  else if ( value >= interval.maxValue() )
1233  {
1234  s = d_data->sat2;
1235  v = d_data->value2;
1236  }
1237  else
1238  {
1239  const double ratio = ( value - interval.minValue() ) / width;
1240 
1241  v = d_data->value1 + qRound( ratio * ( d_data->value2 - d_data->value1 ) );
1242  s = d_data->sat1 + qRound( ratio * ( d_data->sat2 - d_data->sat1 ) );
1243  }
1244 
1245  return rgbTable[ 256 * s + v ];
1246  }
1247  }
1248 }
int v
void setColorInterval(const QColor &color1, const QColor &color2)
virtual QRgb rgb(const QwtInterval &, double value) const
int hue2() const
void setSaturationInterval(int sat1, int sat2)
Set the interval for the saturation coordinate.
void updateSteps(const ColorStop &nextStop)
QwtHueColorMap(QwtColorMap::Format=QwtColorMap::RGB)
Constructor.
virtual QVector< QRgb > colorTable256() const
virtual QRgb rgb(const QwtInterval &, double value) const
A class representing an interval.
Definition: qwt_interval.h:26
QwtColorMap(Format=QwtColorMap::RGB)
double minValue() const
Definition: qwt_interval.h:193
void setAlpha(int alpha)
Set the the alpha coordinate.
XmlRpcServer s
Return the color from the next lower color stop.
virtual ~QwtLinearColorMap()
Destructor.
PrivateData * d_data
void insert(double pos, const QColor &color)
int value() const
int alpha2() const
void setHueInterval(int hue1, int hue2)
double maxValue() const
Definition: qwt_interval.h:199
PrivateData * d_data
virtual QRgb rgb(const QwtInterval &, double value) const
QVector< double > colorStops() const
virtual QRgb rgb(const QwtInterval &, double value) const
Map a value of a given interval into a alpha value.
QColor color() const
QwtSaturationValueColorMap()
Constructor.
void setValue(int value)
Set the the value coordinate.
virtual ~QwtSaturationValueColorMap()
Destructor.
QColor color1() const
static QRgb qwtHsvToRgb(int h, int s, int v, int a)
void setHue(int hue)
Set the the hue coordinate.
QRgb rgb(QwtLinearColorMap::Mode, double pos) const
virtual QVector< QRgb > colorTable(int numColors) const
virtual uint colorIndex(int numColors, const QwtInterval &interval, double value) const
Map a value of a given interval into a color index.
QVector< double > stops() const
QwtAlphaColorMap(const QColor &=QColor(Qt::gray))
Constructor.
Mode mode() const
void setMode(Mode)
Set the mode of the color map.
int saturation() const
int findUpper(double pos) const
virtual ~QwtHueColorMap()
Destructor.
T value
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:33
QColor color(const QwtInterval &, double value) const
Format d_format
Definition: qwt_color_map.h:85
The map is intended to map into RGB values.
Definition: qwt_color_map.h:44
int hue1() const
T value1
QColor color2() const
virtual uint colorIndex(int numColors, const QwtInterval &, double value) const
Map a value of a given interval into a color index.
void setFormat(Format)
unsigned int step
void setAlphaInterval(int alpha1, int alpha2)
U value2
Interpolating the colors of the adjacent stops.
ColorStop(double p, const QColor &c)
void setValueInterval(int value1, int value2)
Set the interval for the value coordinate.
virtual QRgb rgb(const QwtInterval &interval, double value) const =0
virtual ~QwtAlphaColorMap()
Destructor.
virtual ~QwtColorMap()
Destructor.
PrivateData * d_data
QVector< ColorStop > d_stops
QwtLinearColorMap::Mode mode
void setAlpha(int alpha)
Set the the alpha coordinate.
int alpha() const
int i
void setSaturation(int saturation)
Set the the saturation coordinate.
double width() const
Return the width of an interval.
Definition: qwt_interval.h:228
void setColor(const QColor &)
Format format() const
int alpha1() const
QwtLinearColorMap(QwtColorMap::Format=QwtColorMap::RGB)
int n
void addColorStop(double value, const QColor &)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17