QskRgbValue -> QskRgb

This commit is contained in:
Uwe Rathmann 2020-08-15 13:29:17 +02:00
parent 3519e92e91
commit 5bd66a27a8
24 changed files with 82 additions and 80 deletions

View File

@ -90,7 +90,7 @@ static void addRectangles2( QskLinearBox* parent )
static void addRectangles3( QskLinearBox* parent ) static void addRectangles3( QskLinearBox* parent )
{ {
using namespace QskRgbValue; using namespace QskRgb;
const auto borderTheme = QskRgbPalette::Grey; const auto borderTheme = QskRgbPalette::Grey;
const auto fillTheme = QskRgbPalette::Blue; const auto fillTheme = QskRgbPalette::Blue;
@ -141,7 +141,7 @@ static void addRectangles5( QskLinearBox* parent )
static void addRectangles6( QskLinearBox* parent ) static void addRectangles6( QskLinearBox* parent )
{ {
using namespace QskRgbValue; using namespace QskRgb;
const auto borderTheme = QskRgbPalette::Grey; const auto borderTheme = QskRgbPalette::Grey;
const auto fillTheme = QskRgbPalette::Lime; const auto fillTheme = QskRgbPalette::Lime;
@ -192,7 +192,7 @@ static void addRectangles8( QskLinearBox* parent )
static void addRectangles9( QskLinearBox* parent ) static void addRectangles9( QskLinearBox* parent )
{ {
using namespace QskRgbValue; using namespace QskRgb;
const auto borderTheme = QskRgbPalette::Grey; const auto borderTheme = QskRgbPalette::Grey;
const auto fillTheme = QskRgbPalette::Lime; const auto fillTheme = QskRgbPalette::Lime;
@ -350,7 +350,7 @@ static void addRectanglesRest( QskLinearBox* parent )
box->setShape( 20, Qt::AbsoluteSize ); box->setShape( 20, Qt::AbsoluteSize );
box->setBorderWidth( 2, 10, 40, 2 ); box->setBorderWidth( 2, 10, 40, 2 );
box->setBorderColor( "Crimson" ); box->setBorderColor( "Crimson" );
box->setGradient( QskRgbValue::WhiteSmoke ); box->setGradient( QskRgb::WhiteSmoke );
box = new Box( parent ); box = new Box( parent );
box->setShape( 100, Qt::RelativeSize ); box->setShape( 100, Qt::RelativeSize );

View File

@ -15,7 +15,7 @@ Page::Page( Qt::Orientation orientation, QQuickItem* parent )
setPanel( true ); setPanel( true );
setBoxShapeHint( QskBox::Panel, 8 ); setBoxShapeHint( QskBox::Panel, 8 );
setGradient( QskRgbValue::GhostWhite ); setGradient( QskRgb::GhostWhite );
setMargins( 5 ); setMargins( 5 );
setPadding( 10 ); setPadding( 10 );

View File

@ -67,7 +67,7 @@ namespace
LabelPage::LabelPage( QQuickItem* parent ) LabelPage::LabelPage( QQuickItem* parent )
: Page( Qt::Vertical, parent ) : Page( Qt::Vertical, parent )
{ {
setGradient( QskRgbValue::AliceBlue ); setGradient( QskRgb::AliceBlue );
setSpacing( 40 ); setSpacing( 40 );
(void) new TextBox( this ); (void) new TextBox( this );

View File

@ -45,7 +45,7 @@ namespace
ProgressBarPage::ProgressBarPage( QQuickItem* parent ) ProgressBarPage::ProgressBarPage( QQuickItem* parent )
: Page( Qt::Horizontal, parent ) : Page( Qt::Horizontal, parent )
{ {
setGradient( QskRgbValue::AliceBlue ); setGradient( QskRgb::AliceBlue );
setSpacing( 40 ); setSpacing( 40 );
populate(); populate();

View File

@ -24,19 +24,19 @@ CustomSlider::CustomSlider( QQuickItem* parentItem )
#if 0 #if 0
const QskGradient fillGradient( QskGradient::Horizontal, const QskGradient fillGradient( QskGradient::Horizontal,
QskRgbValue::Grey700, QskRgbValue::Grey500 ); QskRgb::Grey700, QskRgb::Grey500 );
#else #else
const QskGradient fillGradient( QskRgbValue::Grey700 ); const QskGradient fillGradient( QskRgb::Grey700 );
#endif #endif
setBoxShapeHint( Fill, 0 ); setBoxShapeHint( Fill, 0 );
setGradientHint( Fill, fillGradient ); setGradientHint( Fill, fillGradient );
setColor( Scale, qRgb( 178, 178, 178 ) ); // for the ticks setColor( Scale, qRgb( 178, 178, 178 ) ); // for the ticks
setColor( QskSlider::Handle, QskRgbValue::Grey800 ); setColor( QskSlider::Handle, QskRgb::Grey800 );
for ( auto state : { Pressed, Focused | Hovered, Hovered, Focused } ) for ( auto state : { Pressed, Focused | Hovered, Hovered, Focused } )
setColor( QskSlider::Handle | Color | state, QskRgbValue::Orange600 ); setColor( QskSlider::Handle | Color | state, QskRgb::Orange600 );
setAnimation( QskSlider::Handle | Color, 1000 ); setAnimation( QskSlider::Handle | Color, 1000 );
for ( auto state : { Focused | Hovered, Hovered, Focused } ) for ( auto state : { Focused | Hovered, Hovered, Focused } )

View File

@ -301,7 +301,7 @@ QSGNode* CustomSliderSkinlet::updateDecorationNode(
auto labelText = QString::number( slider->minimum() + slider->stepSize() * i, 'f', 0 ); auto labelText = QString::number( slider->minimum() + slider->stepSize() * i, 'f', 0 );
labelNode->setTextData( slider, labelText, QRectF( x, y, 0, 0 ), labelNode->setTextData( slider, labelText, QRectF( x, y, 0, 0 ),
qskLabelFont, QskTextOptions(), QskTextColors( QskRgbValue::Grey700 ), qskLabelFont, QskTextOptions(), QskTextColors( QskRgb::Grey700 ),
Qt::AlignHCenter, Qsk::Normal ); Qt::AlignHCenter, Qsk::Normal );
labelNode = static_cast< decltype( labelNode ) >( labelNode->nextSibling() ); labelNode = static_cast< decltype( labelNode ) >( labelNode->nextSibling() );

View File

@ -17,7 +17,7 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
: QskSlider( parentItem ) : QskSlider( parentItem )
{ {
using namespace QskAspect; using namespace QskAspect;
using namespace QskRgbValue; using namespace QskRgb;
const qreal h = 30; const qreal h = 30;
const qreal w = 2.0 * h; const qreal w = 2.0 * h;

View File

@ -12,7 +12,7 @@
SliderPage::SliderPage( QQuickItem* parentItem ) SliderPage::SliderPage( QQuickItem* parentItem )
: Page( Qt::Vertical, parentItem ) : Page( Qt::Vertical, parentItem )
{ {
setGradient( QskRgbValue::PeachPuff ); setGradient( QskRgb::PeachPuff );
setMargins( 10 ); setMargins( 10 );
setSpacing( 20 ); setSpacing( 20 );

View File

@ -129,7 +129,7 @@ DynamicConstraintsPage::DynamicConstraintsPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent ) : QskLinearBox( Qt::Vertical, parent )
{ {
setMargins( 10 ); setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue ); setBackgroundColor( QskRgb::LightSteelBlue );
auto box = new Box(); auto box = new Box();

View File

@ -89,7 +89,7 @@ FlowLayoutPage::FlowLayoutPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent ) : QskLinearBox( Qt::Vertical, parent )
{ {
setMargins( 10 ); setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue ); setBackgroundColor( QskRgb::LightSteelBlue );
auto box = new Box(); auto box = new Box();

View File

@ -67,7 +67,7 @@ GridLayoutPage::GridLayoutPage( QQuickItem* parent )
: QskControl( parent ) : QskControl( parent )
{ {
setMargins( 10 ); setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue ); setBackgroundColor( QskRgb::LightSteelBlue );
setAutoLayoutChildren( true ); setAutoLayoutChildren( true );

View File

@ -82,7 +82,7 @@ LinearLayoutPage::LinearLayoutPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent ) : QskLinearBox( Qt::Vertical, parent )
{ {
setMargins( 10 ); setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue ); setBackgroundColor( QskRgb::LightSteelBlue );
auto box = new Box(); auto box = new Box();

View File

@ -160,7 +160,7 @@ StackLayoutPage::StackLayoutPage( QQuickItem* parent )
setObjectName( "StackLayoutPage" ); setObjectName( "StackLayoutPage" );
setMargins( 10 ); setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue ); setBackgroundColor( QskRgb::LightSteelBlue );
auto box = new StackBox(); auto box = new StackBox();

View File

@ -161,7 +161,7 @@ class MySkin : public QskSkin
void setGraphicFilter( int role, QRgb rgb ) void setGraphicFilter( int role, QRgb rgb )
{ {
QskColorFilter filter; QskColorFilter filter;
filter.addColorSubstitution( QskRgbValue::Khaki, rgb ); filter.addColorSubstitution( QskRgb::Khaki, rgb );
QskSkin::setGraphicFilter( role, filter ); QskSkin::setGraphicFilter( role, filter );
} }
@ -176,10 +176,10 @@ class MySkin1 : public MySkin
public: public:
MySkin1() MySkin1()
{ {
using namespace QskRgbValue; using namespace QskRgb;
setGraphicFilter( GraphicRoleNormal, QskRgbValue::Crimson ); setGraphicFilter( GraphicRoleNormal, Crimson );
setGraphicFilter( GraphicRoleInverted, QskRgbValue::Gold ); setGraphicFilter( GraphicRoleInverted, Gold );
initFocusIndicatorHints( 2, 3, 6, DarkBlue ); initFocusIndicatorHints( 2, 3, 6, DarkBlue );
initBoxHints( 2, 8, DarkCyan, LightCyan ); initBoxHints( 2, 8, DarkCyan, LightCyan );
@ -198,10 +198,10 @@ class MySkin2 : public MySkin
public: public:
MySkin2() MySkin2()
{ {
using namespace QskRgbValue; using namespace QskRgb;
setGraphicFilter( GraphicRoleNormal, QskRgbValue::HotPink ); setGraphicFilter( GraphicRoleNormal, HotPink );
setGraphicFilter( GraphicRoleInverted, QskRgbValue::White ); setGraphicFilter( GraphicRoleInverted, White );
initFocusIndicatorHints( 2, 6, 6, Crimson ); initFocusIndicatorHints( 2, 6, 6, Crimson );
initBoxHints( 4, 30, LightPink, MistyRose ); initBoxHints( 4, 30, LightPink, MistyRose );

View File

@ -54,7 +54,7 @@ class GraphicLabel : public QskGraphicLabel
} }
else else
{ {
gradient.setColor( QskRgbValue::Wheat ); gradient.setColor( QskRgb::Wheat );
setGraphicRole( Normal ); setGraphicRole( Normal );
} }

View File

@ -58,9 +58,9 @@ namespace
class ColorPalette class ColorPalette
{ {
public: public:
ColorPalette( const QColor base = QColor::fromRgba( QskRgbValue::Grey100 ), ColorPalette( const QColor base = QColor::fromRgba( QskRgb::Grey100 ),
const QColor& accent = QColor::fromRgba( QskRgbValue::Blue500 ), const QColor& accent = QColor::fromRgba( QskRgb::Blue500 ),
const QColor& contrast = QColor::fromRgba( QskRgbValue::White ) ) const QColor& contrast = QColor::fromRgba( QskRgb::White ) )
{ {
baseColor = base; baseColor = base;
accentColor = accent; accentColor = accent;
@ -75,7 +75,7 @@ namespace
lighter200 = baseColor.lighter( 200 ); lighter200 = baseColor.lighter( 200 );
textColor = ( baseColor.value() > 128 ) textColor = ( baseColor.value() > 128 )
? QskRgbValue::Black : QskRgbValue::White; ? QskRgb::Black : QskRgb::White;
} }
QColor accentColor; QColor accentColor;
@ -105,8 +105,8 @@ QskMaterialSkin::QskMaterialSkin( QObject* parent )
: Inherited( parent ) : Inherited( parent )
, m_data( new PrivateData() ) , m_data( new PrivateData() )
{ {
m_data->palette = ColorPalette( QskRgbValue::Grey100, m_data->palette = ColorPalette( QskRgb::Grey100,
QskRgbValue::Blue500, QskRgbValue::White ); QskRgb::Blue500, QskRgb::White );
// Default theme colors // Default theme colors
setupFonts( "Roboto" ); setupFonts( "Roboto" );
@ -239,7 +239,7 @@ void QskMaterialSkin::initTextInputHints()
void QskMaterialSkin::initProgressBarHints() void QskMaterialSkin::initProgressBarHints()
{ {
using namespace QskAspect; using namespace QskAspect;
using namespace QskRgbValue; using namespace QskRgb;
using Q = QskProgressBar; using Q = QskProgressBar;
const auto& pal = m_data->palette; const auto& pal = m_data->palette;
@ -322,7 +322,7 @@ void QskMaterialSkin::initPageIndicatorHints()
void QskMaterialSkin::initPushButtonHints() void QskMaterialSkin::initPushButtonHints()
{ {
using namespace QskAspect; using namespace QskAspect;
using namespace QskRgbValue; using namespace QskRgb;
using Q = QskPushButton; using Q = QskPushButton;
const auto& pal = m_data->palette; const auto& pal = m_data->palette;
@ -383,7 +383,7 @@ void QskMaterialSkin::initPushButtonHints()
void QskMaterialSkin::initDialogButtonHints() void QskMaterialSkin::initDialogButtonHints()
{ {
using namespace QskAspect; using namespace QskAspect;
using namespace QskRgbValue; using namespace QskRgb;
using Q = QskDialogButton; using Q = QskDialogButton;
const auto& pal = m_data->palette; const auto& pal = m_data->palette;
@ -449,7 +449,7 @@ void QskMaterialSkin::initDialogButtonBoxHints()
void QskMaterialSkin::initSliderHints() void QskMaterialSkin::initSliderHints()
{ {
using namespace QskAspect; using namespace QskAspect;
using namespace QskRgbValue; using namespace QskRgb;
using Q = QskSlider; using Q = QskSlider;
const auto& pal = m_data->palette; const auto& pal = m_data->palette;
@ -556,7 +556,7 @@ void QskMaterialSkin::initTabButtonHints()
edge = Qt::Edge( 0 ); // making gcc4 happy edge = Qt::Edge( 0 ); // making gcc4 happy
} }
setGradient( aspect, QskRgbValue::White ); setGradient( aspect, QskRgb::White );
// The highlighted button has a accented bar at one edge // The highlighted button has a accented bar at one edge
setBoxShape( aspect, 0 ); setBoxShape( aspect, 0 );
@ -565,7 +565,7 @@ void QskMaterialSkin::initTabButtonHints()
border.setWidthAt( edge, 3 ); border.setWidthAt( edge, 3 );
setBoxBorderMetrics( aspect, border ); setBoxBorderMetrics( aspect, border );
QskBoxBorderColors borderColors( QskRgbValue::White ); QskBoxBorderColors borderColors( QskRgb::White );
setBoxBorderColors( aspect, borderColors ); setBoxBorderColors( aspect, borderColors );
borderColors.setColorsAt( edge, pal.accentColor ); borderColors.setColorsAt( edge, pal.accentColor );
@ -581,7 +581,7 @@ void QskMaterialSkin::initTabButtonHints()
setColor( Q::Text, pal.textColor ); setColor( Q::Text, pal.textColor );
setColor( Q::Text | Q::Checkable | Q::Disabled, qskShadedColor( pal.textColor, 0.6 ) ); setColor( Q::Text | Q::Checkable | Q::Disabled, qskShadedColor( pal.textColor, 0.6 ) );
setColor( Q::Text | Q::Disabled, QskRgbValue::Grey600 ); setColor( Q::Text | Q::Disabled, QskRgb::Grey600 );
} }
void QskMaterialSkin::initTabBarHints() void QskMaterialSkin::initTabBarHints()
@ -665,7 +665,7 @@ void QskMaterialSkin::initScrollViewHints()
setBoxShape( Q::Viewport, 5 ); setBoxShape( Q::Viewport, 5 );
setBoxBorderMetrics( Q::Viewport, 1 ); setBoxBorderMetrics( Q::Viewport, 1 );
setGradient( Q::Viewport, QskRgbValue::White ); setGradient( Q::Viewport, QskRgb::White );
setBoxBorderColors( Q::Viewport, Qt::black ); setBoxBorderColors( Q::Viewport, Qt::black );
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } ) for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
@ -682,7 +682,7 @@ void QskMaterialSkin::initScrollViewHints()
setBoxShape( subControl, 3 ); setBoxShape( subControl, 3 );
setBoxBorderMetrics( subControl, 1 ); setBoxBorderMetrics( subControl, 1 );
setGradient( subControl, pal.accentColor ); setGradient( subControl, pal.accentColor );
setBoxBorderColors( subControl, QskRgbValue::White ); setBoxBorderColors( subControl, QskRgb::White );
setAnimation( subControl | Color, qskDuration ); setAnimation( subControl | Color, qskDuration );
} }

View File

@ -46,7 +46,7 @@ namespace
class ColorPalette class ColorPalette
{ {
public: public:
ColorPalette( const QColor& themeColor = QskRgbValue::Silver ) ColorPalette( const QColor& themeColor = QskRgb::Silver )
{ {
const bool isBright = themeColor.value() > 128; const bool isBright = themeColor.value() > 128;
@ -61,30 +61,32 @@ namespace
darker150 = themeColor.darker( 150 ); darker150 = themeColor.darker( 150 );
darker200 = themeColor.darker( 200 ); darker200 = themeColor.darker( 200 );
using namespace QskRgb;
if ( isBright ) if ( isBright )
{ {
themeForeground = QskRgbValue::Black; themeForeground = Black;
contrasted = QskRgbValue::Gainsboro; contrasted = Gainsboro;
contrastedText = QskRgbValue::Black; contrastedText = Black;
highlighted = QskRgbValue::RoyalBlue; highlighted = RoyalBlue;
highlightedText = QskRgbValue::White; highlightedText = White;
base = QskRgbValue::White; base = White;
baseActive = QskRgbValue::Beige; baseActive = Beige;
} }
else else
{ {
themeForeground = QskRgbValue::White; themeForeground = White;
contrasted = QskRgbValue::DarkGrey; contrasted = DarkGrey;
contrastedText = QskRgbValue::White; contrastedText = White;
highlighted = QskRgbValue::BlueGrey500; highlighted = BlueGrey500;
highlightedText = QskRgbValue::White; highlightedText = White;
base = QskRgbValue::Black; base = Black;
baseActive = base.lighter( 110 ); baseActive = base.lighter( 110 );
} }
} }

View File

@ -166,7 +166,7 @@ QskBoxBorderColors QskBoxBorderColors::interpolated(
for ( size_t i = 0; i < 4; i++ ) for ( size_t i = 0; i < 4; i++ )
{ {
colors.m_colors[ i ] = QskRgbValue::interpolated( colors.m_colors[ i ] = QskRgb::interpolated(
m_colors[ i ], to.m_colors[ i ], ratio ); m_colors[ i ], to.m_colors[ i ], ratio );
} }

View File

@ -68,7 +68,7 @@ static inline QColor qskInterpolated(
return s1.color(); return s1.color();
const qreal ratio = ( pos - s1.position() ) / ( s2.position() - s1.position() ); const qreal ratio = ( pos - s1.position() ) / ( s2.position() - s1.position() );
return QskRgbValue::interpolated( s1.color(), s2.color(), ratio ); return QskRgb::interpolated( s1.color(), s2.color(), ratio );
} }
static inline bool qskComparePositions( static inline bool qskComparePositions(
@ -216,7 +216,7 @@ QColor QskGradientStop::interpolated(
return max->color(); return max->color();
const qreal r = ( position - min->position() ) / ( max->position() - min->position() ); const qreal r = ( position - min->position() ) / ( max->position() - min->position() );
return QskRgbValue::interpolated( min->color(), max->color(), r ); return QskRgb::interpolated( min->color(), max->color(), r );
} }
QskGradient::QskGradient() QskGradient::QskGradient()
@ -507,7 +507,7 @@ QskGradient QskGradient::interpolated(
QVector< QskGradientStop > s2 = to.m_stops; QVector< QskGradientStop > s2 = to.m_stops;
for ( int i = 0; i < s2.count(); i++ ) for ( int i = 0; i < s2.count(); i++ )
{ {
const QColor c2 = QskRgbValue::interpolated( const QColor c2 = QskRgb::interpolated(
c, s2[ i ].color(), value ); c, s2[ i ].color(), value );
s2[ i ].setColor( c2 ); s2[ i ].setColor( c2 );
@ -525,7 +525,7 @@ QskGradient QskGradient::interpolated(
QVector< QskGradientStop > s2 = m_stops; QVector< QskGradientStop > s2 = m_stops;
for ( int i = 0; i < s2.count(); i++ ) for ( int i = 0; i < s2.count(); i++ )
{ {
const QColor c2 = QskRgbValue::interpolated( const QColor c2 = QskRgb::interpolated(
s2[ i ].color(), c, value ); s2[ i ].color(), c, value );
s2[ i ].setColor( c2 ); s2[ i ].setColor( c2 );
@ -546,7 +546,7 @@ QskGradient QskGradient::interpolated(
for ( int i = 0; i < s1.count(); i++ ) for ( int i = 0; i < s1.count(); i++ )
{ {
const QColor c2 = QskRgbValue::interpolated( const QColor c2 = QskRgb::interpolated(
s1[ i ].color(), s2[ i ].color(), value ); s1[ i ].color(), s2[ i ].color(), value );
s2[ i ].setColor( c2 ); s2[ i ].setColor( c2 );
@ -571,7 +571,7 @@ QskGradient QskGradient::interpolated(
for ( int i = 0; i < s2.count(); i++ ) for ( int i = 0; i < s2.count(); i++ )
{ {
const QColor c2 = QskRgbValue::interpolated( const QColor c2 = QskRgb::interpolated(
s2[ i ].color(), c, 2 * value ); s2[ i ].color(), c, 2 * value );
s2[ i ].setColor( c2 ); s2[ i ].setColor( c2 );
@ -585,7 +585,7 @@ QskGradient QskGradient::interpolated(
for ( int i = 0; i < s2.count(); i++ ) for ( int i = 0; i < s2.count(); i++ )
{ {
const QColor c2 = QskRgbValue::interpolated( const QColor c2 = QskRgb::interpolated(
c, s2[ i ].color(), 2 * ( value - 0.5 ) ); c, s2[ i ].color(), 2 * ( value - 0.5 ) );
s2[ i ].setColor( c2 ); s2[ i ].setColor( c2 );

View File

@ -22,7 +22,7 @@ namespace
public: public:
Palette( int index ) Palette( int index )
{ {
using namespace QskRgbValue; using namespace QskRgb;
static constexpr QRgb table[][ Palette::NumWeights ] = static constexpr QRgb table[][ Palette::NumWeights ] =
{ {

View File

@ -78,7 +78,7 @@ static inline QColor qskInterpolatedColor(
return c2; return c2;
} }
QRgb QskRgbValue::interpolated( QRgb rgb1, QRgb rgb2, qreal ratio ) QRgb QskRgb::interpolated( QRgb rgb1, QRgb rgb2, qreal ratio )
{ {
// interpolating in HSV usually provides better results !! // interpolating in HSV usually provides better results !!
@ -93,7 +93,7 @@ QRgb QskRgbValue::interpolated( QRgb rgb1, QRgb rgb2, qreal ratio )
return qRgba( r, g, b, a ); return qRgba( r, g, b, a );
} }
QColor QskRgbValue::interpolated( const QColor& c1, const QColor& c2, qreal ratio ) QColor QskRgb::interpolated( const QColor& c1, const QColor& c2, qreal ratio )
{ {
if ( c1 == c2 ) if ( c1 == c2 )
return c2; return c2;
@ -123,9 +123,9 @@ QColor QskRgbValue::interpolated( const QColor& c1, const QColor& c2, qreal rati
return qskInterpolatedColor( c1.convertTo( c2.spec() ), c2, ratio ); return qskInterpolatedColor( c1.convertTo( c2.spec() ), c2, ratio );
} }
QRgb QskRgbValue::rgb( Qt::GlobalColor color ) QRgb QskRgb::rgb( Qt::GlobalColor color )
{ {
using namespace QskRgbValue; using namespace QskRgb;
static constexpr QRgb rgbValues[] = static constexpr QRgb rgbValues[] =
{ {
@ -154,7 +154,7 @@ QRgb QskRgbValue::rgb( Qt::GlobalColor color )
return rgbValues[ color ]; return rgbValues[ color ];
} }
QRgb QskRgbValue::lighter( QRgb rgb, int factor ) noexcept QRgb QskRgb::lighter( QRgb rgb, int factor ) noexcept
{ {
if ( factor <= 0 ) if ( factor <= 0 )
return rgb; return rgb;
@ -163,7 +163,7 @@ QRgb QskRgbValue::lighter( QRgb rgb, int factor ) noexcept
return QColor::fromRgba( rgb ).lighter( factor ).rgba(); return QColor::fromRgba( rgb ).lighter( factor ).rgba();
} }
QRgb QskRgbValue::darker( QRgb rgb, int factor ) noexcept QRgb QskRgb::darker( QRgb rgb, int factor ) noexcept
{ {
if ( factor <= 0 ) if ( factor <= 0 )
return rgb; return rgb;

View File

@ -435,7 +435,7 @@
RGB( AlphaMask, 0xff000000 ) \ RGB( AlphaMask, 0xff000000 ) \
RGB( ColorMask, 0x00ffffff ) RGB( ColorMask, 0x00ffffff )
namespace QskRgbValue namespace QskRgb
{ {
#define RGB( name, value ) static constexpr const QRgb name = value; #define RGB( name, value ) static constexpr const QRgb name = value;
QSK_RGB_VALUES QSK_RGB_VALUES

View File

@ -19,9 +19,9 @@ QskTextColors QskTextColors::interpolated(
const QskTextColors& to, qreal ratio ) const const QskTextColors& to, qreal ratio ) const
{ {
QskTextColors colors; QskTextColors colors;
colors.textColor = QskRgbValue::interpolated( textColor, to.textColor, ratio ); colors.textColor = QskRgb::interpolated( textColor, to.textColor, ratio );
colors.styleColor = QskRgbValue::interpolated( styleColor, to.styleColor, ratio ); colors.styleColor = QskRgb::interpolated( styleColor, to.styleColor, ratio );
colors.linkColor = QskRgbValue::interpolated( linkColor, to.linkColor, ratio ); colors.linkColor = QskRgb::interpolated( linkColor, to.linkColor, ratio );
return colors; return colors;
} }

View File

@ -16,14 +16,14 @@ static inline QRgb qskSubstitutedRgb(
// usually we have 2-3 substitutions, so we can simply iterate // usually we have 2-3 substitutions, so we can simply iterate
// and don't need to introduce some sort of sorting or search index // and don't need to introduce some sort of sorting or search index
const QRgb rgb = rgba | QskRgbValue::AlphaMask; const QRgb rgb = rgba | QskRgb::AlphaMask;
for ( const auto& s : substitions ) for ( const auto& s : substitions )
{ {
if ( rgb == s.first ) if ( rgb == s.first )
{ {
return ( s.second & QskRgbValue::ColorMask ) | return ( s.second & QskRgb::ColorMask ) |
( rgba & QskRgbValue::AlphaMask ); ( rgba & QskRgb::AlphaMask );
} }
} }
@ -105,7 +105,7 @@ static inline QskColorFilter qskInterpolatedFilter(
} }
} }
rgb = QskRgbValue::interpolated( rgb, pairTo.second, progress ); rgb = QskRgb::interpolated( rgb, pairTo.second, progress );
if ( rgb != pairTo.first ) if ( rgb != pairTo.first )
interpolated.addColorSubstitution( pairTo.first, rgb ); interpolated.addColorSubstitution( pairTo.first, rgb );
@ -132,7 +132,7 @@ static inline QskColorFilter qskInterpolatedFilter(
if ( !hasRgb ) if ( !hasRgb )
{ {
const auto rgb = QskRgbValue::interpolated( const auto rgb = QskRgb::interpolated(
pairFrom.second, pairFrom.first, progress ); pairFrom.second, pairFrom.first, progress );
if ( rgb != pairFrom.first ) if ( rgb != pairFrom.first )