[calligra/krita-testing-kazakov] krita: Renamed Ascension and Declination sensors

Dmitry Kazakov dimula73 at gmail.com
Sat Jun 7 05:07:25 UTC 2014


Git commit 167ab69a1a5230bbfd8a33979d889297690a8553 by Dmitry Kazakov.
Committed on 07/06/2014 at 05:06.
Pushed by dkazakov into branch 'krita-testing-kazakov'.

Renamed Ascension and Declination sensors

The new names were chosen by the painters:
http://mail.kde.org/pipermail/kimageshop/2014-June/012338.html

Ascension -> Tilt direction
Declination -> Tilt elevation

Quick tests with older presets showed that old Ascension option
is loaded correctly. Please test the new patch in krita-testing-kazakov.

CCMAIL:kimageshop at kde.org

M  +6    -6    krita/image/brushengine/kis_paint_information.cc
M  +2    -2    krita/image/brushengine/kis_paint_information.h
M  +6    -6    krita/plugins/paintops/libpaintop/kis_dynamic_sensor.cc
M  +10   -2    krita/plugins/paintops/libpaintop/kis_dynamic_sensor.h
M  +2    -2    krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.cc
M  +8    -8    krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h

http://commits.kde.org/calligra/167ab69a1a5230bbfd8a33979d889297690a8553

diff --git a/krita/image/brushengine/kis_paint_information.cc b/krita/image/brushengine/kis_paint_information.cc
index 5011f8e..c37e2d5 100644
--- a/krita/image/brushengine/kis_paint_information.cc
+++ b/krita/image/brushengine/kis_paint_information.cc
@@ -338,17 +338,17 @@ KisPaintInformation KisPaintInformation::mix(const QPointF& p, qreal t, const Ki
     return result;
 }
 
-qreal KisPaintInformation::ascension(const KisPaintInformation& info, bool normalize)
+qreal KisPaintInformation::tiltDirection(const KisPaintInformation& info, bool normalize)
 {
     qreal xTilt = info.xTilt();
     qreal yTilt = info.yTilt();
     // radians -PI, PI
-    qreal ascension = atan2(-xTilt, yTilt);
+    qreal tiltDirection = atan2(-xTilt, yTilt);
     // if normalize is true map to 0.0..1.0
-    return normalize ? (ascension / (2 * M_PI) + 0.5) : ascension;
+    return normalize ? (tiltDirection / (2 * M_PI) + 0.5) : tiltDirection;
 }
 
-qreal KisPaintInformation::declination(const KisPaintInformation& info, qreal maxTiltX, qreal maxTiltY, bool normalize)
+qreal KisPaintInformation::tiltElevation(const KisPaintInformation& info, qreal maxTiltX, qreal maxTiltY, bool normalize)
 {
     qreal xTilt = qBound(qreal(-1.0), info.xTilt() / maxTiltX , qreal(1.0));
     qreal yTilt = qBound(qreal(-1.0), info.yTilt() / maxTiltY , qreal(1.0));
@@ -361,9 +361,9 @@ qreal KisPaintInformation::declination(const KisPaintInformation& info, qreal ma
     }
     
     qreal cosAlpha    = sqrt(xTilt*xTilt + yTilt*yTilt)/e;
-    qreal declination = acos(cosAlpha); // in radians in [0, 0.5 * PI]
+    qreal tiltElevation = acos(cosAlpha); // in radians in [0, 0.5 * PI]
     
     // mapping to 0.0..1.0 if normalize is true
-    return normalize ? (declination / (M_PI * qreal(0.5))) : declination;
+    return normalize ? (tiltElevation / (M_PI * qreal(0.5))) : tiltElevation;
 }
 
diff --git a/krita/image/brushengine/kis_paint_information.h b/krita/image/brushengine/kis_paint_information.h
index 1ad3fa6..1599fc0 100644
--- a/krita/image/brushengine/kis_paint_information.h
+++ b/krita/image/brushengine/kis_paint_information.h
@@ -184,8 +184,8 @@ public:
     
     /// (1-t) * p1 + t * p2
     static KisPaintInformation mix(const QPointF& p, qreal t, const KisPaintInformation& p1, const KisPaintInformation& p2);
-    static qreal ascension(const KisPaintInformation& info, bool normalize=true);
-    static qreal declination(const KisPaintInformation& info, qreal maxTiltX=60.0, qreal maxTiltY=60.0, bool normalize=true);
+    static qreal tiltDirection(const KisPaintInformation& info, bool normalize=true);
+    static qreal tiltElevation(const KisPaintInformation& info, qreal maxTiltX=60.0, qreal maxTiltY=60.0, bool normalize=true);
 
 private:
     struct Private;
diff --git a/krita/plugins/paintops/libpaintop/kis_dynamic_sensor.cc b/krita/plugins/paintops/libpaintop/kis_dynamic_sensor.cc
index 1e7d400..3a4d39f 100644
--- a/krita/plugins/paintops/libpaintop/kis_dynamic_sensor.cc
+++ b/krita/plugins/paintops/libpaintop/kis_dynamic_sensor.cc
@@ -60,11 +60,11 @@ KisDynamicSensorSP KisDynamicSensor::id2Sensor(const KoID& id)
     else if (id.id() == YTiltId.id()) {
         return new KisDynamicSensorYTilt();
     }
