
* QskBoxBorderColors: Use gradients instead of colors * QskBoxBorderColors: rename API * render gradients on borders * boxes example: Also draw gradient borders * calculate proper numbers of needed border colors * fixup with example * support rounded corners * support more colors in rounded color gradients I THINK WE DON'T REALLY NEED THIS COMMIT * We don't need this commit either * Revert "We don't need this commit either" This reverts commit 2dc38064f7fee1d0505262fe5cebcf9e1fb16cea. * Revert "support more colors in rounded color gradients" This reverts commit 5754d2d0773d8273d42ae1775b53d40f5e6af26a. * fix borders for rect ellipses * play around a bit * small fixes * some helper stuff and missing stuff * user border colors * close to something working somehow * works a bit better * put it into an own function * rearrange a bit * something's off * still off, but seems like we need an additional line * works but hackish * now it works * bring back samples * correction * pimp up example * fix normal rendering * some more debugging etc. * turn around gradients * turn around rectangular gradients as well * turn around easier * more test cases * fix fill case * more test cases * clean up a bit * clean up example * clean up some more * incorporate feedback from Uwe * fix bug when using horizontal gradients
90 lines
2.3 KiB
C++
90 lines
2.3 KiB
C++
/******************************************************************************
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
*****************************************************************************/
|
|
|
|
#ifndef QSK_BOX_BORDER_COLORS_H
|
|
#define QSK_BOX_BORDER_COLORS_H
|
|
|
|
#include "QskGradient.h"
|
|
#include "QskNamespace.h"
|
|
|
|
#include <qcolor.h>
|
|
#include <qmetatype.h>
|
|
|
|
class QDebug;
|
|
|
|
class QSK_EXPORT QskBoxBorderColors
|
|
{
|
|
public:
|
|
QskBoxBorderColors();
|
|
|
|
QskBoxBorderColors( const QskGradient& left, const QskGradient& top,
|
|
const QskGradient& right, const QskGradient& bottom );
|
|
|
|
QskBoxBorderColors( Qt::GlobalColor );
|
|
QskBoxBorderColors( QRgb );
|
|
QskBoxBorderColors( const QColor& );
|
|
QskBoxBorderColors( const QskGradient& );
|
|
|
|
~QskBoxBorderColors();
|
|
|
|
bool operator==( const QskBoxBorderColors& ) const;
|
|
bool operator!=( const QskBoxBorderColors& ) const;
|
|
|
|
void setAlpha( int alpha );
|
|
|
|
void setGradients( const QskGradient& );
|
|
void setGradients( const QskGradient& left, const QskGradient& top,
|
|
const QskGradient& right, const QskGradient& bottom );
|
|
|
|
void setGradient( Qsk::Position, const QskGradient& );
|
|
QskGradient gradient( Qsk::Position ) const;
|
|
|
|
void setGradientAt( Qt::Edges, const QskGradient& );
|
|
const QskGradient& gradientAt( Qt::Edge ) const;
|
|
|
|
QskBoxBorderColors interpolated( const QskBoxBorderColors&, qreal value ) const;
|
|
|
|
static QVariant interpolate( const QskBoxBorderColors&,
|
|
const QskBoxBorderColors&, qreal ratio );
|
|
|
|
uint hash( uint seed = 0 ) const;
|
|
|
|
bool isMonochrome() const;
|
|
bool isVisible() const;
|
|
|
|
private:
|
|
QskGradient m_gradients[ 4 ];
|
|
};
|
|
|
|
inline QskBoxBorderColors::QskBoxBorderColors( Qt::GlobalColor color )
|
|
: QskBoxBorderColors( QColor( color ) )
|
|
{
|
|
}
|
|
|
|
inline QskBoxBorderColors::QskBoxBorderColors( QRgb rgb )
|
|
: QskBoxBorderColors( QColor::fromRgba( rgb ) )
|
|
{
|
|
}
|
|
|
|
inline bool QskBoxBorderColors::operator!=( const QskBoxBorderColors& other ) const
|
|
{
|
|
return !( *this == other );
|
|
}
|
|
|
|
inline QskGradient QskBoxBorderColors::gradient( Qsk::Position position ) const
|
|
{
|
|
return m_gradients[ position ];
|
|
}
|
|
|
|
#ifndef QT_NO_DEBUG_STREAM
|
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskBoxBorderColors& );
|
|
|
|
#endif
|
|
|
|
Q_DECLARE_METATYPE( QskBoxBorderColors )
|
|
|
|
#endif
|