diff options
author | Mikhail Svetkin <mikhail.svetkin@qt.io> | 2018-11-20 18:36:46 +0500 |
---|---|---|
committer | Mikhail Svetkin <mikhail.svetkin@qt.io> | 2019-01-25 20:50:28 +0000 |
commit | e81acde7d0cf5fb44a3fb2cf0bf7aaa2c65f807e (patch) | |
tree | 69e05c7a3545cb2ac2a5a3f7d8d27f938e8f84d0 /src/gui/image/qimage.cpp | |
parent | c2b4e7a2153842fa8eb47ced96018e2477f4347f (diff) |
Introduce QImage::convertTo
QImage::convertTo can be used to change the format of an image in place.
[ChangeLog][QtGui][QImage] A new method convertTo is has been
added to change the format of a QImage in place.
Change-Id: Ib31379085c4b97e56c3cb569f144062bcd3fdc20
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 23b3670d01..c02a396b00 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2243,6 +2243,29 @@ bool QImage::reinterpretAsFormat(Format format) } /*! + \since 5.13 + + Detach and convert the image to the given \a format in place. + + The specified image conversion \a flags control how the image data + is handled during the conversion process. + + \sa convertToFormat() +*/ + +void QImage::convertTo(Format f, Qt::ImageConversionFlags flags) +{ + if (!d || f == QImage::Format_Invalid) + return; + + detach(); + if (convertToFormat_inplace(f, flags)) + return; + + *this = convertToFormat_helper(f, flags); +} + +/*! \fn bool QImage::valid(const QPoint &pos) const Returns \c true if \a pos is a valid coordinate pair within the |