We don't need this commit either
This commit is contained in:
parent
59943281d5
commit
c16eaa48bd
|
@ -44,20 +44,34 @@ namespace QskVertex
|
||||||
class ColorMapGradient
|
class ColorMapGradient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline ColorMapGradient( Color color1, Color color2 )
|
inline ColorMapGradient( const QskGradient& gradient )
|
||||||
: m_color1( color1 )
|
: m_gradient( gradient )
|
||||||
, m_color2( color2 )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Color colorAt( qreal value ) const
|
inline Color colorAt( qreal ratio ) const
|
||||||
{
|
{
|
||||||
return m_color1.interpolatedTo( m_color2, value );
|
const auto stops = m_gradient.stops();
|
||||||
|
|
||||||
|
for( int i = 0; i < m_gradient.stopCount(); ++i )
|
||||||
|
{
|
||||||
|
const QskGradientStop stop = stops.at( i );
|
||||||
|
|
||||||
|
if( stop.position() >= ratio )
|
||||||
|
{
|
||||||
|
const int start = ( i == 0 ) ? 0 : i - 1;
|
||||||
|
const int end = ( i == 0 ) ? 1 : i;
|
||||||
|
const QColor color = QskGradientStop::interpolated( stops.at( start ),
|
||||||
|
stops.at( end ), ratio );
|
||||||
|
return Color( color );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Color();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Color m_color1;
|
const QskGradient m_gradient;
|
||||||
const Color m_color2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ColorIterator
|
class ColorIterator
|
||||||
|
|
|
@ -902,7 +902,7 @@ static inline void qskRenderFillRandom(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ColorMapGradient map( gradient.startColor(), gradient.endColor() );
|
const ColorMapGradient map( gradient );
|
||||||
qskRenderFillLines( metrics, orientation, line, map );
|
qskRenderFillLines( metrics, orientation, line, map );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -926,7 +926,7 @@ static inline void qskRenderBoxRandom(
|
||||||
{
|
{
|
||||||
const auto orientation = qskQtOrientation( gradient );
|
const auto orientation = qskQtOrientation( gradient );
|
||||||
|
|
||||||
const ColorMapGradient fillMap( gradient.startColor(), gradient.endColor() );
|
const ColorMapGradient fillMap( gradient );
|
||||||
qskRenderLines( metrics, orientation, borderLine, borderMap, fillLine, fillMap );
|
qskRenderLines( metrics, orientation, borderLine, borderMap, fillLine, fillMap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -948,7 +948,7 @@ static inline void qskRenderBoxRandom(
|
||||||
{
|
{
|
||||||
const auto orientation = qskQtOrientation( gradient );
|
const auto orientation = qskQtOrientation( gradient );
|
||||||
|
|
||||||
const ColorMapGradient fillMap( gradient.startColor(), gradient.endColor() );
|
const ColorMapGradient fillMap( gradient );
|
||||||
qskRenderLines( metrics, orientation, borderLine, tl, tr, bl, br, fillLine, fillMap );
|
qskRenderLines( metrics, orientation, borderLine, tl, tr, bl, br, fillLine, fillMap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,7 +604,7 @@ void QskBoxRenderer::renderRect(
|
||||||
|
|
||||||
if ( fillRandom )
|
if ( fillRandom )
|
||||||
{
|
{
|
||||||
const ColorMapGradient colorMap( gd.startColor(), gd.endColor() );
|
const ColorMapGradient colorMap( { Qt::Vertical, gd.startColor(), gd.endColor() } );
|
||||||
qskCreateFillRandom( gd.orientation(), in, colorMap, line );
|
qskCreateFillRandom( gd.orientation(), in, colorMap, line );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue