| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | 
| 4 | ** Contact: https://www.qt.io/licensing/ | 
| 5 | ** | 
| 6 | ** This file is part of the plugins of the Qt Toolkit. | 
| 7 | ** | 
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
| 9 | ** Commercial License Usage | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 11 | ** accordance with the commercial license agreement provided with the | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | 
| 16 | ** | 
| 17 | ** GNU Lesser General Public License Usage | 
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
| 19 | ** General Public License version 3 as published by the Free Software | 
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | 
| 21 | ** packaging of this file. Please review the following information to | 
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | 
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | 
| 24 | ** | 
| 25 | ** GNU General Public License Usage | 
| 26 | ** Alternatively, this file may be used under the terms of the GNU | 
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | 
| 28 | ** Public license version 3 or any later version approved by the KDE Free | 
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | 
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | 
| 31 | ** included in the packaging of this file. Please review the following | 
| 32 | ** information to ensure the GNU General Public License requirements will | 
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | 
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | 
| 35 | ** | 
| 36 | ** $QT_END_LICENSE$ | 
| 37 | ** | 
| 38 | ****************************************************************************/ | 
| 39 |  | 
| 40 | #ifndef QDECLARATIVECAMERAIMAGEPROCESSING_H | 
| 41 | #define QDECLARATIVECAMERAIMAGEPROCESSING_H | 
| 42 |  | 
| 43 | // | 
| 44 | //  W A R N I N G | 
| 45 | //  ------------- | 
| 46 | // | 
| 47 | // This file is not part of the Qt API.  It exists for the convenience | 
| 48 | // of other Qt classes.  This header file may change from version to | 
| 49 | // version without notice, or even be removed. | 
| 50 | // | 
| 51 | // We mean it. | 
| 52 | // | 
| 53 |  | 
| 54 | #include <qcamera.h> | 
| 55 | #include <qcameraimageprocessing.h> | 
| 56 |  | 
| 57 | QT_BEGIN_NAMESPACE | 
| 58 |  | 
| 59 | class QDeclarativeCamera; | 
| 60 |  | 
| 61 | class QDeclarativeCameraImageProcessing : public QObject | 
| 62 | { | 
| 63 |     Q_OBJECT | 
| 64 |     Q_ENUMS(WhiteBalanceMode) | 
| 65 |     Q_ENUMS(ColorFilter) | 
| 66 |  | 
| 67 |     Q_PROPERTY(WhiteBalanceMode whiteBalanceMode READ whiteBalanceMode WRITE setWhiteBalanceMode NOTIFY whiteBalanceModeChanged) | 
| 68 |     Q_PROPERTY(qreal manualWhiteBalance READ manualWhiteBalance WRITE setManualWhiteBalance NOTIFY manualWhiteBalanceChanged) | 
| 69 |     Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged REVISION 2) | 
| 70 |     Q_PROPERTY(qreal contrast READ contrast WRITE setContrast NOTIFY contrastChanged) | 
| 71 |     Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged) | 
| 72 |     Q_PROPERTY(qreal sharpeningLevel READ sharpeningLevel WRITE setSharpeningLevel NOTIFY sharpeningLevelChanged) | 
| 73 |     Q_PROPERTY(qreal denoisingLevel READ denoisingLevel WRITE setDenoisingLevel NOTIFY denoisingLevelChanged) | 
| 74 |     Q_PROPERTY(ColorFilter colorFilter READ colorFilter WRITE setColorFilter NOTIFY colorFilterChanged REVISION 1) | 
| 75 |     Q_PROPERTY(bool available READ isAvailable NOTIFY availableChanged REVISION 3) | 
| 76 |     Q_PROPERTY(QVariantList supportedColorFilters READ supportedColorFilters | 
| 77 |                NOTIFY supportedColorFiltersChanged REVISION 3) | 
| 78 |     Q_PROPERTY(QVariantList supportedWhiteBalanceModes READ supportedWhiteBalanceModes | 
| 79 |                NOTIFY supportedWhiteBalanceModesChanged REVISION 3) | 
| 80 | public: | 
| 81 |     enum WhiteBalanceMode { | 
| 82 |         WhiteBalanceAuto = QCameraImageProcessing::WhiteBalanceAuto, | 
| 83 |         WhiteBalanceManual = QCameraImageProcessing::WhiteBalanceManual, | 
| 84 |         WhiteBalanceSunlight = QCameraImageProcessing::WhiteBalanceSunlight, | 
| 85 |         WhiteBalanceCloudy = QCameraImageProcessing::WhiteBalanceCloudy, | 
| 86 |         WhiteBalanceShade = QCameraImageProcessing::WhiteBalanceShade, | 
| 87 |         WhiteBalanceTungsten = QCameraImageProcessing::WhiteBalanceTungsten, | 
| 88 |         WhiteBalanceFluorescent = QCameraImageProcessing::WhiteBalanceFluorescent, | 
| 89 |         WhiteBalanceFlash = QCameraImageProcessing::WhiteBalanceFlash, | 
| 90 |         WhiteBalanceSunset = QCameraImageProcessing::WhiteBalanceSunset, | 
| 91 |         WhiteBalanceVendor = QCameraImageProcessing::WhiteBalanceVendor | 
| 92 |     }; | 
| 93 |  | 
| 94 |     enum ColorFilter { | 
| 95 |         ColorFilterNone = QCameraImageProcessing::ColorFilterNone, | 
| 96 |         ColorFilterGrayscale = QCameraImageProcessing::ColorFilterGrayscale, | 
| 97 |         ColorFilterNegative = QCameraImageProcessing::ColorFilterNegative, | 
| 98 |         ColorFilterSolarize = QCameraImageProcessing::ColorFilterSolarize, | 
| 99 |         ColorFilterSepia = QCameraImageProcessing::ColorFilterSepia, | 
| 100 |         ColorFilterPosterize = QCameraImageProcessing::ColorFilterPosterize, | 
| 101 |         ColorFilterWhiteboard = QCameraImageProcessing::ColorFilterWhiteboard, | 
| 102 |         ColorFilterBlackboard = QCameraImageProcessing::ColorFilterBlackboard, | 
| 103 |         ColorFilterAqua = QCameraImageProcessing::ColorFilterAqua, | 
| 104 |         ColorFilterVendor = QCameraImageProcessing::ColorFilterVendor | 
| 105 |     }; | 
| 106 |  | 
| 107 |     ~QDeclarativeCameraImageProcessing(); | 
| 108 |  | 
| 109 |     WhiteBalanceMode whiteBalanceMode() const; | 
| 110 |     qreal manualWhiteBalance() const; | 
| 111 |  | 
| 112 |     qreal brightness() const; | 
| 113 |     qreal contrast() const; | 
| 114 |     qreal saturation() const; | 
| 115 |     qreal sharpeningLevel() const; | 
| 116 |     qreal denoisingLevel() const; | 
| 117 |  | 
| 118 |     ColorFilter colorFilter() const; | 
| 119 |  | 
| 120 |     bool isAvailable() const; | 
| 121 |     QVariantList supportedColorFilters() const; | 
| 122 |     QVariantList supportedWhiteBalanceModes() const; | 
| 123 |  | 
| 124 | public Q_SLOTS: | 
| 125 |     void setWhiteBalanceMode(QDeclarativeCameraImageProcessing::WhiteBalanceMode mode) const; | 
| 126 |     void setManualWhiteBalance(qreal colorTemp) const; | 
| 127 |  | 
| 128 |     Q_REVISION(2) void setBrightness(qreal value); | 
| 129 |     void setContrast(qreal value); | 
| 130 |     void setSaturation(qreal value); | 
| 131 |     void setSharpeningLevel(qreal value); | 
| 132 |     void setDenoisingLevel(qreal value); | 
| 133 |  | 
| 134 |     void setColorFilter(ColorFilter colorFilter); | 
| 135 |  | 
| 136 | Q_SIGNALS: | 
| 137 |     void whiteBalanceModeChanged(QDeclarativeCameraImageProcessing::WhiteBalanceMode) const; | 
| 138 |     void manualWhiteBalanceChanged(qreal) const; | 
| 139 |  | 
| 140 |     Q_REVISION(2) void brightnessChanged(qreal); | 
| 141 |     void contrastChanged(qreal); | 
| 142 |     void saturationChanged(qreal); | 
| 143 |     void sharpeningLevelChanged(qreal); | 
| 144 |     void denoisingLevelChanged(qreal); | 
| 145 |  | 
| 146 |     void colorFilterChanged(); | 
| 147 |  | 
| 148 |     void availableChanged(); | 
| 149 |     void supportedColorFiltersChanged(); | 
| 150 |     void supportedWhiteBalanceModesChanged(); | 
| 151 |  | 
| 152 | private: | 
| 153 |     friend class QDeclarativeCamera; | 
| 154 |     QDeclarativeCameraImageProcessing(QCamera *camera, QObject *parent = 0); | 
| 155 |  | 
| 156 |     QCameraImageProcessing *m_imageProcessing; | 
| 157 | }; | 
| 158 |  | 
| 159 | QT_END_NAMESPACE | 
| 160 |  | 
| 161 | QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraImageProcessing)) | 
| 162 |  | 
| 163 | #endif | 
| 164 |  |