QskGradient::Spread -> QskGradient::SpreadMode

This commit is contained in:
Uwe Rathmann 2022-12-22 11:45:23 +01:00
parent 6c1c04c7be
commit 3de71d1bd5
11 changed files with 86 additions and 95 deletions

View File

@ -115,7 +115,7 @@ namespace
} }
shapeGradient->setSpread( shapeGradient->setSpread(
static_cast< QQuickShapeGradient::SpreadMode >( gradient.spread() ) ); static_cast< QQuickShapeGradient::SpreadMode >( gradient.spreadMode() ) );
/* /*
QQuickGradient has been made in the early days of Qt5 for the QML QQuickGradient has been made in the early days of Qt5 for the QML

View File

@ -46,7 +46,7 @@ namespace
QskGradient gradient; QskGradient gradient;
gradient.setLinearDirection( 0.0, 0.0, 1.0, 1.0 ); gradient.setLinearDirection( 0.0, 0.0, 1.0, 1.0 );
gradient.setSpread( QskGradient::RepeatSpread ); gradient.setSpreadMode( QskGradient::RepeatSpread );
gradient.setStops( stops ); gradient.setStops( stops );
showGradient( gradient ); showGradient( gradient );

View File

@ -35,7 +35,7 @@ namespace
QskGradient gradient( QGradient::PhoenixStart ); QskGradient gradient( QGradient::PhoenixStart );
gradient.setLinearDirection( 0.0, 0.0, 0.2, 0.5 ); gradient.setLinearDirection( 0.0, 0.0, 0.2, 0.5 );
gradient.setSpread( QskGradient::ReflectSpread ); gradient.setSpreadMode( QskGradient::ReflectSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }
@ -50,7 +50,7 @@ namespace
QskGradient gradient( stops ); QskGradient gradient( stops );
gradient.setLinearDirection( 0.0, 0.0, 0.05, 0.1 ); gradient.setLinearDirection( 0.0, 0.0, 0.05, 0.1 );
gradient.setSpread( QskGradient::RepeatSpread ); gradient.setSpreadMode( QskGradient::RepeatSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }
@ -83,7 +83,7 @@ namespace
QskGradient gradient( QskRgb::LightYellow, QskRgb::MidnightBlue ); QskGradient gradient( QskRgb::LightYellow, QskRgb::MidnightBlue );
gradient.setRadialDirection( QskRadialDirection() ); gradient.setRadialDirection( QskRadialDirection() );
gradient.setSpread( QskGradient::PadSpread ); gradient.setSpreadMode( QskGradient::PadSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }
@ -107,7 +107,7 @@ namespace
QskGradient gradient( stops ); QskGradient gradient( stops );
gradient.setDirection( QskGradient::Radial ); gradient.setDirection( QskGradient::Radial );
gradient.setSpread( QskGradient::PadSpread ); gradient.setSpreadMode( QskGradient::PadSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }
@ -118,7 +118,7 @@ namespace
QskGradient gradient( QGradient::LilyMeadow ); QskGradient gradient( QGradient::LilyMeadow );
gradient.setRadialDirection( 0.5, 0.7, 0.25 ); gradient.setRadialDirection( 0.5, 0.7, 0.25 );
gradient.setSpread( QskGradient::RepeatSpread ); gradient.setSpreadMode( QskGradient::RepeatSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }
@ -129,7 +129,7 @@ namespace
QskGradient gradient( Qt::red, Qt::blue ); QskGradient gradient( Qt::red, Qt::blue );
gradient.setRadialDirection( 0.6, 0.4, 0.1 ); gradient.setRadialDirection( 0.6, 0.4, 0.1 );
gradient.setSpread( QskGradient::ReflectSpread ); gradient.setSpreadMode( QskGradient::ReflectSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }
@ -149,7 +149,7 @@ namespace
QskGradient gradient( QGradient::JuicyPeach ); QskGradient gradient( QGradient::JuicyPeach );
gradient.setConicDirection( 0.5, 0.5, 30.0, 60.0 ); gradient.setConicDirection( 0.5, 0.5, 30.0, 60.0 );
gradient.setSpread( QskGradient::ReflectSpread ); gradient.setSpreadMode( QskGradient::ReflectSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }
@ -160,7 +160,7 @@ namespace
QskGradient gradient( QGradient::WinterNeva ); QskGradient gradient( QGradient::WinterNeva );
gradient.setConicDirection( 0.5, 0.5, 30.0, 60.0 ); gradient.setConicDirection( 0.5, 0.5, 30.0, 60.0 );
gradient.setSpread( QskGradient::RepeatSpread ); gradient.setSpreadMode( QskGradient::RepeatSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }
@ -179,7 +179,7 @@ namespace
QskGradient gradient( QGradient::FabledSunset ); QskGradient gradient( QGradient::FabledSunset );
gradient.setConicDirection( 0.5, 0.5, 45.0, 180.0 ); gradient.setConicDirection( 0.5, 0.5, 45.0, 180.0 );
gradient.setSpread( QskGradient::ReflectSpread ); gradient.setSpreadMode( QskGradient::ReflectSpread );
shapeItem->setGradient( gradient ); shapeItem->setGradient( gradient );
} }

View File

@ -26,7 +26,7 @@ Qsk.Window
gradient: gradient:
({ ({
linear: { x1: 0, y1: 0, x2: 0.2, y2: 0.5 }, linear: { x1: 0, y1: 0, x2: 0.2, y2: 0.5 },
spread: Qsk.Gradient.ReflectSpread, spreadMode: Qsk.Gradient.ReflectSpread,
// PhonixStart // PhonixStart
stops: [ stops: [
@ -44,7 +44,7 @@ Qsk.Window
gradient: gradient:
({ ({
linear: { x1: 0, y1: 0, x2: 0.05, y2: 0.1 }, linear: { x1: 0, y1: 0, x2: 0.05, y2: 0.1 },
spread: Qsk.Gradient.RepeatSpread, spreadMode: Qsk.Gradient.RepeatSpread,
stops: [ stops: [
{ position: 0.5, color: "RoyalBlue" }, { position: 0.5, color: "RoyalBlue" },
@ -85,7 +85,7 @@ Qsk.Window
gradient: gradient:
({ ({
conic: { x: 0.5, y: 0.5, startAngle: 30, spanAngle: 60 }, conic: { x: 0.5, y: 0.5, startAngle: 30, spanAngle: 60 },
spread: Qsk.Gradient.ReflectSpread, spreadMode: Qsk.Gradient.ReflectSpread,
// JuicyPeach // JuicyPeach
stops: [ stops: [
@ -103,7 +103,7 @@ Qsk.Window
gradient: gradient:
({ ({
conic: { x: 0.5, y: 0.5, startAngle: 30, spanAngle: 60 }, conic: { x: 0.5, y: 0.5, startAngle: 30, spanAngle: 60 },
spread: Qsk.Gradient.RepeatSpread, spreadMode: Qsk.Gradient.RepeatSpread,
// WinterNeva // WinterNeva
stops: [ stops: [
@ -144,7 +144,7 @@ Qsk.Window
gradient: gradient:
({ ({
conic: { x: 0.5, y: 0.5, startAngle: 45, spanAngle: 180 }, conic: { x: 0.5, y: 0.5, startAngle: 45, spanAngle: 180 },
spread: Qsk.Gradient.ReflectSpread, spreadMode: Qsk.Gradient.ReflectSpread,
// FabledSunset // FabledSunset
stops: [ stops: [
@ -188,7 +188,7 @@ Qsk.Window
gradient: gradient:
({ ({
radial: { x: 0.5, y: 0.5, radius: 0.5 }, radial: { x: 0.5, y: 0.5, radius: 0.5 },
spread: Qsk.Gradient.PadSpread, spreadMode: Qsk.Gradient.PadSpread,
stops: [ stops: [
{ position: 0.0, color: "lime" }, { position: 0.0, color: "lime" },
@ -213,7 +213,7 @@ Qsk.Window
gradient: gradient:
({ ({
radial: { x: 0.5, y: 0.7, radius: 0.25 }, radial: { x: 0.5, y: 0.7, radius: 0.25 },
spread: Qsk.Gradient.RepeatSpread, spreadMode: Qsk.Gradient.RepeatSpread,
// LilyMeadow // LilyMeadow
stops: [ stops: [
@ -232,7 +232,7 @@ Qsk.Window
gradient: gradient:
({ ({
radial: { x: 0.6, y: 0.4, radius: 0.1 }, radial: { x: 0.6, y: 0.4, radius: 0.1 },
spread: Qsk.Gradient.ReflectSpread, spreadMode: Qsk.Gradient.ReflectSpread,
stops: [ stops: [
{ position: 0.0, color: "red" }, { position: 0.0, color: "red" },

View File

@ -153,11 +153,14 @@ namespace
} }
else if ( v.isNumber() ) else if ( v.isNumber() )
{ {
if ( it.name() == QStringLiteral( "spread" ) ) if ( it.name() == QStringLiteral( "spreadMode" ) )
{ {
const auto s = v.toNumber(); const auto s = v.toNumber();
if ( s >= QskGradient::PadSpread && s <= QskGradient::RepeatSpread ) if ( s >= QskGradient::PadSpread && s <= QskGradient::RepeatSpread )
gradient.setSpread( static_cast< QskGradient::Spread >( s ) ); {
gradient.setSpreadMode(
static_cast< QskGradient::SpreadMode >( s ) );
}
} }
} }
} }

View File

@ -129,7 +129,7 @@ QskGradient::QskGradient( const QGradient& qGradient )
} }
} }
m_spread = static_cast< Spread >( qGradient.spread() ); m_spreadMode = static_cast< SpreadMode >( qGradient.spread() );
setStops( qskBuildGradientStops( qGradient.stops() ) ); setStops( qskBuildGradientStops( qGradient.stops() ) );
} }
@ -138,7 +138,7 @@ QskGradient::QskGradient( const QskGradient& other ) noexcept
, m_values{ other.m_values[0], other.m_values[1], , m_values{ other.m_values[0], other.m_values[1],
other.m_values[2], other.m_values[3], } other.m_values[2], other.m_values[3], }
, m_type( other.m_type ) , m_type( other.m_type )
, m_spread( other.m_spread ) , m_spreadMode( other.m_spreadMode )
, m_isDirty( other.m_isDirty ) , m_isDirty( other.m_isDirty )
, m_isValid( other.m_isValid ) , m_isValid( other.m_isValid )
, m_isMonchrome( other.m_isMonchrome ) , m_isMonchrome( other.m_isMonchrome )
@ -153,7 +153,7 @@ QskGradient::~QskGradient()
QskGradient& QskGradient::operator=( const QskGradient& other ) noexcept QskGradient& QskGradient::operator=( const QskGradient& other ) noexcept
{ {
m_type = other.m_type; m_type = other.m_type;
m_spread = other.m_spread; m_spreadMode = other.m_spreadMode;
m_stops = other.m_stops; m_stops = other.m_stops;
m_values[0] = other.m_values[0]; m_values[0] = other.m_values[0];
@ -172,7 +172,7 @@ QskGradient& QskGradient::operator=( const QskGradient& other ) noexcept
bool QskGradient::operator==( const QskGradient& other ) const noexcept bool QskGradient::operator==( const QskGradient& other ) const noexcept
{ {
return ( m_type == other.m_type ) return ( m_type == other.m_type )
&& ( m_spread == other.m_spread ) && ( m_spreadMode == other.m_spreadMode )
&& ( m_values[0] == other.m_values[0] ) && ( m_values[0] == other.m_values[0] )
&& ( m_values[1] == other.m_values[1] ) && ( m_values[1] == other.m_values[1] )
&& ( m_values[2] == other.m_values[2] ) && ( m_values[2] == other.m_values[2] )
@ -346,9 +346,9 @@ void QskGradient::setAlpha( int alpha )
m_isDirty = true; m_isDirty = true;
} }
void QskGradient::setSpread( Spread spread ) void QskGradient::setSpreadMode( SpreadMode spreadMode )
{ {
m_spread = spread; m_spreadMode = spreadMode;
} }
void QskGradient::reverse() void QskGradient::reverse()
@ -593,26 +593,20 @@ void QskGradient::resetDirection()
QGradient QskGradient::toQGradient() const QGradient QskGradient::toQGradient() const
{ {
switch( m_type ) QGradient g;
switch( static_cast< int >( m_type ) )
{ {
case Linear: case Linear:
{ {
QLinearGradient g( m_values[0], m_values[1], m_values[2], m_values[3] ); g = QLinearGradient( m_values[0], m_values[1], m_values[2], m_values[3] );
g.setCoordinateMode( QGradient::ObjectMode ); break;
g.setSpread( static_cast< QGradient::Spread >( m_spread ) );
g.setStops( qskToQGradientStops( m_stops ) );
return g;
} }
case Radial: case Radial:
{ {
QRadialGradient g( m_values[0], m_values[1], m_values[2] ); g = QRadialGradient( m_values[0], m_values[1], m_values[2] );
g.setCoordinateMode( QGradient::ObjectMode ); break;
g.setSpread( static_cast< QGradient::Spread >( m_spread ) );
g.setStops( qskToQGradientStops( m_stops ) );
return g;
} }
case Conic: case Conic:
@ -623,24 +617,17 @@ QGradient QskGradient::toQGradient() const
"QskGradient: spanAngle got lost, when converting to QConicalGradient"; "QskGradient: spanAngle got lost, when converting to QConicalGradient";
} }
QConicalGradient g( m_values[0], m_values[1], m_values[2] ); g = QConicalGradient( m_values[0], m_values[1], m_values[2] );
g.setCoordinateMode( QGradient::ObjectMode ); break;
g.setSpread( static_cast< QGradient::Spread >( m_spread ) );
g.setStops( qskToQGradientStops( m_stops ) );
return g;
}
default:
{
QGradient g;
g.setCoordinateMode( QGradient::ObjectMode );
g.setSpread( static_cast< QGradient::Spread >( m_spread ) );
g.setStops( qskToQGradientStops( m_stops ) );
return g;
} }
} }
g.setCoordinateMode( QGradient::ObjectMode );
g.setSpread( static_cast< QGradient::Spread >( m_spreadMode ) );
g.setStops( qskToQGradientStops( m_stops ) );
return g;
} }
QGradient QskGradient::toQGradient( const QRectF& rect ) const QGradient QskGradient::toQGradient( const QRectF& rect ) const
@ -772,7 +759,7 @@ QDebug operator<<( QDebug debug, const QskGradient& gradient )
} }
} }
switch( gradient.spread() ) switch( gradient.spreadMode() )
{ {
case QskGradient::RepeatSpread: case QskGradient::RepeatSpread:
debug << " RP"; debug << " RP";

View File

@ -30,7 +30,7 @@ class QSK_EXPORT QskGradient
Q_PROPERTY( QskGradientStops stops READ stops WRITE setStops ) Q_PROPERTY( QskGradientStops stops READ stops WRITE setStops )
Q_PROPERTY( Spread spread READ spread WRITE setSpread ) Q_PROPERTY( SpreadMode spreadMode READ spreadMode WRITE setSpreadMode )
Q_PROPERTY( bool valid READ isValid ) Q_PROPERTY( bool valid READ isValid )
Q_PROPERTY( bool visible READ isVisible ) Q_PROPERTY( bool visible READ isVisible )
@ -49,13 +49,13 @@ class QSK_EXPORT QskGradient
}; };
Q_ENUM( Type ) Q_ENUM( Type )
enum Spread enum SpreadMode
{ {
PadSpread, PadSpread,
ReflectSpread, ReflectSpread,
RepeatSpread RepeatSpread
}; };
Q_ENUM( Spread ) Q_ENUM( SpreadMode )
QskGradient() noexcept = default; QskGradient() noexcept = default;
@ -122,8 +122,8 @@ class QSK_EXPORT QskGradient
void setAlpha( int alpha ); void setAlpha( int alpha );
void setSpread( Spread ); void setSpreadMode( SpreadMode );
Spread spread() const noexcept; SpreadMode spreadMode() const noexcept;
void reverse(); void reverse();
QskGradient reversed() const; QskGradient reversed() const;
@ -160,7 +160,7 @@ class QSK_EXPORT QskGradient
qreal m_values[4] = {}; qreal m_values[4] = {};
Type m_type = Stops; Type m_type = Stops;
Spread m_spread = PadSpread; SpreadMode m_spreadMode = PadSpread;
mutable bool m_isDirty = false; mutable bool m_isDirty = false;
mutable bool m_isValid = false; mutable bool m_isValid = false;
@ -234,9 +234,9 @@ inline QRgb QskGradient::rgbEnd() const
return m_stops.isEmpty() ? qRgba( 0, 0, 0, 255 ) : m_stops.last().rgb(); return m_stops.isEmpty() ? qRgba( 0, 0, 0, 255 ) : m_stops.last().rgb();
} }
inline QskGradient::Spread QskGradient::spread() const noexcept inline QskGradient::SpreadMode QskGradient::spreadMode() const noexcept
{ {
return m_spread; return m_spreadMode;
} }
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM

View File

@ -18,7 +18,7 @@ namespace
class Texture : public QSGPlainTexture class Texture : public QSGPlainTexture
{ {
public: public:
Texture( const QskGradientStops& stops, QskGradient::Spread spread ) Texture( const QskGradientStops& stops, QskGradient::SpreadMode spreadMode )
{ {
/* /*
Qt creates tables of 1024 colors, while Chrome, Firefox, and Android Qt creates tables of 1024 colors, while Chrome, Firefox, and Android
@ -28,7 +28,7 @@ namespace
setImage( QskRgb::colorTable( 256, stops ) ); setImage( QskRgb::colorTable( 256, stops ) );
const auto wrapMode = this->wrapMode( spread ); const auto wrapMode = this->wrapMode( spreadMode );
setHorizontalWrapMode( wrapMode ); setHorizontalWrapMode( wrapMode );
setVerticalWrapMode( wrapMode ); setVerticalWrapMode( wrapMode );
@ -37,9 +37,9 @@ namespace
}; };
private: private:
static inline QSGTexture::WrapMode wrapMode( QskGradient::Spread spread ) static inline QSGTexture::WrapMode wrapMode( QskGradient::SpreadMode spreadMode )
{ {
switch ( spread ) switch ( spreadMode )
{ {
case QskGradient::RepeatSpread: case QskGradient::RepeatSpread:
return QSGTexture::Repeat; return QSGTexture::Repeat;
@ -58,17 +58,17 @@ namespace
public: public:
inline bool operator==( const HashKey& other ) const inline bool operator==( const HashKey& other ) const
{ {
return rhi == other.rhi && spread == other.spread && stops == other.stops; return rhi == other.rhi && spreadMode == other.spreadMode && stops == other.stops;
} }
const void* rhi; const void* rhi;
const QskGradientStops stops; const QskGradientStops stops;
const QskGradient::Spread spread; const QskGradient::SpreadMode spreadMode;
}; };
inline size_t qHash( const HashKey& key, size_t seed = 0 ) inline size_t qHash( const HashKey& key, size_t seed = 0 )
{ {
size_t values = seed + key.spread; size_t values = seed + key.spreadMode;
for ( const auto& stop : key.stops ) for ( const auto& stop : key.stops )
values += stop.rgb(); values += stop.rgb();
@ -84,7 +84,7 @@ namespace
void cleanupRhi( const QRhi* ); void cleanupRhi( const QRhi* );
Texture* texture( const void* rhi, Texture* texture( const void* rhi,
const QskGradientStops&, QskGradient::Spread ); const QskGradientStops&, QskGradient::SpreadMode );
private: private:
QHash< HashKey, Texture* > m_hashTable; QHash< HashKey, Texture* > m_hashTable;
@ -107,14 +107,14 @@ static void qskCleanupRhi( const QRhi* rhi )
} }
Texture* Cache::texture( const void* rhi, Texture* Cache::texture( const void* rhi,
const QskGradientStops& stops, QskGradient::Spread spread ) const QskGradientStops& stops, QskGradient::SpreadMode spreadMode )
{ {
const HashKey key { rhi, stops, spread }; const HashKey key { rhi, stops, spreadMode };
auto texture = m_hashTable[key]; auto texture = m_hashTable[key];
if ( texture == nullptr ) if ( texture == nullptr )
{ {
texture = new Texture( stops, spread ); texture = new Texture( stops, spreadMode );
m_hashTable[ key ] = texture; m_hashTable[ key ] = texture;
if ( rhi != nullptr ) if ( rhi != nullptr )
@ -151,7 +151,7 @@ void Cache::cleanupRhi( const QRhi* rhi )
} }
QSGTexture* QskColorRamp::texture( const void* rhi, QSGTexture* QskColorRamp::texture( const void* rhi,
const QskGradientStops& stops, QskGradient::Spread spread ) const QskGradientStops& stops, QskGradient::SpreadMode spreadMode )
{ {
if ( s_cache == nullptr ) if ( s_cache == nullptr )
{ {
@ -166,5 +166,5 @@ QSGTexture* QskColorRamp::texture( const void* rhi,
qAddPostRoutine( qskCleanupCache ); qAddPostRoutine( qskCleanupCache );
} }
return s_cache->texture( rhi, stops, spread ); return s_cache->texture( rhi, stops, spreadMode );
} }

View File

@ -13,7 +13,8 @@ class QSGTexture;
namespace QskColorRamp namespace QskColorRamp
{ {
QSGTexture* texture( const void* rhi, const QskGradientStops&, QskGradient::Spread ); QSGTexture* texture( const void* rhi,
const QskGradientStops&, QskGradient::SpreadMode );
} }
#endif #endif

View File

@ -52,7 +52,7 @@ namespace
{ {
const auto mat = static_cast< const GradientMaterial* >( other ); const auto mat = static_cast< const GradientMaterial* >( other );
if ( ( spread() == mat->spread() ) && ( stops() == mat->stops() ) ) if ( ( spreadMode() == mat->spreadMode() ) && ( stops() == mat->stops() ) )
return 0; return 0;
return QSGMaterial::compare( other ); return QSGMaterial::compare( other );
@ -107,7 +107,7 @@ namespace
updateUniformValues( material ); updateUniformValues( material );
auto texture = QskColorRamp::texture( auto texture = QskColorRamp::texture(
nullptr, material->stops(), material->spread() ); nullptr, material->stops(), material->spreadMode() );
texture->bind(); texture->bind();
} }
@ -146,7 +146,7 @@ namespace
auto material = static_cast< const GradientMaterial* >( newMaterial ); auto material = static_cast< const GradientMaterial* >( newMaterial );
auto texture = QskColorRamp::texture( auto texture = QskColorRamp::texture(
state.rhi(), material->stops(), material->spread() ); state.rhi(), material->stops(), material->spreadMode() );
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
texture->updateRhiTexture( state.rhi(), state.resourceUpdateBatch() ); texture->updateRhiTexture( state.rhi(), state.resourceUpdateBatch() );
@ -186,9 +186,9 @@ namespace
the number of color ramps. TODO ... the number of color ramps. TODO ...
*/ */
if ( gradient.spread() != spread() ) if ( gradient.spreadMode() != spreadMode() )
{ {
setSpread( gradient.spread() ); setSpreadMode( gradient.spreadMode() );
changed = true; changed = true;
} }
@ -347,9 +347,9 @@ namespace
changed = true; changed = true;
} }
if ( gradient.spread() != spread() ) if ( gradient.spreadMode() != spreadMode() )
{ {
setSpread( gradient.spread() ); setSpreadMode( gradient.spreadMode() );
changed = true; changed = true;
} }
@ -518,9 +518,9 @@ namespace
changed = true; changed = true;
} }
if ( gradient.spread() != spread() ) if ( gradient.spreadMode() != spreadMode() )
{ {
setSpread( gradient.spread() ); setSpreadMode( gradient.spreadMode() );
changed = true; changed = true;
} }