-    else if (id.id() == AscensionId.id()) {
-        return new KisDynamicSensorAscension();
+    else if (id.id() == TiltDirectionId.id()) {
+        return new KisDynamicSensorTiltDirection();
     }
-    else if (id.id() == DeclinationId.id()) {
-        return new KisDynamicSensorDeclination();
+    else if (id.id() == TiltElevationId.id()) {
+        return new KisDynamicSensorTiltElevation();
     }
     else if (id.id() == SpeedId.id()) {
         return new KisDynamicSensorSpeed();
@@ -123,8 +123,8 @@ QList<KoID> KisDynamicSensor::sensorsIds()
     ids << PressureId
         << XTiltId
         << YTiltId
-        << AscensionId
-        << DeclinationId
+        << TiltDirectionId
+        << TiltElevationId
         << SpeedId
         << DrawingAngleId
         << RotationId
diff --git a/krita/plugins/paintops/libpaintop/kis_dynamic_sensor.h b/krita/plugins/paintops/libpaintop/kis_dynamic_sensor.h
index 87497fe..de85e96 100644
--- a/krita/plugins/paintops/libpaintop/kis_dynamic_sensor.h
+++ b/krita/plugins/paintops/libpaintop/kis_dynamic_sensor.h
@@ -47,8 +47,16 @@ const KoID RotationId("rotation", ki18n("Rotation")); ///< rotation coming from
 const KoID PressureId("pressure", ki18n("Pressure")); ///< number depending on the pressure
 const KoID XTiltId("xtilt", ki18n("X-Tilt")); ///< number depending on X-tilt
 const KoID YTiltId("ytilt", ki18n("Y-Tilt")); ///< number depending on Y-tilt
-const KoID AscensionId("ascension", ki18n("Ascension")); /// < number depending on the X and Y tilt, ascension is 0 when stylus nib points to you and changes clockwise from -180 to +180.
-const KoID DeclinationId("declination", ki18n("Declination")); /// < declination is 90 when stylus is perpendicular to tablet and 0 when it's parallel to tablet
+
+/**
+ * "TiltDirection" and "TiltElevation" parameters are written to
+ * preset files as "ascension" and "declination" to keep backward
+ * compatibility with older presets from the days when they were called
+ * differently.
+ */
+const KoID TiltDirectionId("ascension", ki18n("Tilt direction")); /// < number depending on the X and Y tilt, tilt direction is 0 when stylus nib points to you and changes clockwise from -180 to +180.
+const KoID TiltElevationId("declination", ki18n("Tilt elevation")); /// < tilt elevation is 90 when stylus is perpendicular to tablet and 0 when it's parallel to tablet
+
 const KoID PerspectiveId("perspective", ki18n("Perspective")); ///< number depending on the distance on the perspective grid
 const KoID TangentialPressureId("tangentialpressure", ki18n("Tangential pressure")); ///< the wheel on an airbrush device
 const KoID SensorsListId("sensorslist", "SHOULD NOT APPEAR IN THE UI !"); ///< this a non user-visible sensor that can store a list of other sensors, and multiply their output
diff --git a/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.cc b/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.cc
index 5e7bf5e..6b10e2b 100644
--- a/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.cc
+++ b/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.cc
@@ -72,13 +72,13 @@ KisDynamicSensorYTilt::KisDynamicSensorYTilt() : KisDynamicSensor(YTiltId)
     setMaximumLabel(i18n("30°"));
 }
 
-KisDynamicSensorAscension::KisDynamicSensorAscension() : KisDynamicSensor(AscensionId)
+KisDynamicSensorTiltDirection::KisDynamicSensorTiltDirection() : KisDynamicSensor(TiltDirectionId)
 {
     setMinimumLabel(i18n("0°"));
     setMaximumLabel(i18n("360°"));
 }
 
-KisDynamicSensorDeclination::KisDynamicSensorDeclination() : KisDynamicSensor(DeclinationId)
+KisDynamicSensorTiltElevation::KisDynamicSensorTiltElevation() : KisDynamicSensor(TiltElevationId)
 {
     setMinimumLabel(i18n("90°"));
     setMaximumLabel(i18n("0°"));
diff --git a/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h b/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
index 2ec7801..faaaaf7 100644
--- a/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
+++ b/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
@@ -77,23 +77,23 @@ public:
     }
 };
 
-class KisDynamicSensorAscension : public KisDynamicSensor
+class KisDynamicSensorTiltDirection : public KisDynamicSensor
 {
 public:
-    KisDynamicSensorAscension();
-    virtual ~KisDynamicSensorAscension() {}
+    KisDynamicSensorTiltDirection();
+    virtual ~KisDynamicSensorTiltDirection() {}
     virtual qreal value(const KisPaintInformation& info) {
-        return KisPaintInformation::ascension(info, true);
+        return KisPaintInformation::tiltDirection(info, true);
     }
 };
 
-class KisDynamicSensorDeclination : public KisDynamicSensor
+class KisDynamicSensorTiltElevation : public KisDynamicSensor
 {
 public:
-    KisDynamicSensorDeclination();
-    virtual ~KisDynamicSensorDeclination() {}
+    KisDynamicSensorTiltElevation();
+    virtual ~KisDynamicSensorTiltElevation() {}
     virtual qreal value(const KisPaintInformation& info) {
-        return KisPaintInformation::declination(info, 60.0, 60.0, true);
+        return KisPaintInformation::tiltElevation(info, 60.0, 60.0, true);
     }
 };
 


More information about the kimageshop mailing list