We don't need this commit either

This commit is contained in:
Peter Hartmann 2021-12-15 15:30:35 +01:00
parent 59943281d5
commit c16eaa48bd
3 changed files with 25 additions and 11 deletions

View File

@ -44,20 +44,34 @@ namespace QskVertex
class ColorMapGradient
{
public:
inline ColorMapGradient( Color color1, Color color2 )
: m_color1( color1 )
, m_color2( color2 )
inline ColorMapGradient( const QskGradient& gradient )
: m_gradient( gradient )
{
}
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:
const Color m_color1;
const Color m_color2;
const QskGradient m_gradient;
};
class ColorIterator

View File

@ -902,7 +902,7 @@ static inline void qskRenderFillRandom(
}
else
{
const ColorMapGradient map( gradient.startColor(), gradient.endColor() );
const ColorMapGradient map( gradient );
qskRenderFillLines( metrics, orientation, line, map );
}
}
@ -926,7 +926,7 @@ static inline void qskRenderBoxRandom(
{
const auto orientation = qskQtOrientation( gradient );
const ColorMapGradient fillMap( gradient.startColor(), gradient.endColor() );
const ColorMapGradient fillMap( gradient );
qskRenderLines( metrics, orientation, borderLine, borderMap, fillLine, fillMap );
}
}
@ -948,7 +948,7 @@ static inline void qskRenderBoxRandom(
{
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 );
}
}

View File

@ -604,7 +604,7 @@ void QskBoxRenderer::renderRect(
if ( fillRandom )
{
const ColorMapGradient colorMap( gd.startColor(), gd.endColor() );
const ColorMapGradient colorMap( { Qt::Vertical, gd.startColor(), gd.endColor() } );
qskCreateFillRandom( gd.orientation(), in, colorMap, line );
}
else