summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-09-28 13:06:20 +0200
committerMitch Curtis <mitch.curtis@qt.io>2020-10-12 13:00:43 +0200
commit98d65f2ff4eb86c052311e798a50ecbd635351a7 (patch)
tree1379b8ec645bf28a58375794941f45b0644a5d15 /src/gui/image/qimage.cpp
parent418389c3ed925b2da3538d808ceeb53727978a8c (diff)
Add an example to the documentation of QImage::scanLine()
I couldn't find any examples in Qt's documentation of this when I was trying to use it in a project. Pick-to: 5.15 5.12 Change-Id: Ic7b7b71f219b2c1012829980866940b9a77bd11f Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r--src/gui/image/qimage.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 2a16b2b845..b973b1c6a0 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1546,6 +1546,10 @@ void QImage::setColor(int i, QRgb c)
it follows the native alignment of 64-bit integers (64-bit for most
platforms, but notably 32-bit on i386).
+ For example, to remove the green component of each pixel in an image:
+
+ \snippet code/src_gui_image_qimage.cpp scanLine
+
\warning If you are accessing 32-bpp image data, cast the returned
pointer to \c{QRgb*} (QRgb has a 32-bit size) and use it to
read/write the pixel value. You cannot use the \c{uchar*} pointer