7#include <QtGui/qtguiglobal.h>
8#include <QtGui/qcolor.h>
10#include <QtGui/qpaintdevice.h>
11#include <QtGui/qpixelformat.h>
12#include <QtGui/qtransform.h>
13#include <QtCore/qbytearray.h>
14#include <QtCore/qbytearrayview.h>
15#include <QtCore/qrect.h>
16#include <QtCore/qstring.h>
17#include <QtCore/qcontainerfwd.h>
19#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
92#ifndef QT_NO_IMAGEFORMAT_XPM
93 explicit QImage(
const char *
const xpm[]);
104 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(
QImage)
116 bool isDetached()
const;
125 {
return convertToFormat_helper(
f,
flags); }
128 if (convertToFormat_inplace(
f,
flags))
129 return std::move(*
this);
131 return convertToFormat_helper(
f,
flags);
136 bool reinterpretAsFormat(
Format f);
138 {
return convertToFormat(
f,
flags); }
140 {
return convertToFormat(
f,
flags); }
150 int bitPlaneCount()
const;
154 void setColorCount(
int);
156 bool allGray()
const;
157 bool isGrayscale()
const;
161 const uchar *constBits()
const;
165 uchar *scanLine(
int);
166 const uchar *scanLine(
int)
const;
167 const uchar *constScanLine(
int)
const;
170 bool valid(
int x,
int y)
const;
171 bool valid(
const QPoint &pt)
const;
173 int pixelIndex(
int x,
int y)
const;
174 int pixelIndex(
const QPoint &pt)
const;
176 QRgb pixel(
int x,
int y)
const;
179 void setPixel(
int x,
int y,
uint index_or_rgb);
180 void setPixel(
const QPoint &pt,
uint index_or_rgb);
182 QColor pixelColor(
int x,
int y)
const;
185 void setPixelColor(
int x,
int y,
const QColor &
c);
192 void setDevicePixelRatio(
qreal scaleFactor);
193 QSizeF deviceIndependentSize()
const;
200 bool hasAlphaChannel()
const;
201 void setAlphaChannel(
const QImage &alphaChannel);
203#ifndef QT_NO_IMAGE_HEURISTIC_MASK
218 [[nodiscard]]
QImage mirrored(
bool horizontally =
false,
bool vertically =
true) const &
219 {
return mirrored_helper(horizontally, vertically); }
220 [[nodiscard]]
QImage mirrored(
bool horizontally =
false,
bool vertically =
true) &&
221 { mirrored_inplace(horizontally, vertically);
return std::move(*
this); }
223 {
return rgbSwapped_helper(); }
225 { rgbSwapped_inplace();
return std::move(*
this); }
226 void mirror(
bool horizontally =
false,
bool vertically =
true)
227 { mirrored_inplace(horizontally, vertically); }
229 { rgbSwapped_inplace(); }
230 void invertPixels(InvertMode = InvertRgb);
261 int dotsPerMeterX()
const;
262 int dotsPerMeterY()
const;
263 void setDotsPerMeterX(
int);
264 void setDotsPerMeterY(
int);
266 void setOffset(
const QPoint&);
277#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
280#if defined(Q_OS_WIN) || defined(Q_QDOC)
281 HBITMAP toHBITMAP()
const;
283 static QImage fromHBITMAP(HBITMAP hbitmap);
288 virtual int metric(PaintDeviceMetric metric)
const override;
289 QImage mirrored_helper(
bool horizontal,
bool vertical)
const;
291 void mirrored_inplace(
bool horizontal,
bool vertical);
295 QImage smoothScaled(
int w,
int h)
const;
297 void detachMetadata(
bool invalidateCache =
false);
316inline
bool QImage::valid(const
QPoint &pt)
const {
return valid(pt.x(), pt.y()); }
325#if !defined(QT_NO_DATASTREAM)
330#ifndef QT_NO_DEBUG_STREAM
IOBluetoothDevice * device
The QColorSpace class provides a color space abstraction.
The QColor class provides colors based on RGB, HSV or CMYK values.
\inmodule QtCore\reentrant
\inmodule QtCore \reentrant
QImage scaled(const QSize &s, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
Returns a copy of the image scaled to a rectangle defined by the given size according to the given as...
void mirror(bool horizontally=false, bool vertically=true)
QImage createAlphaMask(Qt::ImageConversionFlags flags=Qt::AutoColor) const
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setPixel(int x, int y, uint index_or_rgb)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setPixelColor(int x, int y, const QColor &c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QRgb pixel(int x, int y) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QImage transformed(const QTransform &matrix, Qt::TransformationMode mode=Qt::FastTransformation) const
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
bool loadFromData(const QByteArray &data, const char *format=nullptr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QImage createHeuristicMask(bool clipTight=true) const
void rgbSwapped_inplace()
QSize size() const
Returns the size of the image, i.e.
int width() const
Returns the width of the image.
int height() const
Returns the height of the image.
void setColorTable(const QList< QRgb > &colors)
QImage createMaskFromColor(QRgb color, Qt::MaskMode mode=Qt::MaskInColor) const
Format
The following image formats are available in Qt.
@ Format_RGBA32FPx4_Premultiplied
@ Format_RGBA64_Premultiplied
@ Format_ARGB6666_Premultiplied
@ Format_ARGB8555_Premultiplied
@ Format_RGBA8888_Premultiplied
@ Format_ARGB8565_Premultiplied
@ Format_RGBA16FPx4_Premultiplied
@ Format_A2BGR30_Premultiplied
@ Format_ARGB32_Premultiplied
@ Format_A2RGB30_Premultiplied
@ Format_ARGB4444_Premultiplied
QImage convertedTo(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) &&
QImage mirrored(bool horizontally=false, bool vertically=true) &&
QImage mirrored(bool horizontally=false, bool vertically=true) const &
QColor pixelColor(int x, int y) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QImage rgbSwapped() const &
QImage scaledToHeight(int h, Qt::TransformationMode mode=Qt::FastTransformation) const
Returns a scaled copy of the image.
static QImage fromData(const QByteArray &data, const char *format=nullptr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QImage(QImage &&other) noexcept
Move-constructs a QImage instance, making it point at the same object that other was pointing to.
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) &&
QRect rect() const
Returns the enclosing rectangle (0, 0, width(), height()) of the image.
QImage rgbSwapped_helper() const
int colorCount() const
Returns the depth of the image.
int pixelIndex(int x, int y) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QImage convertedTo(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const &
InvertMode
This enum type is used to describe how pixel values should be inverted in the invertPixels() function...
QImage copy(int x, int y, int w, int h) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const &
qreal devicePixelRatio() const
virtual int devType() const
virtual int metric(PaintDeviceMetric metric) const
virtual QPaintEngine * paintEngine() const =0
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
static jboolean copy(JNIEnv *, jobject)
#define Q_DECL_CF_RETURNS_RETAINED
constexpr bool operator!=(const timespec &t1, const timespec &t2)
#define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
void(* QImageCleanupFunction)(void *)
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QImage &)
Q_GUI_EXPORT QDataStream & operator<<(QDataStream &, const QImage &)
[0]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
static QT_BEGIN_NAMESPACE const QRgb colors[][14]
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
QImage scaled(const QImage &image)
[0]
myFilter setColor(QColor(128, 0, 0))
insertRed setText("insert red text")