Go to the documentation of this file.
18 return QColor::fromHsv( h,
s, v, a ).rgb();
21 const double vs = v *
s / 255.0;
22 const int p = v - qRound( vs );
28 const double r = ( 60 - h ) / 60.0;
29 return qRgba( v, v - qRound( r * vs ), p, a );
33 const double r = ( h - 60 ) / 60.0;
34 return qRgba( v - qRound( r * vs ), v, p, a );
38 const double r = ( 180 - h ) / 60.0;
39 return qRgba( p, v, v - qRound( r * vs ), a );
43 const double r = ( h - 180 ) / 60.0;
44 return qRgba( p, v - qRound( r * vs ), v, a );
48 const double r = ( 300 - h ) / 60.0;
49 return qRgba( v - qRound( r * vs ), p, v, a );
54 const double r = ( h - 300 ) / 60.0;
55 return qRgba( v, p, v - qRound( r * vs ), a );
129 inline int findUpper(
double pos )
const;
139 if ( pos < 0.0 || pos > 1.0 )
151 if ( index ==
m_stops.size() ||
152 qAbs(
m_stops[index].pos - pos ) >= 0.001 )
155 for (
int i =
m_stops.size() - 1; i > index; i-- )
161 if (
color.alpha() != 255 )
167 if ( index <
m_stops.size() - 1 )
174 for (
int i = 0; i < m_stops.size(); i++ )
175 positions[i] = m_stops[i].pos;
182 int n = m_stops.size();
188 const int half = n >> 1;
189 const int middle = index + half;
191 if ( stops[middle].pos <= pos )
207 return m_stops[0].rgb;
209 return m_stops[ m_stops.size() - 1 ].rgb;
211 const int index = findUpper( pos );
214 return m_stops[index - 1].rgb;
218 const ColorStop& s1 = m_stops[index - 1];
220 const double ratio = ( pos - s1.
pos ) / ( s1.
posStep );
222 const int r =
int( s1.
r0 + ratio * s1.
rStep );
223 const int g =
int( s1.
g0 + ratio * s1.
gStep );
224 const int b =
int( s1.
b0 + ratio * s1.
bStep );
230 const int a =
int( s1.
a0 + ratio * s1.
aStep );
231 return qRgba( r, g, b, a );
235 return qRgba( r, g, b, s1.
a );
240 return qRgb( r, g, b );
281 const double width = interval.
width();
288 const int maxIndex = numColors - 1;
292 const double v = maxIndex * ( ( value - interval.
minValue() ) / width );
293 return static_cast< unsigned int >( v + 0.5 );
310 for (
int i = 0; i < 256; i++ )
331 const double step = 1.0 / ( numColors - 1 );
332 for (
int i = 0; i < numColors; i++ )
333 table[i] =
rgb( interval, step * i );
416 const QColor& color1,
const QColor& color2 )
435 if ( value >= 0.0 && value <= 1.0 )
476 const double width = interval.
width();
480 const double ratio = ( value - interval.
minValue() ) / width;
497 const double width = interval.
width();
505 return numColors - 1;
507 const double v = ( numColors - 1 ) * ( value - interval.
minValue() ) / width;
624 const double width = interval.
width();
634 const double ratio = ( value - interval.
minValue() ) / width;
673 for (
int i = 0; i < 60; i++ )
675 const double r = ( 60 - i ) / 60.0;
679 for (
int i = 60; i < 120; i++ )
681 const double r = ( i - 60 ) / 60.0;
685 for (
int i = 120; i < 180; i++ )
687 const double r = ( 180 - i ) / 60.0;
691 for (
int i = 180; i < 240; i++ )
693 const double r = ( i - 180 ) / 60.0;
697 for (
int i = 240; i < 300; i++ )
699 const double r = ( 300 - i ) / 60.0;
703 for (
int i = 300; i < 360; i++ )
705 const double r = ( i - 300 ) / 60.0;
709 rgbMin = rgbTable[
hue1 % 360 ];
710 rgbMax = rgbTable[
hue2 % 360 ];
871 const double width = interval.
width();
881 const double ratio = (
value - interval.
minValue() ) / width;
918 for (
int i = 0; i < 256; i++ )
927 for (
int i = 0; i < 256; i++ )
936 for (
int s = 0;
s < 256;
s++ )
938 const int v0 =
s * 256;
940 for (
int v = 0; v < 256; v++ )
1017 int saturation1,
int saturation2 )
1143 const double width = interval.
width();
1153 if ( value <= interval.
minValue() )
1156 if ( value >= interval.
maxValue() )
1159 const double ratio = ( value - interval.
minValue() ) / width;
1163 return rgbTable[sat];
1167 if ( value <= interval.
minValue() )
1170 if ( value >= interval.
maxValue() )
1173 const double ratio = ( value - interval.
minValue() ) / width;
1177 return rgbTable[ v ];
1182 if ( value <= interval.
minValue() )
1187 else if ( value >= interval.
maxValue() )
1194 const double ratio = ( value - interval.
minValue() ) / width;
1200 return rgbTable[ 256 *
s + v ];
virtual QRgb rgb(const QwtInterval &, double value) const QWT_OVERRIDE
virtual ~QwtAlphaColorMap()
Destructor.
QRgb rgb(QwtLinearColorMap::Mode, double pos) const
@ FixedColors
Return the color from the next lower color stop.
virtual QRgb rgb(const QwtInterval &, double value) const QWT_OVERRIDE
enum QwtSaturationValueColorMap::PrivateData::@23 tableType
void setSaturationInterval(int sat1, int sat2)
Set the interval for the saturation coordinate.
virtual ~QwtLinearColorMap()
Destructor.
virtual QVector< QRgb > colorTable(int numColors) const
virtual QVector< QRgb > colorTable256() const
QwtColorMap(Format=QwtColorMap::RGB)
void setHueInterval(int hue1, int hue2)
void setColorInterval(const QColor &color1, const QColor &color2)
void setHue(int hue)
Set the the hue coordinate.
virtual QRgb rgb(const QwtInterval &, double value) const QWT_OVERRIDE
Map a value of a given interval into a alpha value.
virtual ~QwtSaturationValueColorMap()
Destructor.
virtual ~QwtHueColorMap()
Destructor.
static QRgb qwtHsvToRgb(int h, int s, int v, int a)
QwtAlphaColorMap(const QColor &=QColor(Qt::gray))
Constructor.
QVector< ColorStop > m_stops
virtual uint colorIndex(int numColors, const QwtInterval &interval, double value) const
Map a value of a given interval into a color index.
A class representing an interval.
void setValue(int value)
Set the the value coordinate.
double width() const
Return the width of an interval.
virtual QRgb rgb(const QwtInterval &, double value) const QWT_OVERRIDE
void setValueInterval(int value1, int value2)
Set the interval for the value coordinate.
void setMode(Mode)
Set the mode of the color map.
void insert(double pos, const QColor &color)
QwtHueColorMap(QwtColorMap::Format=QwtColorMap::RGB)
Constructor.
ColorStop(double p, const QColor &c)
auto format(const text_style &ts, const S &format_str, const Args &... args) -> std::basic_string< Char >
virtual uint colorIndex(int numColors, const QwtInterval &, double value) const QWT_OVERRIDE
Map a value of a given interval into a color index.
QwtSaturationValueColorMap()
Constructor.
void setAlpha(int alpha)
Set the the alpha coordinate.
void setAlphaInterval(int alpha1, int alpha2)
void setSaturation(int saturation)
Set the the saturation coordinate.
@ ScaledColors
Interpolating the colors of the adjacent stops.
virtual QRgb rgb(const QwtInterval &interval, double value) const =0
QwtLinearColorMap::Mode mode
virtual ~QwtColorMap()
Destructor.
void setColor(const QColor &)
QwtLinearColorMap(QwtColorMap::Format=QwtColorMap::RGB)
void updateSteps(const ColorStop &nextStop)
QwtColorMap is used to map values into colors.
QVector< double > colorStops() const
void setAlpha(int alpha)
Set the the alpha coordinate.
void addColorStop(double value, const QColor &)
table_core< false > table
QVector< double > stops() const
int findUpper(double pos) const
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45