diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-04-13 14:52:53 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-04-16 11:01:22 +0000 |
commit | f118fc0ff83777962acb44313269bd98e7644cb6 (patch) | |
tree | 5de372e7ef44d8bd1fa49ef65f06f5deb245b611 /src/imports/multimedia/qdeclarativecameraimageprocessing.cpp | |
parent | 8a885cf1d135193196b478f1eed0493b2da39e97 (diff) |
Get rid of QDeclarativeCameraImageProcessing
Expose QCameraImageProcessing directly to QML. The API is the
same.
Change-Id: I6f0e3d7f7eef7e1d593152edae5df98d260c6f66
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/imports/multimedia/qdeclarativecameraimageprocessing.cpp')
-rw-r--r-- | src/imports/multimedia/qdeclarativecameraimageprocessing.cpp | 311 |
1 files changed, 0 insertions, 311 deletions
diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp b/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp deleted file mode 100644 index d6c7c2ab8..000000000 --- a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins 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 "qdeclarativecamera_p.h" -#include "qdeclarativecameraimageprocessing_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype CameraImageProcessing - \instantiates QDeclarativeCameraImageProcessing - \inqmlmodule QtMultimedia - \brief An interface for camera capture related settings. - \ingroup multimedia_qml - \ingroup camera_qml - - CameraImageProcessing provides control over post-processing - done by the camera middleware, including white balance adjustments, - contrast and saturation - - It should not be constructed separately, instead the - \c imageProcessing property of a \l Camera should be used. - - \qml - - Camera { - id: camera - - imageProcessing { - whiteBalanceMode: Camera.WhiteBalanceTungsten - contrast: 0.66 - saturation: -0.5 - } - } - - \endqml - - -*/ -/*! - \class QDeclarativeCameraImageProcessing - \internal - \brief The CameraCapture provides an interface for camera capture related settings -*/ - - -QDeclarativeCameraImageProcessing::QDeclarativeCameraImageProcessing(QCamera *camera, QObject *parent) : - QObject(parent) -{ - m_imageProcessing = camera->imageProcessing(); - - connect(camera, &QCamera::statusChanged, [this](QCamera::Status status) { - if (status != QCamera::InactiveStatus && status != QCamera::ActiveStatus) - return; - - emit supportedColorFiltersChanged(); - emit supportedWhiteBalanceModesChanged(); - }); -} - -QDeclarativeCameraImageProcessing::~QDeclarativeCameraImageProcessing() = default; - -/*! - \qmlproperty enumeration QtMultimedia::CameraImageProcessing::whiteBalanceMode - - \table - \header \li Value \li Description - \row \li WhiteBalanceManual \li Manual white balance. In this mode the manual white balance property value is used. - \row \li WhiteBalanceAuto \li Auto white balance mode. - \row \li WhiteBalanceSunlight \li Sunlight white balance mode. - \row \li WhiteBalanceCloudy \li Cloudy white balance mode. - \row \li WhiteBalanceShade \li Shade white balance mode. - \row \li WhiteBalanceTungsten \li Tungsten white balance mode. - \row \li WhiteBalanceFluorescent \li Fluorescent white balance mode. - \row \li WhiteBalanceFlash \li Flash white balance mode. - \row \li WhiteBalanceSunset \li Sunset white balance mode. - \endtable - - \sa manualWhiteBalance -*/ -QDeclarativeCameraImageProcessing::WhiteBalanceMode QDeclarativeCameraImageProcessing::whiteBalanceMode() const -{ - return WhiteBalanceMode(m_imageProcessing->whiteBalanceMode()); -} - -void QDeclarativeCameraImageProcessing::setWhiteBalanceMode(QDeclarativeCameraImageProcessing::WhiteBalanceMode mode) const -{ - if (whiteBalanceMode() != mode) { - m_imageProcessing->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode(mode)); - emit whiteBalanceModeChanged(whiteBalanceMode()); - } -} - -/*! - \qmlproperty qreal QtMultimedia::CameraImageProcessing::manualWhiteBalance - - The color temperature used when in manual white balance mode (WhiteBalanceManual). - The units are Kelvin. - - \sa whiteBalanceMode -*/ -qreal QDeclarativeCameraImageProcessing::manualWhiteBalance() const -{ - return m_imageProcessing->manualWhiteBalance(); -} - -void QDeclarativeCameraImageProcessing::setManualWhiteBalance(qreal colorTemp) const -{ - if (manualWhiteBalance() != colorTemp) { - m_imageProcessing->setManualWhiteBalance(colorTemp); - emit manualWhiteBalanceChanged(manualWhiteBalance()); - } -} - -/*! - \qmlproperty qreal QtMultimedia::CameraImageProcessing::brightness - - Image brightness adjustment. - Valid brightness adjustment values range between -1.0 and 1.0, with a default of 0. - - \since 5.7 -*/ -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. - Valid contrast adjustment values range between -1.0 and 1.0, with a default of 0. -*/ -qreal QDeclarativeCameraImageProcessing::contrast() const -{ - return m_imageProcessing->contrast(); -} - -void QDeclarativeCameraImageProcessing::setContrast(qreal value) -{ - if (value != contrast()) { - m_imageProcessing->setContrast(value); - emit contrastChanged(contrast()); - } -} - -/*! - \qmlproperty qreal QtMultimedia::CameraImageProcessing::saturation - - Image saturation adjustment. - Valid saturation adjustment values range between -1.0 and 1.0, the default is 0. -*/ -qreal QDeclarativeCameraImageProcessing::saturation() const -{ - return m_imageProcessing->saturation(); -} - -void QDeclarativeCameraImageProcessing::setSaturation(qreal value) -{ - if (value != saturation()) { - m_imageProcessing->setSaturation(value); - emit saturationChanged(saturation()); - } -} - -/*! - \qmlproperty enumeration QtMultimedia::CameraImageProcessing::colorFilter - - This property holds which color filter if any will be applied to image data captured by the camera. - - It can be one of: - - \table - \row \li CameraImageProcessing.ColorFilterNone \li No filter is applied to images. - \row \li CameraImageProcessing.ColorFilterGrayscale \li A grayscale filter. - \row \li CameraImageProcessing.ColorFilterNegative \li A negative filter. - \row \li CameraImageProcessing.ColorFilterSolarize \li A solarize filter. - \row \li CameraImageProcessing.ColorFilterSepia \li A sepia filter. - \row \li CameraImageProcessing.ColorFilterPosterize \li A posterize filter. - \row \li CameraImageProcessing.ColorFilterWhiteboard \li A whiteboard filter. - \row \li CameraImageProcessing.ColorFilterBlackboard \li A blackboard filter. - \row \li CameraImageProcessing.ColorFilterAqua \li An aqua filter. - \endtable - - \since 5.5 -*/ - -QDeclarativeCameraImageProcessing::ColorFilter QDeclarativeCameraImageProcessing::colorFilter() const -{ - return ColorFilter(m_imageProcessing->colorFilter()); -} - -/*! - \qmlproperty bool QtMultimedia::CameraImageProcessing::isAvailable - - This property holds if image processing related settings are supported by this camera. - - \since 5.11 -*/ -bool QDeclarativeCameraImageProcessing::isAvailable() const -{ - return m_imageProcessing->isAvailable(); -} - -/*! - \qmlproperty list<ColorFilter> QtMultimedia::CameraImageProcessing::supportedColorFilters - - This property holds the supported color filters by this camera. - - \since 5.11 -*/ -QVariantList QDeclarativeCameraImageProcessing::supportedColorFilters() const -{ - QVariantList supportedFilters; - - for (int i = int(ColorFilterNone); i <= int(ColorFilterAqua); ++i) { - if (m_imageProcessing->isColorFilterSupported((QCameraImageProcessing::ColorFilter) i)) - supportedFilters.append(i); - } - - return supportedFilters; -} - -/*! - \qmlproperty list<WhiteBalanceMode> QtMultimedia::CameraImageProcessing::supportedWhiteBalanceModes - - This property holds the supported white balance modes by this camera. - - \since 5.11 -*/ -QVariantList QDeclarativeCameraImageProcessing::supportedWhiteBalanceModes() const -{ - QVariantList supportedModes; - - for (int i = int(WhiteBalanceAuto); i <= int(WhiteBalanceSunset); i++) { - if (m_imageProcessing->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode(i))) - supportedModes.append(i); - } - - return supportedModes; -} - -void QDeclarativeCameraImageProcessing::setColorFilter(ColorFilter filter) -{ - if (this->colorFilter() != filter) { - m_imageProcessing->setColorFilter(QCameraImageProcessing::ColorFilter(filter)); - emit colorFilterChanged(); - } -} - -/*! - \qmlsignal QtMultimedia::Camera::whiteBalanceModeChanged() - This signal is emitted when the \c whiteBalanceMode property is changed. - - The corresponding handler is \c onWhiteBalanceModeChanged. -*/ - -/*! - \qmlsignal QtMultimedia::Camera::manualWhiteBalanceChanged() - This signal is emitted when the \c manualWhiteBalance property is changed. - - The corresponding handler is \c onManualWhiteBalanceChanged. -*/ - -QT_END_NAMESPACE - -#include "moc_qdeclarativecameraimageprocessing_p.cpp" |