qskInterpolatedColor added
This commit is contained in:
parent
faf2ecd3c8
commit
a420407a56
@ -273,6 +273,25 @@ QskGradientStops qskInterpolatedGradientStops(
|
||||
return qskInterpolatedStops( from, to, ratio );
|
||||
}
|
||||
|
||||
QColor qskInterpolatedColorAt( const QskGradientStops& stops, qreal pos ) noexcept
|
||||
{
|
||||
if ( stops.isEmpty() )
|
||||
return QColor();
|
||||
|
||||
pos = qBound( 0.0, pos, 1.0 );
|
||||
|
||||
if ( pos <= stops.first().position() )
|
||||
return stops.first().color();
|
||||
|
||||
for ( int i = 1; i < stops.count(); i++ )
|
||||
{
|
||||
if ( pos <= stops[i].position() )
|
||||
return qskInterpolatedColor( stops, i - 1, i, pos );
|
||||
}
|
||||
|
||||
return stops.last().color();
|
||||
}
|
||||
|
||||
QskGradientStops qskExtractedGradientStops(
|
||||
const QskGradientStops& stops, qreal from, qreal to )
|
||||
{
|
||||
@ -421,4 +440,3 @@ QGradientStops qskToQGradientStops( const QskGradientStops& stops )
|
||||
|
||||
return qStops;
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,8 @@ QSK_EXPORT QDebug operator<<( QDebug, const QskGradientStop& );
|
||||
|
||||
typedef QVector< QskGradientStop > QskGradientStops;
|
||||
|
||||
QSK_EXPORT QColor qskInterpolatedColorAt( const QskGradientStops&, qreal pos ) noexcept;
|
||||
|
||||
QSK_EXPORT bool qskIsMonochrome( const QskGradientStops& ) noexcept;
|
||||
QSK_EXPORT bool qskIsVisible( const QskGradientStops& ) noexcept;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user