Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDynamicSensor.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KISDYNAMICSENSOR_H
7#define KISDYNAMICSENSOR_H
8
9#include <optional>
10#include <kis_cubic_curve.h>
11#include <KoID.h>
12
14struct KisSensorData;
15
17{
18public:
19 KisDynamicSensor(const KoID &id,
20 const KisSensorData &data,
21 std::optional<KisCubicCurve> curveOverride);
22 virtual ~KisDynamicSensor();
23
24 KoID id() const;
25 qreal parameter(const KisPaintInformation &info) const;
26
27 virtual bool isAdditive() const;
28 virtual bool isAbsoluteRotation() const;
29
30protected:
31
32 virtual qreal value(const KisPaintInformation &info) const = 0;
33
34public:
35
36 static inline qreal scalingToAdditive(qreal x) {
37 return -1.0 + 2.0 * x;
38 }
39
40 static inline qreal additiveToScaling(qreal x) {
41 return 0.5 * (1.0 + x);
42 }
43
44private:
46 std::optional<KisCubicCurve> m_curve;
47};
48
49#endif // KISDYNAMICSENSOR_H
qreal parameter(const KisPaintInformation &info) const
static qreal additiveToScaling(qreal x)
KisDynamicSensor(const KoID &id, const KisSensorData &data, std::optional< KisCubicCurve > curveOverride)
virtual bool isAdditive() const
virtual qreal value(const KisPaintInformation &info) const =0
std::optional< KisCubicCurve > m_curve
static qreal scalingToAdditive(qreal x)
virtual bool isAbsoluteRotation() const
Definition KoID.h:30