2017-07-21 16:21:34 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "QskGradient.h"
|
2017-10-17 15:34:00 +00:00
|
|
|
#include "QskRgbValue.h"
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2017-10-17 15:34:00 +00:00
|
|
|
#include <qhashfunctions.h>
|
2018-08-03 06:15:28 +00:00
|
|
|
#include <qvariant.h>
|
2017-10-17 15:34:00 +00:00
|
|
|
|
|
|
|
static void qskRegisterGradient()
|
|
|
|
{
|
|
|
|
qRegisterMetaType< QskGradient >();
|
2020-10-30 06:29:43 +00:00
|
|
|
|
2022-03-30 16:30:22 +00:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
|
|
|
QMetaType::registerEqualsComparator< QskGradient >();
|
|
|
|
#endif
|
|
|
|
|
2020-10-30 06:29:43 +00:00
|
|
|
QMetaType::registerConverter< QColor, QskGradient >(
|
|
|
|
[]( const QColor& color ) { return QskGradient( color ); } );
|
2017-10-17 15:34:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterGradient )
|
|
|
|
|
2020-07-31 10:42:36 +00:00
|
|
|
static inline QskGradient::Orientation qskOrientation( Qt::Orientation o )
|
|
|
|
{
|
|
|
|
return ( o == Qt::Vertical )
|
|
|
|
? QskGradient::Vertical : QskGradient::Horizontal;
|
|
|
|
}
|
|
|
|
|
2021-09-17 11:35:11 +00:00
|
|
|
static inline bool qskIsGradientValid( const QskGradientStops& stops )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 15:29:39 +00:00
|
|
|
if ( stops.isEmpty() )
|
2017-07-21 16:21:34 +00:00
|
|
|
return false;
|
|
|
|
|
2022-10-24 15:29:39 +00:00
|
|
|
if ( stops.first().position() < 0.0 || stops.last().position() > 1.0 )
|
2017-07-21 16:21:34 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
if ( !stops.first().color().isValid() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for ( int i = 1; i < stops.size(); i++ )
|
|
|
|
{
|
2018-08-03 06:15:28 +00:00
|
|
|
if ( stops[ i ].position() < stops[ i - 1 ].position() )
|
2017-07-21 16:21:34 +00:00
|
|
|
return false;
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
if ( !stops[ i ].color().isValid() )
|
2017-07-21 16:21:34 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
static inline bool qskCanBeInterpolated( const QskGradient& from, const QskGradient& to )
|
2017-10-17 15:34:00 +00:00
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
if ( from.isMonochrome() || to.isMonochrome() )
|
|
|
|
return true;
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
return from.orientation() == to.orientation();
|
2020-07-31 10:42:36 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
QskGradient::QskGradient( Orientation orientation ) noexcept
|
2022-01-21 06:29:07 +00:00
|
|
|
: m_orientation( orientation )
|
2022-01-21 06:33:28 +00:00
|
|
|
, m_isDirty( false )
|
2022-01-21 06:29:07 +00:00
|
|
|
, m_isValid( false )
|
2022-01-21 06:33:28 +00:00
|
|
|
, m_isMonchrome( true )
|
2022-01-21 06:29:07 +00:00
|
|
|
, m_isVisible( false )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
QskGradient::QskGradient( const QColor& color )
|
2022-01-21 06:29:07 +00:00
|
|
|
: QskGradient( Vertical )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 14:02:46 +00:00
|
|
|
setStops( color );
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2020-07-31 10:42:36 +00:00
|
|
|
QskGradient::QskGradient( Qt::Orientation orientation,
|
|
|
|
const QColor& startColor, const QColor& stopColor )
|
|
|
|
: QskGradient( qskOrientation( orientation ), startColor, stopColor )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-07-21 16:21:34 +00:00
|
|
|
QskGradient::QskGradient( Orientation orientation,
|
2018-08-03 06:15:28 +00:00
|
|
|
const QColor& startColor, const QColor& stopColor )
|
2022-01-21 06:29:07 +00:00
|
|
|
: QskGradient( orientation )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 14:02:46 +00:00
|
|
|
setStops( startColor, stopColor );
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-01-21 06:29:07 +00:00
|
|
|
QskGradient::QskGradient( Qt::Orientation orientation, const QskGradientStops& stops )
|
2020-07-31 10:42:36 +00:00
|
|
|
: QskGradient( qskOrientation( orientation ), stops )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-01-21 06:29:07 +00:00
|
|
|
QskGradient::QskGradient( Orientation orientation, const QskGradientStops& stops )
|
|
|
|
: QskGradient( orientation )
|
2017-10-17 15:34:00 +00:00
|
|
|
{
|
2022-01-21 06:49:38 +00:00
|
|
|
setStops( stops );
|
2017-10-17 15:34:00 +00:00
|
|
|
}
|
|
|
|
|
2022-03-30 10:28:45 +00:00
|
|
|
QskGradient::QskGradient( Qt::Orientation orientation, QGradient::Preset preset )
|
|
|
|
: QskGradient( qskOrientation( orientation ), preset )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-03-18 15:50:34 +00:00
|
|
|
QskGradient::QskGradient( Orientation orientation, QGradient::Preset preset )
|
|
|
|
: QskGradient( orientation )
|
|
|
|
{
|
2022-10-24 14:40:47 +00:00
|
|
|
setStops( qskBuildGradientStops( QGradient( preset ).stops() ) );
|
2022-03-18 15:50:34 +00:00
|
|
|
}
|
|
|
|
|
2017-07-21 16:21:34 +00:00
|
|
|
QskGradient::~QskGradient()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
bool QskGradient::operator==( const QskGradient& other ) const noexcept
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 14:02:46 +00:00
|
|
|
return ( m_orientation == other.m_orientation ) && ( m_stops == other.m_stops );
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
void QskGradient::updateStatusBits() const
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 14:02:46 +00:00
|
|
|
// doing all bits in one loop ?
|
|
|
|
m_isValid = qskIsGradientValid( m_stops );
|
|
|
|
|
|
|
|
if ( m_isValid )
|
2022-01-21 06:29:07 +00:00
|
|
|
{
|
2022-10-24 14:02:46 +00:00
|
|
|
m_isMonchrome = qskIsMonochrome( m_stops );
|
|
|
|
m_isVisible = qskIsVisible( m_stops );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_isMonchrome = true;
|
|
|
|
m_isVisible = false;
|
2022-01-21 06:29:07 +00:00
|
|
|
}
|
2022-10-24 14:02:46 +00:00
|
|
|
|
|
|
|
m_isDirty = false;
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
bool QskGradient::isValid() const noexcept
|
|
|
|
{
|
|
|
|
if ( m_isDirty )
|
|
|
|
updateStatusBits();
|
|
|
|
|
|
|
|
return m_isValid;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QskGradient::isMonochrome() const noexcept
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-01-21 06:29:07 +00:00
|
|
|
if ( m_isDirty )
|
|
|
|
updateStatusBits();
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2022-01-21 06:29:07 +00:00
|
|
|
return m_isMonchrome;
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
bool QskGradient::isVisible() const noexcept
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-01-21 06:29:07 +00:00
|
|
|
if ( m_isDirty )
|
|
|
|
updateStatusBits();
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-01-21 06:29:07 +00:00
|
|
|
return m_isVisible;
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
void QskGradient::setOrientation( Qt::Orientation orientation ) noexcept
|
2020-07-31 10:42:36 +00:00
|
|
|
{
|
|
|
|
setOrientation( qskOrientation( orientation ) );
|
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
void QskGradient::setOrientation( Orientation orientation ) noexcept
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-01-21 06:29:07 +00:00
|
|
|
// does not change m_isDirty
|
2017-07-21 16:21:34 +00:00
|
|
|
m_orientation = orientation;
|
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
void QskGradient::setStops( const QColor& color )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
m_stops = { { 0.0, color }, { 1.0, color } };
|
2022-01-21 06:29:07 +00:00
|
|
|
m_isDirty = true;
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
void QskGradient::setStops( const QColor& color1, const QColor& color2 )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
m_stops = { { 0.0, color1 }, { 1.0, color2 } };
|
2022-01-21 06:29:07 +00:00
|
|
|
m_isDirty = true;
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2021-09-17 11:35:11 +00:00
|
|
|
void QskGradient::setStops( const QskGradientStops& stops )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 14:02:46 +00:00
|
|
|
if ( !stops.isEmpty() && !qskIsGradientValid( stops ) )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
|
|
|
qWarning( "Invalid gradient stops" );
|
2022-10-24 14:02:46 +00:00
|
|
|
m_stops.clear();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_stops = stops;
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-01-21 06:29:07 +00:00
|
|
|
m_isDirty = true;
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 15:29:39 +00:00
|
|
|
int QskGradient::stepCount() const noexcept
|
2021-02-19 11:42:05 +00:00
|
|
|
{
|
2022-10-24 15:29:39 +00:00
|
|
|
if ( !isValid() )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
int steps = m_stops.count() - 1;
|
|
|
|
|
|
|
|
if ( m_stops.first().position() > 0.0 )
|
|
|
|
steps++;
|
|
|
|
|
|
|
|
if ( m_stops.last().position() < 1.0 )
|
|
|
|
steps++;
|
|
|
|
|
|
|
|
return steps;
|
2021-02-19 11:42:05 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 14:40:47 +00:00
|
|
|
qreal QskGradient::stopAt( int index ) const noexcept
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-10-24 14:40:47 +00:00
|
|
|
if ( index < 0 || index >= m_stops.size() )
|
2017-07-21 16:21:34 +00:00
|
|
|
return -1.0;
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
return m_stops[ index ].position();
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 14:40:47 +00:00
|
|
|
bool QskGradient::hasStopAt( qreal value ) const noexcept
|
|
|
|
{
|
|
|
|
// better use binary search TODO ...
|
|
|
|
for ( auto& stop : m_stops )
|
|
|
|
{
|
|
|
|
if ( stop.position() == value )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if ( stop.position() > value )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
QColor QskGradient::colorAt( int index ) const noexcept
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
|
|
|
if ( index >= m_stops.size() )
|
|
|
|
return QColor();
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
return m_stops[ index ].color();
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2017-10-17 15:34:00 +00:00
|
|
|
void QskGradient::setAlpha( int alpha )
|
|
|
|
{
|
|
|
|
for ( auto& stop : m_stops )
|
|
|
|
{
|
2020-08-15 12:42:28 +00:00
|
|
|
auto c = stop.color();
|
2017-10-17 15:34:00 +00:00
|
|
|
if ( c.isValid() && c.alpha() )
|
|
|
|
{
|
|
|
|
c.setAlpha( alpha );
|
|
|
|
stop.setColor( c );
|
|
|
|
}
|
|
|
|
}
|
2022-01-21 06:29:07 +00:00
|
|
|
|
|
|
|
m_isDirty = true;
|
2017-10-17 15:34:00 +00:00
|
|
|
}
|
|
|
|
|
2020-07-31 10:42:36 +00:00
|
|
|
void QskGradient::reverse()
|
|
|
|
{
|
|
|
|
if ( isMonochrome() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::reverse( m_stops.begin(), m_stops.end() );
|
|
|
|
for( auto& stop : m_stops )
|
|
|
|
stop.setPosition( 1.0 - stop.position() );
|
|
|
|
}
|
|
|
|
|
|
|
|
QskGradient QskGradient::reversed() const
|
|
|
|
{
|
|
|
|
auto gradient = *this;
|
|
|
|
gradient.reverse();
|
|
|
|
|
|
|
|
return gradient;
|
|
|
|
}
|
|
|
|
|
|
|
|
QskGradient QskGradient::extracted( qreal from, qreal to ) const
|
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
auto gradient = *this;
|
2020-07-31 10:42:36 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
if ( !isValid() || ( from > to ) || ( from > 1.0 ) )
|
2018-12-22 15:12:45 +00:00
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
gradient.clearStops();
|
2018-12-22 15:12:45 +00:00
|
|
|
}
|
2022-10-24 15:08:48 +00:00
|
|
|
else if ( isMonochrome() )
|
2022-03-29 09:14:23 +00:00
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
from = qMax( from, 0.0 );
|
|
|
|
to = qMin( to, 1.0 );
|
2022-03-29 09:14:23 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
const auto color = m_stops.first().color();
|
2022-03-29 09:14:23 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
gradient.setStops( { { from, color }, { to, color } } );
|
2017-10-17 15:34:00 +00:00
|
|
|
}
|
2022-10-24 15:08:48 +00:00
|
|
|
else
|
2017-10-17 15:34:00 +00:00
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
gradient.setStops( qskExtractedGradientStops( m_stops, from, to ) );
|
|
|
|
}
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
return gradient;
|
|
|
|
}
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
QskGradient QskGradient::interpolated( const QskGradient& to, qreal ratio ) const
|
|
|
|
{
|
|
|
|
if ( !isValid() && !to.isValid() )
|
|
|
|
return to;
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
QskGradient gradient;
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
if ( qskCanBeInterpolated( *this, to ) )
|
2017-10-17 15:34:00 +00:00
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
// We simply interpolate stops
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
gradient.setOrientation( to.orientation() );
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
gradient.setStops( qskInterpolatedGradientStops(
|
|
|
|
m_stops, isMonochrome(),
|
|
|
|
to.m_stops, to.isMonochrome(), ratio ) );
|
2017-10-17 15:34:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
The interpolation is devided into 2 steps. First we
|
2022-10-24 15:08:48 +00:00
|
|
|
interpolate into a monochrome gradient and then
|
|
|
|
recolor the gradient towards the target gradient
|
|
|
|
This will always result in a smooth transition - even, when
|
|
|
|
interpolating between different gradient types
|
2017-10-17 15:34:00 +00:00
|
|
|
*/
|
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
const auto c = QskRgb::interpolated( startColor(), to.startColor(), 0.5 );
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
if ( ratio < 0.5 )
|
2017-10-17 15:34:00 +00:00
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
const auto r = 2.0 * ratio;
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
gradient.setOrientation( orientation() );
|
|
|
|
gradient.setStops( qskInterpolatedGradientStops( m_stops, c, r ) );
|
2017-10-17 15:34:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-10-24 15:08:48 +00:00
|
|
|
const auto r = 2.0 * ( ratio - 0.5 );
|
2017-10-17 15:34:00 +00:00
|
|
|
|
2022-10-24 15:08:48 +00:00
|
|
|
gradient.setOrientation( to.orientation() );
|
|
|
|
gradient.setStops( qskInterpolatedGradientStops( c, to.m_stops, r ) );
|
2017-10-17 15:34:00 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-24 15:08:48 +00:00
|
|
|
|
|
|
|
return gradient;
|
2017-10-17 15:34:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QVariant QskGradient::interpolate(
|
|
|
|
const QskGradient& from, const QskGradient& to, qreal progress )
|
|
|
|
{
|
|
|
|
return QVariant::fromValue( from.interpolated( to, progress ) );
|
|
|
|
}
|
|
|
|
|
2022-10-24 14:02:46 +00:00
|
|
|
void QskGradient::clearStops()
|
|
|
|
{
|
|
|
|
if ( !m_stops.isEmpty() )
|
|
|
|
{
|
|
|
|
m_stops.clear();
|
|
|
|
m_isDirty = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QskHashValue QskGradient::hash( QskHashValue seed ) const
|
|
|
|
{
|
|
|
|
const auto o = orientation();
|
|
|
|
|
|
|
|
auto hash = qHashBits( &o, sizeof( o ), seed );
|
|
|
|
for ( const auto& stop : m_stops )
|
|
|
|
hash = stop.hash( hash );
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
|
2017-07-21 16:21:34 +00:00
|
|
|
#ifndef QT_NO_DEBUG_STREAM
|
|
|
|
|
2018-07-19 12:10:48 +00:00
|
|
|
#include <qdebug.h>
|
|
|
|
|
2017-07-21 16:21:34 +00:00
|
|
|
QDebug operator<<( QDebug debug, const QskGradient& gradient )
|
|
|
|
{
|
2022-03-30 10:28:45 +00:00
|
|
|
QDebugStateSaver saver( debug );
|
|
|
|
debug.nospace();
|
|
|
|
|
|
|
|
debug << "Gradient";
|
|
|
|
|
|
|
|
if ( !gradient.isValid() )
|
|
|
|
{
|
|
|
|
debug << "()";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
debug << "( ";
|
|
|
|
|
|
|
|
if ( gradient.isMonochrome() )
|
|
|
|
{
|
|
|
|
QskRgb::debugColor( debug, gradient.startColor() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char o[] = { 'H', 'V', 'D' };
|
|
|
|
debug << o[ gradient.orientation() ] << ", ";
|
|
|
|
|
|
|
|
if ( gradient.stops().count() == 2 )
|
|
|
|
{
|
|
|
|
QskRgb::debugColor( debug, gradient.startColor() );
|
|
|
|
debug << ", ";
|
|
|
|
QskRgb::debugColor( debug, gradient.endColor() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-10-24 14:40:47 +00:00
|
|
|
const auto& stops = gradient.stops();
|
|
|
|
for ( int i = 0; i < stops.count(); i++ )
|
2022-03-30 10:28:45 +00:00
|
|
|
{
|
|
|
|
if ( i != 0 )
|
|
|
|
debug << ", ";
|
|
|
|
|
2022-10-24 14:40:47 +00:00
|
|
|
debug << stops[i];
|
2022-03-30 10:28:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
debug << " )";
|
|
|
|
}
|
|
|
|
|
2017-07-21 16:21:34 +00:00
|
|
|
return debug;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "moc_QskGradient.cpp"
|