diff options
Diffstat (limited to 'src/multimedia/camera')
-rw-r--r-- | src/multimedia/camera/qcamera.cpp | 217 | ||||
-rw-r--r-- | src/multimedia/camera/qcamera.h | 50 | ||||
-rw-r--r-- | src/multimedia/camera/qcamera_p.h | 16 | ||||
-rw-r--r-- | src/multimedia/camera/qcameraimageprocessing.cpp | 391 | ||||
-rw-r--r-- | src/multimedia/camera/qcameraimageprocessing.h | 150 |
5 files changed, 265 insertions, 559 deletions
diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp index 0a159470e..291fcdae9 100644 --- a/src/multimedia/camera/qcamera.cpp +++ b/src/multimedia/camera/qcamera.cpp @@ -85,6 +85,19 @@ QT_BEGIN_NAMESPACE \snippet multimedia-snippets/camera.cpp Camera zoom + + After capturing the data for a camera frame, the camera hardware and + software performs various image processing tasks to produce a final + image. This includes compensating for ambient light color, reducing + noise, as well as making some other adjustments to the image. + + For example, you can set the white balance (or color temperature) used + for processing images: + + \snippet multimedia-snippets/camera.cpp Camera image whitebalance + + For more information on image processing of camera frames, see \l {camera_image_processing}{Camera Image Processing}. + See the \l{Camera Overview}{camera overview} for more information. */ @@ -133,7 +146,7 @@ void QCameraPrivate::init() q->connect(exposureControl, SIGNAL(flashReady(bool)), q, SIGNAL(flashReady(bool))); } - imageProcessing = new QCameraImageProcessing(q, control); + imageControl = control->imageProcessingControl(); } /*! @@ -237,14 +250,6 @@ void QCamera::setActive(bool active) } /*! - Returns the camera image processing control object. -*/ -QCameraImageProcessing *QCamera::imageProcessing() const -{ - return d_func()->imageProcessing; -} - -/*! Returns the error state of the object. */ @@ -1153,6 +1158,200 @@ void QCamera::setAutoShutterSpeed() Signal emitted when the exposure compensation changes to \a value. */ + + +/*! + Returns the white balance mode being used. +*/ + +QCamera::WhiteBalanceMode QCamera::whiteBalanceMode() const +{ + Q_D(const QCamera); + return d->whiteBalance; +} + +/*! + Sets the white balance to \a mode. +*/ + +void QCamera::setWhiteBalanceMode(QCamera::WhiteBalanceMode mode) +{ + Q_D(QCamera); + if (d->whiteBalance == mode || !isWhiteBalanceModeSupported(mode)) + return; + + d->imageControl->setParameter( + QPlatformCameraImageProcessing::WhiteBalancePreset, + QVariant::fromValue<QCamera::WhiteBalanceMode>(mode)); + d->whiteBalance = mode; + emit whiteBalanceModeChanged(); +} + +/*! + Returns true if the white balance \a mode is supported. +*/ + +bool QCamera::isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const +{ + Q_D(const QCamera); + if (!d->imageControl) + return false; + return d->imageControl->isParameterValueSupported( + QPlatformCameraImageProcessing::WhiteBalancePreset, + QVariant::fromValue<QCamera::WhiteBalanceMode>(mode)); + +} + +/*! + Returns the current color temperature if the + current white balance mode is \c WhiteBalanceManual. For other modes the + return value is undefined. +*/ + +qreal QCamera::manualWhiteBalance() const +{ + Q_D(const QCamera); + return d->colorTemperature; +} + +/*! + Sets manual white balance to \a colorTemperature. This is used + when whiteBalanceMode() is set to \c WhiteBalanceManual. The units are Kelvin. +*/ + +void QCamera::setManualWhiteBalance(qreal colorTemperature) +{ + Q_D(QCamera); + if (!d->imageControl) + return; + if (d->colorTemperature == colorTemperature) + return; + if (colorTemperature == 0) { + setWhiteBalanceMode(WhiteBalanceAuto); + } else if (!isWhiteBalanceModeSupported(WhiteBalanceManual)) { + return; + } else { + setWhiteBalanceMode(WhiteBalanceManual); + d->imageControl->setParameter( + QPlatformCameraImageProcessing::ColorTemperature, + QVariant(colorTemperature)); + } + d->colorTemperature = colorTemperature; + emit manualWhiteBalanceChanged(); +} + +/*! + Returns the brightness adjustment setting. + */ +qreal QCamera::brightness() const +{ + Q_D(const QCamera); + return d->brightness; +} + +/*! + Set the brightness adjustment to \a value. + + Valid brightness adjustment values range between -1.0 and 1.0, with a default of 0. +*/ +void QCamera::setBrightness(qreal value) +{ + Q_D(QCamera); + if (!d->imageControl || d->brightness == value) + return; + d->brightness = value; + d->imageControl->setParameter(QPlatformCameraImageProcessing::BrightnessAdjustment, + QVariant(value)); + emit brightnessChanged(); +} + +/*! + Returns the contrast adjustment setting. +*/ +qreal QCamera::contrast() const +{ + Q_D(const QCamera); + return d->contrast; +} + +/*! + Set the contrast adjustment to \a value. + + Valid contrast adjustment values range between -1.0 and 1.0, with a default of 0. +*/ +void QCamera::setContrast(qreal value) +{ + Q_D(QCamera); + if (!d->imageControl || d->contrast == value) + return; + d->contrast = value; + d->imageControl->setParameter(QPlatformCameraImageProcessing::ContrastAdjustment, + QVariant(value)); + emit contrastChanged(); +} + +/*! + Returns the saturation adjustment value. +*/ +qreal QCamera::saturation() const +{ + Q_D(const QCamera); + return d->saturation; +} + +/*! + Sets the saturation adjustment value to \a value. + + Valid saturation values range between -1.0 and 1.0, with a default of 0. +*/ +void QCamera::setSaturation(qreal value) +{ + Q_D(QCamera); + if (!d->imageControl || d->saturation == value) + return; + d->saturation = value; + d->imageControl->setParameter(QPlatformCameraImageProcessing::SaturationAdjustment, + QVariant(value)); + emit saturationChanged(); +} + +qreal QCamera::hue() const +{ + Q_D(const QCamera); + return d->hue; +} + +/*! + Sets the hue adjustment value to \a value. + + Valid hue values range between -1.0 and 1.0, with a default of 0. +*/ +void QCamera::setHue(qreal value) +{ + Q_D(QCamera); + if (!d->imageControl || d->hue == value) + return; + d->hue = value; + d->imageControl->setParameter(QPlatformCameraImageProcessing::HueAdjustment, + QVariant(value)); + emit hueChanged(); +} + +/*! + \enum QCamera::WhiteBalanceMode + + \value WhiteBalanceAuto Auto white balance mode. + \value WhiteBalanceManual Manual white balance. In this mode the white balance should be set with + setManualWhiteBalance() + \value WhiteBalanceSunlight Sunlight white balance mode. + \value WhiteBalanceCloudy Cloudy white balance mode. + \value WhiteBalanceShade Shade white balance mode. + \value WhiteBalanceTungsten Tungsten (incandescent) white balance mode. + \value WhiteBalanceFluorescent Fluorescent white balance mode. + \value WhiteBalanceFlash Flash white balance mode. + \value WhiteBalanceSunset Sunset white balance mode. +*/ + QT_END_NAMESPACE #include "moc_qcamera.cpp" diff --git a/src/multimedia/camera/qcamera.h b/src/multimedia/camera/qcamera.h index 988b9adf3..904d0e098 100644 --- a/src/multimedia/camera/qcamera.h +++ b/src/multimedia/camera/qcamera.h @@ -48,7 +48,6 @@ #include <QtCore/qobject.h> -#include <QtMultimedia/qcameraimageprocessing.h> #include <QtMultimedia/qcamerainfo.h> #include <QtMultimedia/qmediaenumdebug.h> @@ -66,7 +65,6 @@ class Q_MULTIMEDIA_EXPORT QCamera : public QObject Q_OBJECT Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) Q_PROPERTY(QCamera::Status status READ status NOTIFY statusChanged) - Q_PROPERTY(QCameraImageProcessing* imageProcessing READ imageProcessing CONSTANT) Q_PROPERTY(QCameraInfo cameraInfo READ cameraInfo WRITE setCameraInfo NOTIFY cameraInfoChanged) Q_PROPERTY(Error error READ error NOTIFY errorChanged) Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) @@ -88,6 +86,13 @@ class Q_MULTIMEDIA_EXPORT QCamera : public QObject Q_PROPERTY(QCamera::TorchMode torchMode READ torchMode WRITE setTorchMode) Q_PROPERTY(QCamera::ExposureMode exposureMode READ exposureMode WRITE setExposureMode) + 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 hue READ hue WRITE setHue NOTIFY hueChanged) + Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged) + Q_ENUMS(Status) Q_ENUMS(Error) @@ -97,6 +102,7 @@ class Q_MULTIMEDIA_EXPORT QCamera : public QObject Q_ENUMS(TorchMode) Q_ENUMS(ExposureMode) + Q_ENUMS(WhiteBalanceMode) public: enum Status { UnavailableStatus, @@ -153,6 +159,18 @@ public: ExposureBarcode }; + enum WhiteBalanceMode { + WhiteBalanceAuto = 0, + WhiteBalanceManual = 1, + WhiteBalanceSunlight = 2, + WhiteBalanceCloudy = 3, + WhiteBalanceShade = 4, + WhiteBalanceTungsten = 5, + WhiteBalanceFluorescent = 6, + WhiteBalanceFlash = 7, + WhiteBalanceSunset = 8 + }; + explicit QCamera(QObject *parent = nullptr); explicit QCamera(const QCameraInfo& cameraInfo, QObject *parent = nullptr); explicit QCamera(QCameraInfo::Position position, QObject *parent = nullptr); @@ -171,8 +189,6 @@ public: QCameraFormat cameraFormat() const; void setCameraFormat(const QCameraFormat &format); - QCameraImageProcessing *imageProcessing() const; - Error error() const; QString errorString() const; @@ -218,6 +234,16 @@ public: QList<qreal> supportedApertures(bool *continuous = nullptr) const; QList<qreal> supportedShutterSpeeds(bool *continuous = nullptr) const; + WhiteBalanceMode whiteBalanceMode() const; + Q_INVOKABLE bool isWhiteBalanceModeSupported(WhiteBalanceMode mode) const; + + qreal manualWhiteBalance() const; + + qreal brightness() const; + qreal contrast() const; + qreal saturation() const; + qreal hue() const; + public Q_SLOTS: void setActive(bool active); void start() { setActive(true); } @@ -240,6 +266,14 @@ public Q_SLOTS: void setManualShutterSpeed(qreal seconds); void setAutoShutterSpeed(); + void setWhiteBalanceMode(WhiteBalanceMode mode); + void setManualWhiteBalance(qreal colorTemperature); + + void setBrightness(qreal value); + void setContrast(qreal value); + void setSaturation(qreal value); + void setHue(qreal value); + Q_SIGNALS: void activeChanged(bool); void statusChanged(QCamera::Status status); @@ -264,6 +298,14 @@ Q_SIGNALS: void isoSensitivityChanged(int); void exposureCompensationChanged(qreal); + void whiteBalanceModeChanged() const; + void manualWhiteBalanceChanged() const; + + void brightnessChanged(); + void contrastChanged(); + void saturationChanged(); + void hueChanged(); + private: void setCaptureSession(QMediaCaptureSession *session); friend class QMediaCaptureSession; diff --git a/src/multimedia/camera/qcamera_p.h b/src/multimedia/camera/qcamera_p.h index 0224ac6d5..ee11bc946 100644 --- a/src/multimedia/camera/qcamera_p.h +++ b/src/multimedia/camera/qcamera_p.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE class QPlatformCamera; class QPlatformCameraFocus; class QPlatformCameraExposure; +class QPlatformCameraImageProcessing; class QPlatformMediaCaptureSession; class QCameraPrivate : public QObjectPrivate @@ -79,10 +80,6 @@ public: QPlatformMediaCaptureSession *captureInterface = nullptr; QPlatformCamera *control = nullptr; - QCameraImageProcessing *imageProcessing = nullptr; - - QObject *capture = nullptr; - QCamera::Error error; QString errorString; @@ -93,7 +90,16 @@ public: float zoomFactor = 1.; QPointF customFocusPoint{-1, -1}; - QPlatformCameraExposure *exposureControl; + QPlatformCameraExposure *exposureControl = nullptr; + + QPlatformCameraImageProcessing *imageControl = nullptr; + + QCamera::WhiteBalanceMode whiteBalance = QCamera::WhiteBalanceAuto; + qreal colorTemperature = 0; + qreal brightness = 0; + qreal contrast = 0; + qreal saturation = 0; + qreal hue = 0; template<typename T> T actualExposureParameter(QPlatformCameraExposure::ExposureParameter parameter, const T &defaultValue) const; template<typename T> T requestedExposureParameter(QPlatformCameraExposure::ExposureParameter parameter, const T &defaultValue) const; diff --git a/src/multimedia/camera/qcameraimageprocessing.cpp b/src/multimedia/camera/qcameraimageprocessing.cpp deleted file mode 100644 index 7ed07244b..000000000 --- a/src/multimedia/camera/qcameraimageprocessing.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcameraimageprocessing.h" -#include "private/qobject_p.h" - -#include <private/qplatformcamera_p.h> -#include <private/qplatformcameraimageprocessing_p.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -/*! - \class QCameraImageProcessing - - \brief The QCameraImageProcessing class provides an interface for - image processing related camera settings. - - \inmodule QtMultimedia - \ingroup multimedia - \ingroup multimedia_camera - - After capturing the data for a camera frame, the camera hardware and - software performs various image processing tasks to produce a final - image. This includes compensating for ambient light color, reducing - noise, as well as making some other adjustments to the image. - - You can retrieve this class from an instance of a \l QCamera object. - - For example, you can set the white balance (or color temperature) used - for processing images: - - \snippet multimedia-snippets/camera.cpp Camera image whitebalance - - In some cases changing these settings may result in a longer delay - before an image is ready. - - For more information on image processing of camera frames, see \l {camera_image_processing}{Camera Image Processing}. - - \sa QPlatformCameraImageProcessing -*/ - -class QCameraImageProcessingPrivate : public QObjectPrivate -{ -public: - void init(QPlatformCamera *cameraControl); - - QCamera *camera; - QPlatformCameraImageProcessing *imageControl; - - QCameraImageProcessing::WhiteBalanceMode whiteBalance = QCameraImageProcessing::WhiteBalanceAuto; - QCameraImageProcessing::ColorFilter colorFilter = QCameraImageProcessing::ColorFilterNone; - qreal colorTemperature = 0; - qreal brightness = 0; - qreal contrast = 0; - qreal saturation = 0; - qreal hue = 0; -}; - - -void QCameraImageProcessingPrivate::init(QPlatformCamera *cameraControl) -{ - imageControl = cameraControl->imageProcessingControl(); -} - -/*! - Construct a QCameraImageProcessing for \a camera. -*/ - -QCameraImageProcessing::QCameraImageProcessing(QCamera *camera, QPlatformCamera *cameraControl) - : QObject(*new QCameraImageProcessingPrivate, camera) -{ - Q_D(QCameraImageProcessing); - d->camera = camera; - d->init(cameraControl); -} - - -/*! - Destroys the camera focus object. -*/ - -QCameraImageProcessing::~QCameraImageProcessing() = default; - - -/*! - Returns true if image processing related settings are supported by this camera. -*/ -bool QCameraImageProcessing::isAvailable() const -{ - return d_func()->imageControl; -} - - -/*! - Returns the white balance mode being used. -*/ - -QCameraImageProcessing::WhiteBalanceMode QCameraImageProcessing::whiteBalanceMode() const -{ - Q_D(const QCameraImageProcessing); - return d->whiteBalance; -} - -/*! - Sets the white balance to \a mode. -*/ - -void QCameraImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode) -{ - Q_D(QCameraImageProcessing); - if (d->whiteBalance == mode || !isWhiteBalanceModeSupported(mode)) - return; - - d->imageControl->setParameter( - QPlatformCameraImageProcessing::WhiteBalancePreset, - QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(mode)); - d->whiteBalance = mode; - emit whiteBalanceModeChanged(); -} - -/*! - Returns true if the white balance \a mode is supported. -*/ - -bool QCameraImageProcessing::isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const -{ - Q_D(const QCameraImageProcessing); - if (!d->imageControl) - return false; - return d->imageControl->isParameterValueSupported( - QPlatformCameraImageProcessing::WhiteBalancePreset, - QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(mode)); - -} - -/*! - Returns the current color temperature if the - current white balance mode is \c WhiteBalanceManual. For other modes the - return value is undefined. -*/ - -qreal QCameraImageProcessing::manualWhiteBalance() const -{ - Q_D(const QCameraImageProcessing); - return d->colorTemperature; -} - -/*! - Sets manual white balance to \a colorTemperature. This is used - when whiteBalanceMode() is set to \c WhiteBalanceManual. The units are Kelvin. -*/ - -void QCameraImageProcessing::setManualWhiteBalance(qreal colorTemperature) -{ - Q_D(QCameraImageProcessing); - if (!d->imageControl) - return; - if (d->colorTemperature == colorTemperature) - return; - if (colorTemperature == 0) { - setWhiteBalanceMode(WhiteBalanceAuto); - } else if (!isWhiteBalanceModeSupported(WhiteBalanceManual)) { - return; - } else { - setWhiteBalanceMode(WhiteBalanceManual); - d->imageControl->setParameter( - QPlatformCameraImageProcessing::ColorTemperature, - QVariant(colorTemperature)); - } - d->colorTemperature = colorTemperature; - emit manualWhiteBalanceChanged(); -} - -/*! - Returns the brightness adjustment setting. - */ -qreal QCameraImageProcessing::brightness() const -{ - Q_D(const QCameraImageProcessing); - return d->brightness; -} - -/*! - 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) -{ - Q_D(QCameraImageProcessing); - if (!d->imageControl || d->brightness == value) - return; - d->brightness = value; - d->imageControl->setParameter(QPlatformCameraImageProcessing::BrightnessAdjustment, - QVariant(value)); - emit brightnessChanged(); -} - -/*! - Returns the contrast adjustment setting. -*/ -qreal QCameraImageProcessing::contrast() const -{ - Q_D(const QCameraImageProcessing); - return d->contrast; -} - -/*! - Set the contrast adjustment to \a value. - - Valid contrast adjustment values range between -1.0 and 1.0, with a default of 0. -*/ -void QCameraImageProcessing::setContrast(qreal value) -{ - Q_D(QCameraImageProcessing); - if (!d->imageControl || d->contrast == value) - return; - d->contrast = value; - d->imageControl->setParameter(QPlatformCameraImageProcessing::ContrastAdjustment, - QVariant(value)); - emit contrastChanged(); -} - -/*! - Returns the saturation adjustment value. -*/ -qreal QCameraImageProcessing::saturation() const -{ - Q_D(const QCameraImageProcessing); - return d->saturation; -} - -/*! - Sets the saturation adjustment value to \a value. - - Valid saturation values range between -1.0 and 1.0, with a default of 0. -*/ - -void QCameraImageProcessing::setSaturation(qreal value) -{ - Q_D(QCameraImageProcessing); - if (!d->imageControl || d->saturation == value) - return; - d->saturation = value; - d->imageControl->setParameter(QPlatformCameraImageProcessing::SaturationAdjustment, - QVariant(value)); - emit saturationChanged(); -} - -qreal QCameraImageProcessing::hue() const -{ - Q_D(const QCameraImageProcessing); - return d->hue; -} - -/*! - Sets the hue adjustment value to \a value. - - Valid hue values range between -1.0 and 1.0, with a default of 0. -*/ -void QCameraImageProcessing::setHue(qreal value) -{ - Q_D(QCameraImageProcessing); - if (!d->imageControl || d->hue == value) - return; - d->hue = value; - d->imageControl->setParameter(QPlatformCameraImageProcessing::HueAdjustment, - QVariant(value)); - emit hueChanged(); -} - -/*! - \enum QCameraImageProcessing::WhiteBalanceMode - - \value WhiteBalanceAuto Auto white balance mode. - \value WhiteBalanceManual Manual white balance. In this mode the white balance should be set with - setManualWhiteBalance() - \value WhiteBalanceSunlight Sunlight white balance mode. - \value WhiteBalanceCloudy Cloudy white balance mode. - \value WhiteBalanceShade Shade white balance mode. - \value WhiteBalanceTungsten Tungsten (incandescent) white balance mode. - \value WhiteBalanceFluorescent Fluorescent white balance mode. - \value WhiteBalanceFlash Flash white balance mode. - \value WhiteBalanceSunset Sunset white balance mode. -*/ - -/*! - \enum QCameraImageProcessing::ColorFilter - - \value ColorFilterNone No filter is applied to images. - \value ColorFilterGrayscale A grayscale filter. - \value ColorFilterNegative A negative filter. - \value ColorFilterSolarize A solarize filter. - \value ColorFilterSepia A sepia filter. - \value ColorFilterPosterize A posterize filter. - \value ColorFilterWhiteboard A whiteboard filter. - \value ColorFilterBlackboard A blackboard filter. - \value ColorFilterAqua An aqua filter. - - \since 5.5 -*/ - -/*! - Returns the color filter which will be applied to image data captured by the camera. - - \since 5.5 -*/ - -QCameraImageProcessing::ColorFilter QCameraImageProcessing::colorFilter() const -{ - Q_D(const QCameraImageProcessing); - return d->colorFilter; -} - - -/*! - Sets the color \a filter which will be applied to image data captured by the camera. - - \since 5.5 -*/ - -void QCameraImageProcessing::setColorFilter(QCameraImageProcessing::ColorFilter filter) -{ - Q_D(QCameraImageProcessing); - if (d->colorFilter == filter || !isColorFilterSupported(filter)) - return; - d->colorFilter = filter; - d->imageControl->setParameter( - QPlatformCameraImageProcessing::ColorFilter, - QVariant::fromValue<QCameraImageProcessing::ColorFilter>(filter)); - emit colorFilterChanged(); -} - -/*! - Returns true if a color \a filter is supported. - - \since 5.5 -*/ - -bool QCameraImageProcessing::isColorFilterSupported(QCameraImageProcessing::ColorFilter filter) const -{ - Q_D(const QCameraImageProcessing); - if (!d->imageControl) - return false; - return d->imageControl->isParameterValueSupported( - QPlatformCameraImageProcessing::ColorFilter, - QVariant::fromValue<QCameraImageProcessing::ColorFilter>(filter)); - -} - -QT_END_NAMESPACE - -#include "moc_qcameraimageprocessing.cpp" diff --git a/src/multimedia/camera/qcameraimageprocessing.h b/src/multimedia/camera/qcameraimageprocessing.h deleted file mode 100644 index fe23e092d..000000000 --- a/src/multimedia/camera/qcameraimageprocessing.h +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QCAMERAIMAGEPROCESSING_H -#define QCAMERAIMAGEPROCESSING_H - -#include <QtCore/qstringlist.h> -#include <QtCore/qpair.h> -#include <QtCore/qsize.h> -#include <QtCore/qpoint.h> -#include <QtCore/qrect.h> -#include <QtCore/qobject.h> - -#include <QtMultimedia/qtmultimediaglobal.h> -#include <QtMultimedia/qmediaenumdebug.h> - -QT_BEGIN_NAMESPACE - - -class QCamera; -class QPlatformCamera; - -class QCameraImageProcessingPrivate; -class Q_MULTIMEDIA_EXPORT QCameraImageProcessing : public QObject -{ - Q_OBJECT - Q_PROPERTY(WhiteBalanceMode whiteBalanceMode READ whiteBalanceMode WRITE setWhiteBalanceMode NOTIFY whiteBalanceModeChanged) - Q_PROPERTY(qreal manualWhiteBalance READ manualWhiteBalance WRITE setManualWhiteBalance NOTIFY manualWhiteBalanceChanged) - Q_PROPERTY(ColorFilter colorFilter READ colorFilter WRITE setColorFilter NOTIFY colorFilterChanged) - Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) - Q_PROPERTY(qreal contrast READ contrast WRITE setContrast NOTIFY contrastChanged) - Q_PROPERTY(qreal hue READ hue WRITE setHue NOTIFY hueChanged) - Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged) - Q_ENUMS(WhiteBalanceMode) - Q_ENUMS(ColorFilter) -public: - enum WhiteBalanceMode { - WhiteBalanceAuto = 0, - WhiteBalanceManual = 1, - WhiteBalanceSunlight = 2, - WhiteBalanceCloudy = 3, - WhiteBalanceShade = 4, - WhiteBalanceTungsten = 5, - WhiteBalanceFluorescent = 6, - WhiteBalanceFlash = 7, - WhiteBalanceSunset = 8 - }; - - enum ColorFilter { - ColorFilterNone, - ColorFilterGrayscale, - ColorFilterNegative, - ColorFilterSolarize, - ColorFilterSepia, - ColorFilterPosterize, - ColorFilterWhiteboard, - ColorFilterBlackboard, - ColorFilterAqua - }; - - bool isAvailable() const; - - WhiteBalanceMode whiteBalanceMode() const; - void setWhiteBalanceMode(WhiteBalanceMode mode); - Q_INVOKABLE bool isWhiteBalanceModeSupported(WhiteBalanceMode mode) const; - - qreal manualWhiteBalance() const; - void setManualWhiteBalance(qreal colorTemperature); - - qreal brightness() const; - void setBrightness(qreal value); - - qreal contrast() const; - void setContrast(qreal value); - - qreal saturation() const; - void setSaturation(qreal value); - - qreal hue() const; - void setHue(qreal value); - - ColorFilter colorFilter() const; - void setColorFilter(ColorFilter filter); - Q_INVOKABLE bool isColorFilterSupported(ColorFilter filter) const; - -Q_SIGNALS: - void whiteBalanceModeChanged() const; - void manualWhiteBalanceChanged() const; - - void brightnessChanged(); - void contrastChanged(); - void saturationChanged(); - void hueChanged(); - - void colorFilterChanged(); - -protected: - ~QCameraImageProcessing(); - -private: - friend class QCamera; - friend class QCameraPrivate; - QCameraImageProcessing(QCamera *camera, QPlatformCamera *cameraControl); - - Q_DISABLE_COPY(QCameraImageProcessing) - Q_DECLARE_PRIVATE(QCameraImageProcessing) -}; - -QT_END_NAMESPACE - -Q_MEDIA_ENUM_DEBUG(QCameraImageProcessing, WhiteBalanceMode) -Q_MEDIA_ENUM_DEBUG(QCameraImageProcessing, ColorFilter) - -#endif // QCAMERAIMAGEPROCESSING_H |