6#ifndef QSK_SHADOW_METRICS_H
7#define QSK_SHADOW_METRICS_H
12#include <qnamespace.h>
21 Q_PROPERTY( QPointF offset READ offset WRITE setOffset )
22 Q_PROPERTY( qreal spreadRadius READ spreadRadius WRITE setSpreadRadius )
23 Q_PROPERTY( qreal blurRadius READ blurRadius WRITE setBlurRadius )
25 Q_PROPERTY( Qt::SizeMode sizeMode READ sizeMode WRITE setSizeMode )
26 Q_PROPERTY( ShapeMode shapeMode READ shapeMode WRITE setShapeMode )
43 const QPointF& offset, Qt::SizeMode = Qt::AbsoluteSize )
noexcept;
48 bool isNull()
const noexcept;
50 void setSpreadRadius( qreal )
noexcept;
51 constexpr qreal spreadRadius()
const noexcept;
53 void setBlurRadius( qreal )
noexcept;
54 constexpr qreal blurRadius()
const noexcept;
56 constexpr qreal totalRadius()
const noexcept;
58 void setOffsetX( qreal dx )
noexcept;
59 void setOffsetY( qreal dy )
noexcept;
61 void setOffset( qreal dx, qreal dy )
noexcept;
62 void setOffset(
const QPointF& )
noexcept;
64 constexpr QPointF offset()
const noexcept;
66 void setSizeMode( Qt::SizeMode )
noexcept;
67 constexpr Qt::SizeMode sizeMode()
const noexcept;
69 void setShapeMode( ShapeMode )
noexcept;
70 constexpr ShapeMode shapeMode()
const noexcept;
77 QRectF shadowRect(
const QRectF& sourceRect )
const;
79 QskHashValue hash( QskHashValue seed = 0 )
const noexcept;
86 qreal m_spreadRadius = 0.0;
87 qreal m_blurRadius = 0.0;
88 quint8 m_sizeMode = Qt::AbsoluteSize;
89 quint8 m_shapeMode = QskShadowMetrics::Aligned;
92inline constexpr QskShadowMetrics::QskShadowMetrics(
const QPointF& offset ) noexcept
97inline constexpr QskShadowMetrics::QskShadowMetrics(
98 qreal spreadRadius, qreal blurRadius ) noexcept
99 : m_spreadRadius( spreadRadius )
100 , m_blurRadius( blurRadius )
104inline constexpr QskShadowMetrics::QskShadowMetrics(
105 qreal spreadRadius, qreal blurRadius,
106 const QPointF& offset, Qt::SizeMode sizeMode ) noexcept
108 , m_spreadRadius( spreadRadius )
109 , m_blurRadius( blurRadius )
110 , m_sizeMode( sizeMode )
114inline constexpr bool QskShadowMetrics::operator==(
117 return ( m_sizeMode == other.m_sizeMode )
118 && ( m_shapeMode == other.m_shapeMode )
119 && ( m_offset == other.m_offset )
120 && ( m_spreadRadius == other.m_spreadRadius )
121 && ( m_blurRadius == other.m_blurRadius )
122 && ( m_sizeMode == other.m_sizeMode );
125inline constexpr bool QskShadowMetrics::operator!=(
128 return !( *
this == other );
131inline void QskShadowMetrics::setSpreadRadius( qreal radius )
noexcept
133 m_spreadRadius = radius;
136inline constexpr qreal QskShadowMetrics::spreadRadius() const noexcept
138 return m_spreadRadius;
141inline void QskShadowMetrics::setBlurRadius( qreal radius )
noexcept
143 m_blurRadius = radius;
146inline constexpr qreal QskShadowMetrics::blurRadius() const noexcept
151inline constexpr qreal QskShadowMetrics::totalRadius() const noexcept
153 return m_spreadRadius + m_blurRadius;
156inline void QskShadowMetrics::setSizeMode( Qt::SizeMode sizeMode )
noexcept
158 m_sizeMode = sizeMode;
161inline constexpr Qt::SizeMode QskShadowMetrics::sizeMode() const noexcept
163 return static_cast< Qt::SizeMode
>( m_sizeMode );
166inline void QskShadowMetrics::setShapeMode( ShapeMode shapeMode )
noexcept
168 m_shapeMode = shapeMode;
171inline constexpr QskShadowMetrics::ShapeMode QskShadowMetrics::shapeMode() const noexcept
173 return static_cast< ShapeMode
>( m_shapeMode );
176inline void QskShadowMetrics::setOffsetX( qreal dx )
noexcept
181inline void QskShadowMetrics::setOffsetY( qreal dy )
noexcept
186inline void QskShadowMetrics::setOffset( qreal dx, qreal dy )
noexcept
192inline void QskShadowMetrics::setOffset(
const QPointF& offset )
noexcept
197inline constexpr QPointF QskShadowMetrics::offset() const noexcept
202inline bool QskShadowMetrics::isNull() const noexcept
204 return m_offset.isNull() &&
205 ( m_spreadRadius == 0.0 ) && ( m_blurRadius == 0.0 );
208#ifndef QT_NO_DEBUG_STREAM