summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-02-14 10:39:30 +0100
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-09-17 14:48:48 +0200
commitd84a6eab5129ba29951a7ba6d82820b21cc9872e (patch)
tree1d794ecd3f37363a286f3eeda8e571c36ec4006c /src/widgets
parentbce19cb9063003af5924c643f6fc1416146b4242 (diff)
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 <gunnar@sletta.org>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp7
1 files changed, 4 insertions, 3 deletions
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);