Peter Hartmann ac8ef9cd5a
Box renderer: Support border gradients (#158)
* 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
2022-02-04 16:11:11 +01:00

61 lines
1.7 KiB
C++

/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#pragma once
#include <QskRgbPalette.h>
#include <QskBox.h>
class Box : public QskBox
{
public:
enum FillType
{
Unfilled,
Solid,
Horizontal,
Vertical,
Diagonal
};
enum BorderType
{
NoBorder,
Flat,
Raised1,
Sunken1,
Raised2,
Sunken2
};
Box( QQuickItem* parentItem = nullptr );
void setBackground( FillType, QskRgbPalette::Theme, bool inverted = false );
void setBorder( BorderType type, QskRgbPalette::Theme );
void setShape( const QskBoxShapeMetrics& );
void setShape( qreal radius, Qt::SizeMode );
void setShape( qreal radiusX, qreal radiusY, Qt::SizeMode );
void setBorderGradient( const QskGradient& );
void setBorderGradients( const QskGradient& left, const QskGradient& top,
const QskGradient& right, const QskGradient& bottom );
void setBorderWidth( int );
void setBorderWidth( qreal left, qreal top, qreal right, qreal bottom );
void setGradient( QRgb );
void setGradient( Qt::GlobalColor );
void setGradient( const QColor& );
void setGradient( QskGradient::Orientation, const QColor&, const QColor& );
void setGradient( QskGradient::Orientation,
const QColor&, const QColor&, const QColor& );
void setGradient( const QskGradient& gradient );
void setGradient( const QskGradient::Orientation, QskRgbPalette::Theme );
};