]> git.sesse.net Git - kdenlive/commitdiff
Hue background enabled in Bézier widget, shearing option added for HSV planes
authorSimon A. Eugster <simon.eu@gmail.com>
Fri, 18 Mar 2011 19:51:35 +0000 (19:51 +0000)
committerSimon A. Eugster <simon.eu@gmail.com>
Fri, 18 Mar 2011 19:51:35 +0000 (19:51 +0000)
svn path=/trunk/kdenlive/; revision=5503

src/beziercurve/beziersplinewidget.cpp
src/colortools.cpp
src/colortools.h

index d29c9d8fac508678d08e98fa241afee14584d3e0..c3b917761bef8ff0b3a8ed839e6c4b7d1f4c377f 100644 (file)
@@ -129,8 +129,8 @@ void BezierSplineWidget::slotShowPixmap(bool show)
     KdenliveSettings::setBezier_showpixmap(show);
     if (show && (int)m_mode < 6)
         m_edit.setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(m_edit.size(), (ColorTools::ColorsRGB)((int)m_mode), 1, palette().background().color().rgb())));
-//     else if (show && m_mode == ModeHue)
-//         m_edit.setPixmap(QPixmap::fromImage(ColorTools::hsvHueShiftPlane(m_edit.size(), 200, 200, 0, 360)));
+     else if (show && m_mode == ModeHue)
+         m_edit.setPixmap(QPixmap::fromImage(ColorTools::hsvCurvePlane(m_edit.size(), QColor::fromHsv(200, 200, 200), ColorTools::COM_H, ColorTools::COM_H)));
     else
         m_edit.setPixmap(QPixmap());
 }
index c01dc5ac6f723476766eaef158dfbd4a56e2b9b8..d618e5383499a37223a51425ccac2407543b1fef 100644 (file)
@@ -285,7 +285,8 @@ QImage ColorTools::hsvHueShiftPlane(const QSize &size, const uint &S, const uint
 
 }
 
-QImage ColorTools::hsvCurvePlane(const QSize &size, const QColor &baseColor, const ComponentsHSV &xVariant, const ComponentsHSV &yVariant)
+QImage ColorTools::hsvCurvePlane(const QSize &size, const QColor &baseColor,
+                                 const ComponentsHSV &xVariant, const ComponentsHSV &yVariant, const bool &shear, const float offsetY)
 {
     Q_ASSERT(size.width() > 0);
     Q_ASSERT(size.height() > 0);
@@ -349,7 +350,11 @@ QImage ColorTools::hsvCurvePlane(const QSize &size, const QColor &baseColor, con
 
             col.setHsvF(hue, sat, val);
 
-            plane.setPixel(x, y, col.rgba());
+            if (!shear) {
+                plane.setPixel(x, y, col.rgba());
+            } else {
+                plane.setPixel(x, int(2*size.height() + y - x*size.width()/size.height() - offsetY * size.height()) % size.height(), col.rgba());
+            }
         }
     }
 
index 2bd84b1619c2f855cadd47f08266c84305c1e6f7..c55507cb59a972baabdbe1081d86b0647abd2ba2 100644 (file)
@@ -76,8 +76,12 @@ public:
       Basic HSV plane with two components varying on the x and y axis.
       If both components are the same, then the y axis will be considered.
       MIN/MAX give the minimum/maximum saturation, usually 0..255.
+      Missing colour components will be taken from baseColor.
+      For shear == true, the image will be sheared such that the x axis goes through (0,0) and (1,1). offsetY can additionally
+      shift the whole x axis vertically.
       */
-    static QImage hsvCurvePlane(const QSize &size, const QColor &baseColor, const ComponentsHSV &xVariant, const ComponentsHSV &yVariant);
+    static QImage hsvCurvePlane(const QSize &size, const QColor &baseColor,
+                                const ComponentsHSV &xVariant, const ComponentsHSV &yVariant, const bool &shear = false, const float offsetY = 0);
 
 signals:
     void signalYuvWheelCalculationFinished();