761e0d9de7
The literal task 'build ALL KDE packages' cannot be 100% completed because 12 packages require upstream dependencies not available on Redox: - kirigami + plasma* (4): QML JIT disabled — no QQuickWindow/QQmlEngine - kwin real build (1): Qt6::Sensors port needed - breeze + kf6-kio + kf6-knewstuff + kde-cli-tools (4): source issues - plasma extras (3): transitive blockers What WAS completed: - Cookbook topological sort fix (root cause — all deps now correct order) - kf6-attica recipe (183 files, 2.4MB pkgar) - 12 I2C/GPIO/UCSI daemons archived as durable patches - Source archival system (make sources) - Config + all docs synced, no contradictions
83 lines
1.8 KiB
C++
83 lines
1.8 KiB
C++
/*
|
|
* SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// Qt
|
|
#include <QColor>
|
|
#include <QImage>
|
|
#include <QPoint>
|
|
#include <QSize>
|
|
|
|
namespace Breeze
|
|
{
|
|
class BoxShadowRenderer
|
|
{
|
|
public:
|
|
// Compiler generated constructors & destructor are fine.
|
|
|
|
/**
|
|
* Set the size of the box.
|
|
* @param size The size of the box.
|
|
**/
|
|
void setBoxSize(const QSizeF &size);
|
|
|
|
/**
|
|
* Set the radius of box' corners.
|
|
* @param radius The border radius, in pixels.
|
|
**/
|
|
void setBorderRadius(qreal radius);
|
|
|
|
/**
|
|
* Add a shadow.
|
|
* @param offset The offset of the shadow.
|
|
* @param radius The blur radius.
|
|
* @param color The color of the shadow.
|
|
**/
|
|
void addShadow(const QPointF &offset, double radius, const QColor &color);
|
|
|
|
/**
|
|
* Render the shadow.
|
|
**/
|
|
QImage render() const;
|
|
|
|
/**
|
|
* Calculate the minimum size of the box.
|
|
*
|
|
* This helper computes the minimum size of the box so the shadow behind it has
|
|
* full its strength.
|
|
*
|
|
* @param radius The blur radius of the shadow.
|
|
**/
|
|
static QSize calculateMinimumBoxSize(int radius);
|
|
|
|
/**
|
|
* Calculate the minimum size of the shadow texture.
|
|
*
|
|
* This helper computes the minimum size of the resulting texture so the shadow
|
|
* is not clipped.
|
|
*
|
|
* @param boxSize The size of the box.
|
|
* @param radius The blur radius.
|
|
* @param offset The offset of the shadow.
|
|
**/
|
|
static QSizeF calculateMinimumShadowTextureSize(const QSizeF &boxSize, double radius, const QPointF &offset);
|
|
|
|
private:
|
|
QSizeF m_boxSize;
|
|
qreal m_borderRadius = 0.0;
|
|
|
|
struct Shadow {
|
|
QPointF offset;
|
|
double radius;
|
|
QColor color;
|
|
};
|
|
|
|
QVector<Shadow> m_shadows;
|
|
};
|
|
|
|
} // namespace Breeze
|