View File

@ -19,19 +19,19 @@ class QSK_EXPORT QskGradientMaterial : public QSGMaterial
QskGradient::Type gradientType() const; QskGradient::Type gradientType() const;
const QskGradientStops& stops() const; const QskGradientStops& stops() const;
QskGradient::Spread spread() const; QskGradient::SpreadMode spreadMode() const;
protected: protected:
QskGradientMaterial( QskGradient::Type ); QskGradientMaterial( QskGradient::Type );
void setStops( const QskGradientStops& ); void setStops( const QskGradientStops& );
void setSpread( QskGradient::Spread ); void setSpreadMode( QskGradient::SpreadMode );
private: private:
const QskGradient::Type m_gradientType; const QskGradient::Type m_gradientType;
QskGradientStops m_stops; QskGradientStops m_stops;
QskGradient::Spread m_spread = QskGradient::PadSpread; QskGradient::SpreadMode m_spreadMode = QskGradient::PadSpread;
}; };
inline QskGradient::Type QskGradientMaterial::gradientType() const inline QskGradient::Type QskGradientMaterial::gradientType() const
@ -44,9 +44,9 @@ inline void QskGradientMaterial::setStops( const QskGradientStops& stops )
m_stops = stops; m_stops = stops;
} }
inline void QskGradientMaterial::setSpread( QskGradient::Spread spread ) inline void QskGradientMaterial::setSpreadMode( QskGradient::SpreadMode spreadMode )
{ {
m_spread = spread; m_spreadMode = spreadMode;
} }
inline const QskGradientStops& QskGradientMaterial::stops() const inline const QskGradientStops& QskGradientMaterial::stops() const
@ -54,9 +54,9 @@ inline const QskGradientStops& QskGradientMaterial::stops() const
return m_stops; return m_stops;
} }
inline QskGradient::Spread QskGradientMaterial::spread() const inline QskGradient::SpreadMode QskGradientMaterial::spreadMode() const
{ {
return m_spread; return m_spreadMode;
} }
#endif #endif