From 08902b01f367c2545c6e453604f8ecbd2009b6bd Mon Sep 17 00:00:00 2001 From: "Simon A. Eugster" Date: Fri, 18 Mar 2011 19:51:35 +0000 Subject: [PATCH] =?utf8?q?Hue=20background=20enabled=20in=20B=C3=A9zier=20?= =?utf8?q?widget,=20shearing=20option=20added=20for=20HSV=20planes?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit svn path=/trunk/kdenlive/; revision=5503 --- src/beziercurve/beziersplinewidget.cpp | 4 ++-- src/colortools.cpp | 9 +++++++-- src/colortools.h | 6 +++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/beziercurve/beziersplinewidget.cpp b/src/beziercurve/beziersplinewidget.cpp index d29c9d8f..c3b91776 100644 --- a/src/beziercurve/beziersplinewidget.cpp +++ b/src/beziercurve/beziersplinewidget.cpp @@ -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()); } diff --git a/src/colortools.cpp b/src/colortools.cpp index c01dc5ac..d618e538 100644 --- a/src/colortools.cpp +++ b/src/colortools.cpp @@ -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()); + } } } diff --git a/src/colortools.h b/src/colortools.h index 2bd84b16..c55507cb 100644 --- a/src/colortools.h +++ b/src/colortools.h @@ -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(); -- 2.39.2