From d84a6eab5129ba29951a7ba6d82820b21cc9872e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 14 Feb 2014 10:39:30 +0100 Subject: Add Grayscale8 and Alpha8 formats to QImage and drawing Extend the QImage format with two 8-bit grayscale and alpha formats. These formats have the advantage over Indexed8 that they have simpler conversion and can be rendered to by the raster engine. [ChangeLog][QtGui][QImage] Added support grayscale and alpha 8-bit formats which can also be rendered to. Change-Id: I4343c80a92a3dda196aa38d0c3ea251b094fc274 Reviewed-by: Gunnar Sletta --- src/widgets/effects/qpixmapfilter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/widgets/effects') diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index c7ae4e2996..7207469fe6 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -713,7 +713,8 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied || img.format() == QImage::Format_RGB32 - || img.format() == QImage::Format_Indexed8); + || img.format() == QImage::Format_Indexed8 + || img.format() == QImage::Format_Grayscale8); // choose the alpha such that pixels at radius distance from a fully // saturated pixel will have an alpha component of no greater than @@ -788,7 +789,7 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source) QImage srcImage = source; - if (source.format() == QImage::Format_Indexed8) { + if (source.format() == QImage::Format_Indexed8 || source.format() == QImage::Format_Grayscale8) { // assumes grayscale QImage dest(source.width() / 2, source.height() / 2, srcImage.format()); @@ -898,7 +899,7 @@ Q_WIDGETS_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, Q_WIDGETS_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0) { - if (blurImage.format() == QImage::Format_Indexed8) + if (blurImage.format() == QImage::Format_Indexed8 || blurImage.format() == QImage::Format_Grayscale8) expblur<12, 10, true>(blurImage, radius, quality, transposed); else expblur<12, 10, false>(blurImage, radius, quality, transposed); -- cgit v1.2.3