Krita Source Code Documentation
Loading...
Searching...
No Matches
KisRotationOption.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2009 Cyrille Berger <cberger@cberger.net>
3 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7#include "KisRotationOption.h"
8
12#include <kis_paintop.h>
13
15namespace kpou = KisPaintOpOptionUtils;
16
17
22
33
35{
36 if (!isChecked()) return kisDegreesToRadians(info.canvasRotation());
37
38 const bool absoluteAxesFlipped = info.canvasMirroredH() != info.canvasMirroredV();
39
40 const qreal normalizedBaseAngle = -info.canvasRotation() / 360.0;
41
42 // we should invert scaling part because it is expected
43 // to rotate the brush counterclockwise
44 const qreal scalingPartCoeff = -1.0;
45
46 qreal value = computeRotationLikeValue(info, normalizedBaseAngle, absoluteAxesFlipped, scalingPartCoeff, info.isHoveringMode());
47
50 value = 1.0 - value;
51
52 return normalizeAngle(value * M_PI);
53 }
54
float value(const T *src, size_t ch)
qreal computeRotationLikeValue(const KisPaintInformation &info, qreal baseValue, bool absoluteAxesFlipped, qreal scalingPartCoeff, bool disableScalingPart) const
bool isChecked() const
qreal apply(const KisPaintInformation &info) const
KisRotationOption(const KisPropertiesConfiguration *setting)
void applyFanCornersInfo(KisPaintOp *op)
T kisDegreesToRadians(T degrees)
Definition kis_global.h:176
std::enable_if< std::is_floating_point< T >::value, T >::type normalizeAngle(T a)
Definition kis_global.h:121
#define M_PI
Definition kis_global.h:111
KisKritaSensorData & sensorStruct()
KisDrawingAngleSensorData sensorDrawingAngle
void setFanCornersInfo(bool fanCornersEnabled, qreal fanCornersStep)