QImage Class Reference

#include <qimage.h>

Class Description

Definition at line 87 of file qimage.h.

+ Inheritance diagram for QImage:

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 Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 

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 ()
 
QImageoperator= (const QImage &)
 
void swap (QImage &other)
 
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< QRgbcolorTable () const
 
void setColorTable (const QVector< QRgb > colors)
 
void fill (uint pixel)
 
void fill (const QColor &color)
 
void fill (Qt::GlobalColor color)
 
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
 
QPaintEnginepaintEngine () 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)
 
DataPtrdata_ptr ()
 
- Public Member Functions inherited from QPaintDevice
virtual ~QPaintDevice ()
 
bool paintingActive () const
 
int width () const
 
int height () const
 
int widthMM () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int colorCount () const
 
int depth () const
 

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
 
- Protected Member Functions inherited from QPaintDevice
 QPaintDevice ()
 

Friends

class QWSOnScreenSurface
 
class QRasterPixmapData
 
class QBlittablePixmapData
 
class QPixmapCacheEntry
 
Q_GUI_EXPORT qint64 qt_image_id (const QImage &image)
 
const QVector< QRgb > * qt_image_colortable (const QImage &image)
 

Additional Inherited Members

- Protected Attributes inherited from QPaintDevice
ushort painters
 

Member Typedef Documentation

typedef QImageData* DataPtr

Definition at line 345 of file qimage.h.

Member Enumeration Documentation

enum InvertMode
Enumerator
InvertRgb 
InvertRgba 

Definition at line 90 of file qimage.h.

enum Format
Enumerator
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 

Definition at line 91 of file qimage.h.

91  {
108 #if 0
109  // reserved for future use
110  Format_RGB15,
111  Format_Grayscale16,
112  Format_Grayscale8,
113  Format_Grayscale4,
114  Format_Grayscale4LSB,
115  Format_Grayscale2,
116  Format_Grayscale2LSB
117 #endif
118 #ifndef qdoc
120 #endif
121  };

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 )
void swap ( QImage other)
inline

Definition at line 147 of file qimage.h.

147 { qSwap(d, other.d); }
Q_INLINE_TEMPLATE void qSwap(QScopedPointer< T, Cleanup > &p1, QScopedPointer< T, Cleanup > &p2)
bool isNull ( ) const
int devType ( ) const
virtual

Reimplemented from QPaintDevice.

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
inline

Definition at line 160 of file qimage.h.

161  { return copy(QRect(x, y, w, h)); }
GLenum GLint GLint y
Definition: GLee.h:876
GLenum GLint x
Definition: GLee.h:876
QImage copy(const QRect &rect=QRect()) const
Definition: qrect.h:58
int int int int int int h
Definition: GLee.h:10534
GLubyte GLubyte GLubyte GLubyte w
Definition: GLee.h:1775
Format format ( ) const
QImage convertToFormat ( Format  f,
Qt::ImageConversionFlags  flags = Qt::AutoColor 
) const
QImage convertToFormat ( Format  f,
const QVector< QRgb > &  colorTable,
Qt::ImageConversionFlags  flags = Qt::AutoColor 
) const
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
Q_GUI_EXPORT_INLINE bool valid ( const QPoint pt) const

Definition at line 354 of file qimage.h.

354 { return valid(pt.x(), pt.y()); }
int y() const
Definition: qpoint.h:131
bool valid(int x, int y) const
int x() const
Definition: qpoint.h:128
int pixelIndex ( int  x,
int  y 
) const
Q_GUI_EXPORT_INLINE int pixelIndex ( const QPoint pt) const

Definition at line 355 of file qimage.h.

355 { return pixelIndex(pt.x(), pt.y());}
int y() const
Definition: qpoint.h:131
int pixelIndex(int x, int y) const
int x() const
Definition: qpoint.h:128
QRgb pixel ( int  x,
int  y 
) const
Q_GUI_EXPORT_INLINE QRgb pixel ( const QPoint pt) const

Definition at line 356 of file qimage.h.

356 { return pixel(pt.x(), pt.y()); }
QRgb pixel(int x, int y) const
int y() const
Definition: qpoint.h:131
int x() const
Definition: qpoint.h:128
void setPixel ( int  x,
int  y,
uint  index_or_rgb 
)
Q_GUI_EXPORT_INLINE void setPixel ( const QPoint pt,
uint  index_or_rgb 
)

Definition at line 357 of file qimage.h.

357 { setPixel(pt.x(), pt.y(), index_or_rgb); }
void setPixel(int x, int y, uint index_or_rgb)
int y() const
Definition: qpoint.h:131
int x() const
Definition: qpoint.h:128
QVector<QRgb> colorTable ( ) const
void setColorTable ( const QVector< QRgb colors)
void fill ( uint  pixel)
void fill ( const QColor color)
void fill ( Qt::GlobalColor  color)
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
inline

Definition at line 232 of file qimage.h.

234  { return scaled(QSize(w, h), aspectMode, mode); }
GLint mode
Definition: GLee.h:4479
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
Definition: qimage.h:232
int int int int int int h
Definition: GLee.h:10534
Definition: qsize.h:53
GLubyte GLubyte GLubyte GLubyte w
Definition: GLee.h:1775
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
static QMatrix trueMatrix ( const QMatrix ,
int  w,
int  h 
)
static
QImage transformed ( const QTransform matrix,
Qt::TransformationMode  mode = Qt::FastTransformation 
) const
static QTransform trueMatrix ( const QTransform ,
int  w,
int  h 
)
static
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 
)
inline

Definition at line 251 of file qimage.h.

252  { return loadFromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), aformat); }
const char * constData() const
Definition: qbytearray.h:433
bool loadFromData(const uchar *buf, int len, const char *format=0)
int size() const
Definition: qbytearray.h:402
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
static QImage fromData ( const uchar *  data,
int  size,
const char *  format = 0 
)
static
static QImage fromData ( const QByteArray data,
const char *  format = 0 
)
inlinestatic

Definition at line 258 of file qimage.h.

259  { return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); }
Format format() const
const char * constData() const
Definition: qbytearray.h:433
static QImage fromData(const uchar *data, int size, const char *format=0)
int size() const
Definition: qbytearray.h:402
int serialNumber ( ) const
qint64 cacheKey ( ) const
QPaintEngine* paintEngine ( ) const
virtual

Implements QPaintDevice.

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 
)
virtual int metric ( PaintDeviceMetric  metric) const
protectedvirtual

Reimplemented from QPaintDevice.

DataPtr& data_ptr ( )
inline

Definition at line 346 of file qimage.h.

346 { return d; }

Friends And Related Function Documentation

friend class QWSOnScreenSurface
friend

Definition at line 335 of file qimage.h.

friend class QRasterPixmapData
friend

Definition at line 338 of file qimage.h.

friend class QBlittablePixmapData
friend

Definition at line 339 of file qimage.h.

friend class QPixmapCacheEntry
friend

Definition at line 340 of file qimage.h.

Q_GUI_EXPORT qint64 qt_image_id ( const QImage image)
friend
const QVector<QRgb>* qt_image_colortable ( const QImage image)
friend

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