Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QImageIOHandler Class Reference

Inherited by QBmpHandler, QGifHandler, QJpegHandler, QMngHandler, QPngHandler, QPpmHandler, QSvgIOHandler, QXbmHandler, and QXpmHandler.

List of all members.

Detailed Description

The QImageIOHandler class defines the common image I/O interface for all image formats in Qt.

Qt uses QImageIOHandler for reading and writing images through QImageReader and QImageWriter. You can also derive from this class to write your own image format handler using Qt's plugin mechanism.

Call setDevice() to assign a device to the handler, and setFormat() to assign a format to it. One QImageIOHandler may support more than one image format. canRead() returns true if an image can be read from the device, and read() and write() return true if reading or writing an image was completed successfully.

QImageIOHandler also has support for animations formats, through the functions loopCount(), imageCount(), nextImageDelay() and currentImageNumber().

In order to determine what options an image handler supports, Qt will call supportsOption() and setOption(). Make sure to reimplement these functions if you can provide support for any of the options in the ImageOption enum.

To write your own image handler, you must at least reimplement canRead() and read(). Then create a QImageIOPlugin that can create the handler. Finally, install your plugin, and QImageReader and QImageWriter will then automatically load the plugin, and start using it.

See also:
QImageIOPlugin, QImageReader, QImageWriter

Definition at line 40 of file qimageiohandler.h.

Public Types

enum  ImageOption {
  Size, ClipRect, Description, ScaledClipRect,
  ScaledSize, CompressionRatio, Gamma, Quality,
  Name, SubType, IncrementalReading, Endianness,
  Animation, BackgroundColor

Public Member Functions

virtual bool canRead () const =0
virtual int currentImageNumber () const
virtual QRect currentImageRect () const
QIODevicedevice () const
QByteArray format () const
virtual int imageCount () const
virtual bool jumpToImage (int imageNumber)
virtual bool jumpToNextImage ()
virtual int loopCount () const
virtual QByteArray name () const
virtual int nextImageDelay () const
virtual QVariant option (ImageOption option) const
 QImageIOHandler ()
virtual bool read (QImage *image)=0
void setDevice (QIODevice *device)
void setFormat (const QByteArray &format) const
void setFormat (const QByteArray &format)
virtual void setOption (ImageOption option, const QVariant &value)
virtual bool supportsOption (ImageOption option) const
virtual bool write (const QImage &image)
virtual ~QImageIOHandler ()

Protected Member Functions

 QImageIOHandler (QImageIOHandlerPrivate &dd)

Protected Attributes

QImageIOHandlerPrivate * d_ptr

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

Generated by  Doxygen 1.6.0   Back to index