6#ifndef QSK_GRADIENT_STOP_H
7#define QSK_GRADIENT_STOP_H
15typedef QPair< qreal, QColor > QGradientStop;
21 Q_PROPERTY( qreal position READ position WRITE setPosition )
22 Q_PROPERTY( QColor color READ color WRITE setColor )
35 void setStop( qreal position,
const QColor& )
noexcept;
36 void setStop( qreal position, Qt::GlobalColor )
noexcept;
37 void setStop( qreal position, QRgb )
noexcept;
39 constexpr qreal position()
const noexcept;
40 void setPosition( qreal position )
noexcept;
42 constexpr const QColor& color()
const noexcept;
43 void setColor(
const QColor& )
noexcept;
45 void setRgb( QRgb )
noexcept;
46 QRgb rgb()
const noexcept;
48 static QColor interpolated(
51 QskHashValue hash( QskHashValue seed )
const noexcept;
54 qreal m_position = -1.0;
58#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
64inline constexpr QskGradientStop::QskGradientStop(
65 qreal position,
const QColor& color ) noexcept
66 : m_position( position )
71inline QskGradientStop::QskGradientStop(
72 qreal position,
const Qt::GlobalColor color ) noexcept
77inline QskGradientStop::QskGradientStop(
78 qreal position, QRgb rgb ) noexcept
83inline constexpr QskGradientStop::QskGradientStop(
const QGradientStop& qtStop ) noexcept
88inline constexpr qreal QskGradientStop::position() const noexcept
93inline constexpr const QColor& QskGradientStop::color() const noexcept
98inline QRgb QskGradientStop::rgb() const noexcept
100 return m_color.rgba();
103inline constexpr bool QskGradientStop::operator==(
const QskGradientStop& other )
const noexcept
105 return ( m_position == other.m_position ) && ( m_color == other.m_color );
108inline constexpr bool QskGradientStop::operator!=(
const QskGradientStop& other )
const noexcept
110 return ( !( *
this == other ) );
113#ifndef QT_NO_DEBUG_STREAM
121typedef QVector< QskGradientStop > QskGradientStops;
123QSK_EXPORT QColor qskInterpolatedColorAt(
const QskGradientStops&, qreal pos )
noexcept;
125QSK_EXPORT
bool qskIsMonochrome(
const QskGradientStops& )
noexcept;
126QSK_EXPORT
bool qskIsVisible(
const QskGradientStops& )
noexcept;
128QSK_EXPORT QskGradientStops qskInterpolatedGradientStops(
129 const QskGradientStops&,
bool,
const QskGradientStops&,
bool,
132QSK_EXPORT QskGradientStops qskInterpolatedGradientStops(
133 const QskGradientStops&,
const QColor&, qreal ratio );
135QSK_EXPORT QskGradientStops qskInterpolatedGradientStops(
136 const QColor&,
const QskGradientStops&, qreal ratio );
138QSK_EXPORT QskGradientStops qskTransparentGradientStops(
139 const QskGradientStops&, qreal ratio );
141QSK_EXPORT QskGradientStops qskExtractedGradientStops(
142 const QskGradientStops&, qreal from, qreal to );
144QSK_EXPORT QskGradientStops qskBuildGradientStops(
145 const QVector< QRgb >&,
bool discrete =
false );
147QSK_EXPORT QskGradientStops qskBuildGradientStops(
148 const QVector< QColor >&,
bool discrete =
false );
150QSK_EXPORT QskGradientStops qskRevertedGradientStops(
const QskGradientStops& );
152QSK_EXPORT QskGradientStops qskBuildGradientStops(
const QVector< QGradientStop >& );
153QSK_EXPORT QVector< QGradientStop > qskToQGradientStops(
const QVector< QskGradientStop >& );