summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-11-12 14:56:26 +0300
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-11-23 16:45:59 +0000
commit38cfcc3b500627815ab12add27d7a3c392552ed1 (patch)
tree3cd82a389645e5ac234cc5f5f8a0d8b11bbb6a12
parent0757ff1c4add6bd4f6499c04969760765662efa3 (diff)
downloadqtmultimedia-38cfcc3b500627815ab12add27d7a3c392552ed1.tar.gz
Add camera brightness adjustment API.
The brightness adjustment already exists in the control API but not in the QCamera and QML Camera APIs. Simply add the missing functions which call into the control API. Change-Id: I56a5aef3ae8bef9ca13c5a01d8282014f6e20830 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
-rw-r--r--src/imports/multimedia/qdeclarativecameraimageprocessing.cpp19
-rw-r--r--src/imports/multimedia/qdeclarativecameraimageprocessing_p.h4
-rw-r--r--src/multimedia/camera/qcameraimageprocessing.cpp19
-rw-r--r--src/multimedia/camera/qcameraimageprocessing.h3
4 files changed, 45 insertions, 0 deletions
diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp b/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp
index de5aee85b..f6fbe9fc4 100644
--- a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp
+++ b/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp
@@ -138,6 +138,25 @@ void QDeclarativeCameraImageProcessing::setManualWhiteBalance(qreal colorTemp) c
}
/*!
+ \qmlproperty qreal QtMultimedia::CameraImageProcessing::brightness
+
+ Image brightness adjustment.
+ Valid brightness adjustment values range between -1.0 and 1.0, with a default of 0.
+*/
+qreal QDeclarativeCameraImageProcessing::brightness() const
+{
+ return m_imageProcessing->brightness();
+}
+
+void QDeclarativeCameraImageProcessing::setBrightness(qreal value)
+{
+ if (value != brightness()) {
+ m_imageProcessing->setBrightness(value);
+ emit brightnessChanged(brightness());
+ }
+}
+
+/*!
\qmlproperty qreal QtMultimedia::CameraImageProcessing::contrast
Image contrast adjustment.
diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
index 0e0cbb230..2e6c942ef 100644
--- a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
+++ b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
@@ -60,6 +60,7 @@ class QDeclarativeCameraImageProcessing : public QObject
Q_PROPERTY(WhiteBalanceMode whiteBalanceMode READ whiteBalanceMode WRITE setWhiteBalanceMode NOTIFY whiteBalanceModeChanged)
Q_PROPERTY(qreal manualWhiteBalance READ manualWhiteBalance WRITE setManualWhiteBalance NOTIFY manualWhiteBalanceChanged)
+ Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
Q_PROPERTY(qreal contrast READ contrast WRITE setContrast NOTIFY contrastChanged)
Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
Q_PROPERTY(qreal sharpeningLevel READ sharpeningLevel WRITE setSharpeningLevel NOTIFY sharpeningLevelChanged)
@@ -97,6 +98,7 @@ public:
WhiteBalanceMode whiteBalanceMode() const;
qreal manualWhiteBalance() const;
+ qreal brightness() const;
qreal contrast() const;
qreal saturation() const;
qreal sharpeningLevel() const;
@@ -108,6 +110,7 @@ public Q_SLOTS:
void setWhiteBalanceMode(QDeclarativeCameraImageProcessing::WhiteBalanceMode mode) const;
void setManualWhiteBalance(qreal colorTemp) const;
+ void setBrightness(qreal value);
void setContrast(qreal value);
void setSaturation(qreal value);
void setSharpeningLevel(qreal value);
@@ -119,6 +122,7 @@ Q_SIGNALS:
void whiteBalanceModeChanged(QDeclarativeCameraImageProcessing::WhiteBalanceMode) const;
void manualWhiteBalanceChanged(qreal) const;
+ void brightnessChanged(qreal);
void contrastChanged(qreal);
void saturationChanged(qreal);
void sharpeningLevelChanged(qreal);
diff --git a/src/multimedia/camera/qcameraimageprocessing.cpp b/src/multimedia/camera/qcameraimageprocessing.cpp
index 4ce3759e4..f2fd73949 100644
--- a/src/multimedia/camera/qcameraimageprocessing.cpp
+++ b/src/multimedia/camera/qcameraimageprocessing.cpp
@@ -220,6 +220,25 @@ void QCameraImageProcessing::setManualWhiteBalance(qreal colorTemperature)
}
/*!
+ Returns the brightness adjustment setting.
+ */
+qreal QCameraImageProcessing::brightness() const
+{
+ return d_func()->imageControl->parameter(QCameraImageProcessingControl::BrightnessAdjustment).toReal();
+}
+
+/*!
+ Set the brightness adjustment to \a value.
+
+ Valid brightness adjustment values range between -1.0 and 1.0, with a default of 0.
+ */
+void QCameraImageProcessing::setBrightness(qreal value)
+{
+ d_func()->imageControl->setParameter(QCameraImageProcessingControl::BrightnessAdjustment,
+ QVariant(value));
+}
+
+/*!
Returns the contrast adjustment setting.
*/
qreal QCameraImageProcessing::contrast() const
diff --git a/src/multimedia/camera/qcameraimageprocessing.h b/src/multimedia/camera/qcameraimageprocessing.h
index 2247b33f7..77e28eab1 100644
--- a/src/multimedia/camera/qcameraimageprocessing.h
+++ b/src/multimedia/camera/qcameraimageprocessing.h
@@ -91,6 +91,9 @@ public:
qreal manualWhiteBalance() const;
void setManualWhiteBalance(qreal colorTemperature);
+ qreal brightness() const;
+ void setBrightness(qreal value);
+
qreal contrast() const;
void setContrast(qreal value);