summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qimage.cpp23
-rw-r--r--src/gui/image/qimage.h2
2 files changed, 25 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
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 7a1f37c5cf..45f571807c 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -196,6 +196,8 @@ public:
Q_REQUIRED_RESULT QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
bool reinterpretAsFormat(Format f);
+ void convertTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor);
+
int width() const;
int height() const;
QSize size() const;