2017-10-20 18:26:14 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "QskTextColors.h"
|
|
|
|
#include "QskRgbValue.h"
|
|
|
|
|
2018-07-19 12:10:48 +00:00
|
|
|
#include <qvariant.h>
|
2017-10-20 18:26:14 +00:00
|
|
|
#include <qhashfunctions.h>
|
|
|
|
|
|
|
|
uint QskTextColors::hash( uint seed ) const
|
|
|
|
{
|
|
|
|
const QRgb rgb[] =
|
|
|
|
{
|
|
|
|
textColor.rgba(),
|
|
|
|
styleColor.rgba(),
|
|
|
|
linkColor.rgba()
|
|
|
|
};
|
|
|
|
|
|
|
|
return qHashBits( rgb, sizeof( rgb ), seed );
|
|
|
|
}
|
|
|
|
|
|
|
|
QskTextColors QskTextColors::interpolated(
|
|
|
|
const QskTextColors& to, qreal ratio ) const
|
|
|
|
{
|
|
|
|
QskTextColors colors;
|
|
|
|
colors.textColor = QskRgbValue::interpolated( textColor, to.textColor, ratio );
|
|
|
|
colors.styleColor = QskRgbValue::interpolated( styleColor, to.styleColor, ratio );
|
|
|
|
colors.linkColor = QskRgbValue::interpolated( linkColor, to.linkColor, ratio );
|
|
|
|
|
|
|
|
return colors;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariant QskTextColors::interpolate( const QskTextColors& from,
|
|
|
|
const QskTextColors& to, qreal ratio )
|
|
|
|
{
|
|
|
|
return QVariant::fromValue( from.interpolated( to, ratio ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef QT_NO_DEBUG_STREAM
|
|
|
|
|
2018-07-19 12:10:48 +00:00
|
|
|
#include <qdebug.h>
|
|
|
|
|
2017-10-20 18:26:14 +00:00
|
|
|
static inline void qskDebugColor( QDebug debug, const QColor& c )
|
|
|
|
{
|
|
|
|
debug << '('
|
|
|
|
<< c.red() << ','
|
|
|
|
<< c.green() << ','
|
|
|
|
<< c.blue() << ','
|
|
|
|
<< c.alpha() << ')';
|
|
|
|
}
|
|
|
|
|
|
|
|
QDebug operator<<( QDebug debug, const QskTextColors& colors )
|
|
|
|
{
|
|
|
|
QDebugStateSaver saver( debug );
|
|
|
|
debug.nospace();
|
|
|
|
|
|
|
|
debug << "TextColors" << '(';
|
|
|
|
|
|
|
|
debug << " T";
|
|
|
|
qskDebugColor( debug, colors.textColor );
|
|
|
|
|
|
|
|
debug << ", S";
|
|
|
|
qskDebugColor( debug, colors.styleColor );
|
|
|
|
|
|
|
|
debug << ", L";
|
|
|
|
qskDebugColor( debug, colors.linkColor );
|
|
|
|
|
|
|
|
debug << " )";
|
|
|
|
|
|
|
|
return debug;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|