- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends

# QImage Class Reference

Search for all occurrences

## Detailed Description

Definition at line 87 of file qimage.h.

`#include <qimage.h>`

Inheritance diagram for QImage:
[legend]

List of all members.

## Public Types
enum | InvertMode { InvertRgb, InvertRgba }
enum | Format { Format_Invalid, Format_Mono, Format_MonoLSB, Format_Indexed8, Format_RGB32, Format_ARGB32, Format_ARGB32_Premultiplied, Format_RGB16, Format_ARGB8565_Premultiplied, Format_RGB666, Format_ARGB6666_Premultiplied, Format_RGB555, Format_ARGB8555_Premultiplied, Format_RGB888, Format_RGB444, Format_ARGB4444_Premultiplied, NImageFormats }
typedef QImageData * | DataPtr
## Public Member Functions
| QImage ()
| QImage (const QSize &size, Format format)
| QImage (int width, int height, Format format)
| QImage (uchar *data, int width, int height, Format format)
| QImage (const uchar *data, int width, int height, Format format)
| QImage (uchar *data, int width, int height, int bytesPerLine, Format format)
| QImage (const uchar *data, int width, int height, int bytesPerLine, Format format)
| QImage (const char *const xpm[])
| QImage (const QString &fileName, const char *format=0)
| QImage (const char *fileName, const char *format=0)
| QImage (const QImage &)
| ~QImage ()
QImage & | operator= (const QImage &)
bool | isNull () const
int | devType () const
bool | operator== (const QImage &) const
bool | operator!= (const QImage &) const
| operator QVariant () const
void | detach ()
bool | isDetached () const
QImage | copy (const QRect &rect=QRect()) const
QImage | copy (int x, int y, int w, int h) const
Format | format () const
QImage | convertToFormat (Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
QImage | convertToFormat (Format f, const QVector< QRgb > &colorTable, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
int | width () const
int | height () const
QSize | size () const
QRect | rect () const
int | depth () const
int | colorCount () const
int | bitPlaneCount () const
QRgb | color (int i) const
void | setColor (int i, QRgb c)
void | setColorCount (int)
bool | allGray () const
bool | isGrayscale () const
uchar * | bits ()
const uchar * | bits () const
const uchar * | constBits () const
int | byteCount () const
uchar * | scanLine (int)
const uchar * | scanLine (int) const
const uchar * | constScanLine (int) const
int | bytesPerLine () const
bool | valid (int x, int y) const
bool | valid (const QPoint &pt) const
int | pixelIndex (int x, int y) const
int | pixelIndex (const QPoint &pt) const
QRgb | pixel (int x, int y) const
QRgb | pixel (const QPoint &pt) const
void | setPixel (int x, int y, uint index_or_rgb)
void | setPixel (const QPoint &pt, uint index_or_rgb)
QVector< QRgb > | colorTable () const
void | setColorTable (const QVector< QRgb > colors)
void | fill (uint pixel)
bool | hasAlphaChannel () const
void | setAlphaChannel (const QImage &alphaChannel)
QImage | alphaChannel () const
QImage | createAlphaMask (Qt::ImageConversionFlags flags=Qt::AutoColor) const
QImage | createHeuristicMask (bool clipTight=true) const
QImage | createMaskFromColor (QRgb color, Qt::MaskMode mode=Qt::MaskInColor) const
QImage | scaled (int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
QImage | scaled (const QSize &s, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
QImage | scaledToWidth (int w, Qt::TransformationMode mode=Qt::FastTransformation) const
QImage | scaledToHeight (int h, Qt::TransformationMode mode=Qt::FastTransformation) const
QImage | transformed (const QMatrix &matrix, Qt::TransformationMode mode=Qt::FastTransformation) const
QImage | transformed (const QTransform &matrix, Qt::TransformationMode mode=Qt::FastTransformation) const
QImage | mirrored (bool horizontally=false, bool vertically=true) const
QImage | rgbSwapped () const
void | invertPixels (InvertMode=InvertRgb)
bool | load (QIODevice *device, const char *format)
bool | load (const QString &fileName, const char *format=0)
bool | loadFromData (const uchar *buf, int len, const char *format=0)
bool | loadFromData (const QByteArray &data, const char *aformat=0)
bool | save (const QString &fileName, const char *format=0, int quality=-1) const
bool | save (QIODevice *device, const char *format=0, int quality=-1) const
int | serialNumber () const
qint64 | cacheKey () const
QPaintEngine * | paintEngine () const
int | dotsPerMeterX () const
int | dotsPerMeterY () const
void | setDotsPerMeterX (int)
void | setDotsPerMeterY (int)
QPoint | offset () const
void | setOffset (const QPoint &)
QStringList | textKeys () const
QString | text (const QString &key=QString()) const
void | setText (const QString &key, const QString &value)
QString | text (const char *key, const char *lang=0) const
QList< QImageTextKeyLang > | textList () const
QStringList | textLanguages () const
QString | text (const QImageTextKeyLang &) const
void | setText (const char *key, const char *lang, const QString &)
DataPtr & | data_ptr ()
## Static Public Member Functions
static QMatrix | trueMatrix (const QMatrix &, int w, int h)
static QTransform | trueMatrix (const QTransform &, int w, int h)
static QImage | fromData (const uchar *data, int size, const char *format=0)
static QImage | fromData (const QByteArray &data, const char *format=0)
## Protected Member Functions
virtual int | metric (PaintDeviceMetric metric) const
## Friends
class | QWSOnScreenSurface
class | QRasterPixmapData
class | QPixmapCacheEntry
Q_GUI_EXPORT qint64 | qt_image_id (const QImage &image)
const QVector< QRgb > * | qt_image_colortable (const QImage &image)

## Member Typedef Documentation

typedef QImageData* DataPtr

Search for all occurrences

Definition at line 334 of file qimage.h.

## Member Enumeration Documentation

enum InvertMode

Search for all occurrences

Enumerator:

  InvertRgb | Search for all occurrences
  InvertRgba | Search for all occurrences

Definition at line 90 of file qimage.h.

    { InvertRgb, InvertRgba };

enum Format

Search for all occurrences

Enumerator:

  Format_Invalid | Search for all occurrences
  Format_Mono | Search for all occurrences
  Format_MonoLSB | Search for all occurrences
  Format_Indexed8 | Search for all occurrences
  Format_RGB32 | Search for all occurrences
  Format_ARGB32 | Search for all occurrences
  Format_ARGB32_Premultiplied | Search for all occurrences
  Format_RGB16 | Search for all occurrences
  Format_ARGB8565_Premultiplied | Search for all occurrences
  Format_RGB666 | Search for all occurrences
  Format_ARGB6666_Premultiplied | Search for all occurrences
  Format_RGB555 | Search for all occurrences
  Format_ARGB8555_Premultiplied | Search for all occurrences
  Format_RGB888 | Search for all occurrences
  Format_RGB444 | Search for all occurrences
  Format_ARGB4444_Premultiplied | Search for all occurrences
  NImageFormats | Search for all occurrences

Definition at line 91 of file qimage.h.

                    {
            Format_Invalid,
            Format_Mono,
            Format_MonoLSB,
            Format_Indexed8,
            Format_RGB32,
            Format_ARGB32,
            Format_ARGB32_Premultiplied,
            Format_RGB16,
            Format_ARGB8565_Premultiplied,
            Format_RGB666,
            Format_ARGB6666_Premultiplied,
            Format_RGB555,
            Format_ARGB8555_Premultiplied,
            Format_RGB888,
            Format_RGB444,
            Format_ARGB4444_Premultiplied,
    #if 0
            // reserved for future use
            Format_RGB15,
            Format_Grayscale16,
            Format_Grayscale8,
            Format_Grayscale4,
            Format_Grayscale4LSB,
            Format_Grayscale2,
            Format_Grayscale2LSB
    #endif
    #ifndef qdoc
            NImageFormats
    #endif
        };

## Constructor & Destructor Documentation

QImage | ( |  | ) |

QImage | ( | const QSize & | size,
|  | Format | format
| ) |  |

QImage | ( | int | width,
|  | int | height,
|  | Format | format
| ) |  |

QImage | ( | uchar * | data,
|  | int | width,
|  | int | height,
|  | Format | format
| ) |  |

QImage | ( | const uchar * | data,
|  | int | width,
|  | int | height,
|  | Format | format
| ) |  |

QImage | ( | uchar * | data,
|  | int | width,
|  | int | height,
|  | int | bytesPerLine,
|  | Format | format
| ) |  |

QImage | ( | const uchar * | data,
|  | int | width,
|  | int | height,
|  | int | bytesPerLine,
|  | Format | format
| ) |  |

QImage | ( | const char *const | xpm[] | ) | `[explicit]`

QImage | ( | const QString & | fileName,
|  | const char * | format = `0`
| ) |  | `[explicit]`

QImage | ( | const char * | fileName,
|  | const char * | format = `0`
| ) |  | `[explicit]`

QImage | ( | const QImage & |  | ) |

~QImage | ( |  | ) |

## Member Function Documentation

QImage& operator= | ( | const QImage & |  | ) |

bool isNull | ( |  | ) | const

Search for all occurrences

int devType | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QPaintDevice.

bool operator== | ( | const QImage & |  | ) | const

bool operator!= | ( | const QImage & |  | ) | const

operator QVariant | ( |  | ) | const

void detach | ( |  | ) |

Search for all occurrences

bool isDetached | ( |  | ) | const

Search for all occurrences

QImage copy | ( | const QRect & | rect = `QRect()` | ) | const

Search for all occurrences

QImage copy | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  | const `[inline]`

Search for all occurrences

Definition at line 154 of file qimage.h.

            { return copy(QRect(x, y, w, h)); }

Format format | ( |  | ) | const

Search for all occurrences

QImage convertToFormat | ( | Format | f,
|  | Qt::ImageConversionFlags | flags = `Qt::AutoColor`
| ) |  | const

Search for all occurrences

QImage convertToFormat | ( | Format | f,
|  | const QVector< QRgb > & | colorTable,
|  | Qt::ImageConversionFlags | flags = `Qt::AutoColor`
| ) |  | const

Search for all occurrences

int width | ( |  | ) | const

Search for all occurrences

Reimplemented from QPaintDevice.

int height | ( |  | ) | const

Search for all occurrences

Reimplemented from QPaintDevice.

QSize size | ( |  | ) | const

Search for all occurrences

QRect rect | ( |  | ) | const

Search for all occurrences

int depth | ( |  | ) | const

Search for all occurrences

Reimplemented from QPaintDevice.

int colorCount | ( |  | ) | const

Search for all occurrences

Reimplemented from QPaintDevice.

int bitPlaneCount | ( |  | ) | const

Search for all occurrences

QRgb color | ( | int | i | ) | const

Search for all occurrences

void setColor | ( | int | i,
|  | QRgb | c
| ) |  |

Search for all occurrences

void setColorCount | ( | int |  | ) |

Search for all occurrences

bool allGray | ( |  | ) | const

Search for all occurrences

bool isGrayscale | ( |  | ) | const

Search for all occurrences

uchar* bits | ( |  | ) |

Search for all occurrences

const uchar* bits | ( |  | ) | const

Search for all occurrences

const uchar* constBits | ( |  | ) | const

Search for all occurrences

int byteCount | ( |  | ) | const

Search for all occurrences

uchar* scanLine | ( | int |  | ) |

Search for all occurrences

const uchar* scanLine | ( | int |  | ) | const

Search for all occurrences

const uchar* constScanLine | ( | int |  | ) | const

Search for all occurrences

int bytesPerLine | ( |  | ) | const

Search for all occurrences

bool valid | ( | int | x,
|  | int | y
| ) |  | const

Search for all occurrences

Q_GUI_EXPORT_INLINE bool valid | ( | const QPoint & | pt | ) | const

Search for all occurrences

Definition at line 343 of file qimage.h.

    { return valid(pt.x(), pt.y()); }

int pixelIndex | ( | int | x,
|  | int | y
| ) |  | const

Search for all occurrences

Q_GUI_EXPORT_INLINE int pixelIndex | ( | const QPoint & | pt | ) | const

Search for all occurrences

Definition at line 344 of file qimage.h.

    { return pixelIndex(pt.x(), pt.y());}

QRgb pixel | ( | int | x,
|  | int | y
| ) |  | const

Search for all occurrences

Q_GUI_EXPORT_INLINE QRgb pixel | ( | const QPoint & | pt | ) | const

Search for all occurrences

Definition at line 345 of file qimage.h.

    { return pixel(pt.x(), pt.y()); }

void setPixel | ( | int | x,
|  | int | y,
|  | uint | index_or_rgb
| ) |  |

Search for all occurrences

Q_GUI_EXPORT_INLINE void setPixel | ( | const QPoint & | pt,
|  | uint | index_or_rgb
| ) |  |

Search for all occurrences

Definition at line 346 of file qimage.h.

    { setPixel(pt.x(), pt.y(), index_or_rgb); }

QVector<QRgb> colorTable | ( |  | ) | const

Search for all occurrences

void setColorTable | ( | const QVector< QRgb > | colors | ) |

Search for all occurrences

void fill | ( | uint | pixel | ) |

Search for all occurrences

bool hasAlphaChannel | ( |  | ) | const

Search for all occurrences

void setAlphaChannel | ( | const QImage & | alphaChannel | ) |

Search for all occurrences

QImage alphaChannel | ( |  | ) | const

Search for all occurrences

QImage createAlphaMask | ( | Qt::ImageConversionFlags | flags = `Qt::AutoColor` | ) | const

Search for all occurrences

QImage createHeuristicMask | ( | bool | clipTight = `true` | ) | const

Search for all occurrences

QImage createMaskFromColor | ( | QRgb | color,
|  | Qt::MaskMode | mode = `Qt::MaskInColor`
| ) |  | const

Search for all occurrences

QImage scaled | ( | int | w,
|  | int | h,
|  | Qt::AspectRatioMode | aspectMode = `Qt::IgnoreAspectRatio`,
|  | Qt::TransformationMode | mode = `Qt::FastTransformation`
| ) |  | const `[inline]`

Search for all occurrences

Definition at line 223 of file qimage.h.

            { return scaled(QSize(w, h), aspectMode, mode); }

QImage scaled | ( | const QSize & | s,
|  | Qt::AspectRatioMode | aspectMode = `Qt::IgnoreAspectRatio`,
|  | Qt::TransformationMode | mode = `Qt::FastTransformation`
| ) |  | const

Search for all occurrences

QImage scaledToWidth | ( | int | w,
|  | Qt::TransformationMode | mode = `Qt::FastTransformation`
| ) |  | const

Search for all occurrences

QImage scaledToHeight | ( | int | h,
|  | Qt::TransformationMode | mode = `Qt::FastTransformation`
| ) |  | const

Search for all occurrences

QImage transformed | ( | const QMatrix & | matrix,
|  | Qt::TransformationMode | mode = `Qt::FastTransformation`
| ) |  | const

Search for all occurrences

static QMatrix trueMatrix | ( | const QMatrix & | ,
|  | int | w,
|  | int | h
| ) |  | `[static]`

Search for all occurrences

QImage transformed | ( | const QTransform & | matrix,
|  | Qt::TransformationMode | mode = `Qt::FastTransformation`
| ) |  | const

Search for all occurrences

static QTransform trueMatrix | ( | const QTransform & | ,
|  | int | w,
|  | int | h
| ) |  | `[static]`

Search for all occurrences

QImage mirrored | ( | bool | horizontally = `false`,
|  | bool | vertically = `true`
| ) |  | const

Search for all occurrences

QImage rgbSwapped | ( |  | ) | const

Search for all occurrences

void invertPixels | ( | InvertMode | = `InvertRgb` | ) |

Search for all occurrences

bool load | ( | QIODevice * | device,
|  | const char * | format
| ) |  |

Search for all occurrences

bool load | ( | const QString & | fileName,
|  | const char * | format = `0`
| ) |  |

Search for all occurrences

bool loadFromData | ( | const uchar * | buf,
|  | int | len,
|  | const char * | format = `0`
| ) |  |

Search for all occurrences

bool loadFromData | ( | const QByteArray & | data,
|  | const char * | aformat = `0`
| ) |  | `[inline]`

Search for all occurrences

Definition at line 242 of file qimage.h.

            { return loadFromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), aformat); }

bool save | ( | const QString & | fileName,
|  | const char * | format = `0`,
|  | int | quality = `-1`
| ) |  | const

Search for all occurrences

bool save | ( | QIODevice * | device,
|  | const char * | format = `0`,
|  | int | quality = `-1`
| ) |  | const

Search for all occurrences

static QImage fromData | ( | const uchar * | data,
|  | int | size,
|  | const char * | format = `0`
| ) |  | `[static]`

Search for all occurrences

static QImage fromData | ( | const QByteArray & | data,
|  | const char * | format = `0`
| ) |  | `[inline, static]`

Search for all occurrences

Definition at line 249 of file qimage.h.

            { return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); }

int serialNumber | ( |  | ) | const

Search for all occurrences

qint64 cacheKey | ( |  | ) | const

Search for all occurrences

QPaintEngine* paintEngine | ( |  | ) | const `[virtual]`

Search for all occurrences

Implements QPaintDevice.

int dotsPerMeterX | ( |  | ) | const

Search for all occurrences

int dotsPerMeterY | ( |  | ) | const

Search for all occurrences

void setDotsPerMeterX | ( | int |  | ) |

Search for all occurrences

void setDotsPerMeterY | ( | int |  | ) |

Search for all occurrences

QPoint offset | ( |  | ) | const

Search for all occurrences

void setOffset | ( | const QPoint & |  | ) |

Search for all occurrences

QStringList textKeys | ( |  | ) | const

Search for all occurrences

QString text | ( | const QString & | key = `QString()` | ) | const

Search for all occurrences

void setText | ( | const QString & | key,
|  | const QString & | value
| ) |  |

Search for all occurrences

QString text | ( | const char * | key,
|  | const char * | lang = `0`
| ) |  | const

Search for all occurrences

QList<QImageTextKeyLang> textList | ( |  | ) | const

Search for all occurrences

QStringList textLanguages | ( |  | ) | const

Search for all occurrences

QString text | ( | const QImageTextKeyLang & |  | ) | const

Search for all occurrences

void setText | ( | const char * | key,
|  | const char * | lang,
|  | const QString & |
| ) |  |

Search for all occurrences

virtual int metric | ( | PaintDeviceMetric | metric | ) | const `[protected, virtual]`

Search for all occurrences

Reimplemented from QPaintDevice.

DataPtr& data_ptr | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 335 of file qimage.h.

    { return d; }

## Friends And Related Function Documentation

friend class QWSOnScreenSurface `[friend]`

Search for all occurrences

Definition at line 325 of file qimage.h.

friend class QRasterPixmapData `[friend]`

Search for all occurrences

Definition at line 328 of file qimage.h.

friend class QPixmapCacheEntry `[friend]`

Search for all occurrences

Definition at line 329 of file qimage.h.

Q_GUI_EXPORT qint64 qt_image_id | ( | const QImage & | image | ) | `[friend]`

Search for all occurrences

const QVector<QRgb>* qt_image_colortable | ( | const QImage & | image | ) | `[friend]`

Search for all occurrences

The documentation for this class was generated from the following file:

- QtGui/qimage.h

QImage QImage QImage QImage QImage QImage QImage QImage QImage QImage
QImage QImage QImage QImage QImage QImage QImage QImage QImage QImage