summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-02-20 13:45:32 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-09 00:14:49 +0100
commitd263ab6af5bd264217cb0beb389586163c5a8348 (patch)
tree675bb2ec7de6cb174bd938903bf3079872a58086 /src/gui
parentaa5f3c829c308b6765aa390524ad840bd33258e8 (diff)
Create consistent sets of QImage methods
Adds consistently named inplace and imperative methods. Change-Id: I8739c1c4585d2ba4aa181bb9a681255d76c120d7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qimage.cpp41
-rw-r--r--src/gui/image/qimage.h16
2 files changed, 49 insertions, 8 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 0866da67f9..793fd665aa 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2033,7 +2033,20 @@ QImage::Format QImage::format() const
The specified image conversion \a flags control how the image data
is handled during the conversion process.
- \sa {Image Formats}
+ \sa convertTo(), {Image Formats}
+*/
+
+/*!
+ \fn QImage QImage::convertedTo(Format format, Qt::ImageConversionFlags flags) const &
+ \fn QImage QImage::convertedTo(Format format, Qt::ImageConversionFlags flags) &&
+ \since 6.0
+
+ Returns a copy of the image in the given \a format.
+
+ The specified image conversion \a flags control how the image data
+ is handled during the conversion process.
+
+ \sa convertTo(), {Image Formats}
*/
/*!
@@ -2235,7 +2248,7 @@ bool QImage::reinterpretAsFormat(Format format)
The specified image conversion \a flags control how the image data
is handled during the conversion process.
- \sa convertToFormat()
+ \sa convertedTo()
*/
void QImage::convertTo(Format format, Qt::ImageConversionFlags flags)
@@ -3066,7 +3079,17 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const
Note that the original image is not changed.
- \sa {QImage#Image Transformations}{Image Transformations}
+ \sa mirror(), {QImage#Image Transformations}{Image Transformations}
+*/
+
+/*!
+ \fn void QImage::mirror(bool horizontal = false, bool vertical = true)
+ \since 6.0
+
+ Mirrors of the image in the horizontal and/or the vertical direction depending
+ on whether \a horizontal and \a vertical are set to true or false.
+
+ \sa mirrored(), {QImage#Image Transformations}{Image Transformations}
*/
template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src,
@@ -3278,7 +3301,17 @@ void QImage::mirrored_inplace(bool horizontal, bool vertical)
The original QImage is not changed.
- \sa {QImage#Image Transformations}{Image Transformations}
+ \sa rgbSwap(), {QImage#Image Transformations}{Image Transformations}
+*/
+
+/*!
+ \fn void QImage::rgbSwap()
+ \since 6.0
+
+ Swaps the values of the red and blue components of all pixels, effectively converting
+ an RGB image to an BGR image.
+
+ \sa rgbSwapped(), {QImage#Image Transformations}{Image Transformations}
*/
static inline void rgbSwapped_generic(int width, int height, const QImage *src, QImage *dst, const QPixelLayout* layout)
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 1d4ee3168f..0866984dec 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -170,6 +170,10 @@ public:
Qt::ImageConversionFlags flags = Qt::AutoColor) const;
bool reinterpretAsFormat(Format f);
+ Q_REQUIRED_RESULT QImage convertedTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
+ { return convertToFormat(f, flags); }
+ Q_REQUIRED_RESULT QImage convertedTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
+ { return convertToFormat(f, flags); }
void convertTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor);
int width() const;
@@ -245,14 +249,18 @@ public:
QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
static QTransform trueMatrix(const QTransform &, int w, int h);
- QImage mirrored(bool horizontally = false, bool vertically = true) const &
+ Q_REQUIRED_RESULT QImage mirrored(bool horizontally = false, bool vertically = true) const &
{ return mirrored_helper(horizontally, vertically); }
- QImage &&mirrored(bool horizontally = false, bool vertically = true) &&
+ Q_REQUIRED_RESULT QImage mirrored(bool horizontally = false, bool vertically = true) &&
{ mirrored_inplace(horizontally, vertically); return std::move(*this); }
- QImage rgbSwapped() const &
+ Q_REQUIRED_RESULT QImage rgbSwapped() const &
{ return rgbSwapped_helper(); }
- QImage &&rgbSwapped() &&
+ Q_REQUIRED_RESULT QImage rgbSwapped() &&
{ rgbSwapped_inplace(); return std::move(*this); }
+ void mirror(bool horizontally = false, bool vertically = true)
+ { mirrored_inplace(horizontally, vertically); }
+ void rgbSwap()
+ { rgbSwapped_inplace(); }
void invertPixels(InvertMode = InvertRgb);
QColorSpace colorSpace() const;