2022-11-13 16:22:09 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "QskGradientDirection.h"
|
|
|
|
|
2022-11-29 09:59:09 +00:00
|
|
|
static void qskRegisterGradientDirection()
|
|
|
|
{
|
|
|
|
qRegisterMetaType< QskLinearDirection >();
|
|
|
|
qRegisterMetaType< QskConicDirection >();
|
|
|
|
qRegisterMetaType< QskRadialDirection >();
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterGradientDirection )
|
|
|
|
|
2022-11-13 16:22:09 +00:00
|
|
|
// -- QskLinearDirection
|
|
|
|
|
|
|
|
void QskLinearDirection::setOrientation( Qt::Orientation orientation ) noexcept
|
|
|
|
{
|
|
|
|
setStart( 0.0, 0.0 );
|
|
|
|
|
|
|
|
if ( orientation == Qt::Vertical )
|
|
|
|
setStop( 0.0, 1.0 );
|
|
|
|
else
|
|
|
|
setStop( 1.0, 0.0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setStart( const QPointF& pos ) noexcept
|
|
|
|
{
|
|
|
|
m_x1 = pos.x();
|
|
|
|
m_y1 = pos.y();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setStart( qreal x, qreal y ) noexcept
|
|
|
|
{
|
|
|
|
m_x1 = x;
|
|
|
|
m_y1 = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setStop( const QPointF& pos ) noexcept
|
|
|
|
{
|
|
|
|
m_x2 = pos.x();
|
|
|
|
m_y2 = pos.y();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setStop( qreal x, qreal y ) noexcept
|
|
|
|
{
|
|
|
|
m_x2 = x;
|
|
|
|
m_y2 = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setX1( qreal x ) noexcept
|
|
|
|
{
|
|
|
|
m_x1 = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setY1( qreal y ) noexcept
|
|
|
|
{
|
|
|
|
m_y1 = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setX2( qreal x ) noexcept
|
|
|
|
{
|
|
|
|
m_x2 = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setY2( qreal y ) noexcept
|
|
|
|
{
|
|
|
|
m_y2 = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskLinearDirection::setInterval( Qt::Orientation orientation, qreal from, qreal to )
|
|
|
|
{
|
|
|
|
if ( orientation == Qt::Vertical )
|
|
|
|
{
|
|
|
|
m_y1 = from;
|
|
|
|
m_y2 = to;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_x1 = from;
|
|
|
|
m_x2 = to;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -- QskConicDirection
|
|
|
|
|
|
|
|
void QskConicDirection::setCenter( const QPointF& center ) noexcept
|
|
|
|
{
|
|
|
|
m_x = center.x();
|
|
|
|
m_y = center.y();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskConicDirection::setCenter( qreal x, qreal y ) noexcept
|
|
|
|
{
|
|
|
|
m_x = x;
|
|
|
|
m_y = y;
|
|
|
|
}
|
|
|
|
|
2022-11-29 09:59:09 +00:00
|
|
|
void QskConicDirection::setX( qreal x ) noexcept
|
|
|
|
{
|
|
|
|
m_x = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskConicDirection::setY( qreal y ) noexcept
|
|
|
|
{
|
|
|
|
m_y = y;
|
|
|
|
}
|
|
|
|
|
2022-11-13 16:22:09 +00:00
|
|
|
void QskConicDirection::setStartAngle( qreal degrees ) noexcept
|
|
|
|
{
|
|
|
|
m_startAngle = degrees;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskConicDirection::setSpanAngle( qreal degrees ) noexcept
|
|
|
|
{
|
|
|
|
m_spanAngle = qBound( -360.0, degrees, 360.0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -- QskRadialDirection
|
|
|
|
|
|
|
|
void QskRadialDirection::setCenter( const QPointF& center ) noexcept
|
|
|
|
{
|
|
|
|
m_x = center.x();
|
|
|
|
m_y = center.y();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskRadialDirection::setCenter( qreal x, qreal y ) noexcept
|
|
|
|
{
|
|
|
|
m_x = x;
|
|
|
|
m_y = y;
|
|
|
|
}
|
|
|
|
|
2022-11-29 09:59:09 +00:00
|
|
|
void QskRadialDirection::setX( qreal x ) noexcept
|
|
|
|
{
|
|
|
|
m_x = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskRadialDirection::setY( qreal y ) noexcept
|
|
|
|
{
|
|
|
|
m_y = y;
|
|
|
|
}
|
|
|
|
|
2022-12-23 13:57:46 +00:00
|
|
|
void QskRadialDirection::setRadiusX( qreal radius ) noexcept
|
|
|
|
{
|
|
|
|
m_radiusX = radius;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskRadialDirection::setRadiusY( qreal radius ) noexcept
|
|
|
|
{
|
|
|
|
m_radiusY = radius;
|
|
|
|
}
|
|
|
|
|
2022-11-13 16:22:09 +00:00
|
|
|
void QskRadialDirection::setRadius( qreal radius ) noexcept
|
|
|
|
{
|
2022-12-23 13:57:46 +00:00
|
|
|
m_radiusX = m_radiusY = radius;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskRadialDirection::setRadius( qreal radiusX, qreal radiusY ) noexcept
|
|
|
|
{
|
|
|
|
m_radiusX = radiusX;
|
|
|
|
m_radiusY = radiusY;
|
2022-11-13 16:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#include "moc_QskGradientDirection.cpp"
|