diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2014-07-09 13:38:25 +1000 |
---|---|---|
committer | Andrew den Exter <andrew.den.exter@qinetic.com.au> | 2014-11-28 06:08:11 +0100 |
commit | 25ad679c254766a3ac0bf3925232052941485442 (patch) | |
tree | f56748cdde28851ac5438b53de93fb9fbf0c14ce /src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp | |
parent | be7fef656a1d087d3d1d3fa102da4fce85855935 (diff) |
Add a color filter property to QCameraImageProcessing.
[ChangeLog] New color filter property for QCameraImageProcessing.
Change-Id: I999e349e3e4f284b533fa62ba50903fbd21cb400
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp')
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp | 73 |
1 files changed, 68 insertions, 5 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp index 5e4b67b29..65b4af484 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp @@ -55,6 +55,30 @@ CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session) m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent; unlockWhiteBalance(); + +#if GST_CHECK_VERSION(1, 0, 0) + m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL); + if (m_session->photography()) { + m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA); + m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE); + m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE); + m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE); +#if GST_CHECK_VERSION(1, 2, 0) + m_filterMap.insert(QCameraImageProcessing::ColorFilterPosterize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE); + m_filterMap.insert(QCameraImageProcessing::ColorFilterWhiteboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD); + m_filterMap.insert(QCameraImageProcessing::ColorFilterBlackboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD); + m_filterMap.insert(QCameraImageProcessing::ColorFilterAqua, GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA); +#endif + } +#else + m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL); + if (m_session->photography()) { + m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA); + m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRAYSCALE); + m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE); + m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE); + } +#endif #endif updateColorBalanceValues(); @@ -179,6 +203,14 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC return qAbs(value.toReal()) <= 1.0; case WhiteBalancePreset: return isWhiteBalanceModeSupported(value.value<QCameraImageProcessing::WhiteBalanceMode>()); + case ColorFilter: { + const QCameraImageProcessing::ColorFilter filter = value.value<QCameraImageProcessing::ColorFilter>(); +#ifdef HAVE_GST_PHOTOGRAPHY + return m_filterMap.contains(filter); +#else + return filter == QCameraImageProcessing::ColorFilterNone; +#endif + } default: break; } @@ -189,12 +221,28 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC QVariant CameraBinImageProcessing::parameter( QCameraImageProcessingControl::ProcessingParameter parameter) const { - if (parameter == QCameraImageProcessingControl::WhiteBalancePreset) + switch (parameter) { + case QCameraImageProcessingControl::WhiteBalancePreset: return QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(whiteBalanceMode()); - else if (m_values.contains(parameter)) - return m_values.value(parameter); - else - return QVariant(); + case QCameraImageProcessingControl::ColorFilter: +#ifdef HAVE_GST_PHOTOGRAPHY + if (GstPhotography *photography = m_session->photography()) { +#if GST_CHECK_VERSION(1, 0, 0) + GstPhotographyColorToneMode mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL; + gst_photography_get_color_tone_mode(photography, &mode); +#else + GstColourToneMode mode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL; + gst_photography_get_colour_tone_mode(photography, &mode); +#endif + return QVariant::fromValue(m_filterMap.key(mode, QCameraImageProcessing::ColorFilterNone)); + } +#endif + return QVariant::fromValue(QCameraImageProcessing::ColorFilterNone); + default: + return m_values.contains(parameter) + ? QVariant(m_values.value(parameter)) + : QVariant(); + } } void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::ProcessingParameter parameter, @@ -213,6 +261,21 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce case WhiteBalancePreset: setWhiteBalanceMode(value.value<QCameraImageProcessing::WhiteBalanceMode>()); break; + case QCameraImageProcessingControl::ColorFilter: +#ifdef HAVE_GST_PHOTOGRAPHY + if (GstPhotography *photography = m_session->photography()) { +#if GST_CHECK_VERSION(1, 0, 0) + gst_photography_set_color_tone_mode(photography, m_filterMap.value( + value.value<QCameraImageProcessing::ColorFilter>(), + GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL)); +#else + gst_photography_set_colour_tone_mode(photography, m_filterMap.value( + value.value<QCameraImageProcessing::ColorFilter>(), + GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL)); +#endif + } +#endif + break; default: break; } |