QImageIOHandler Class | Qt 4.8 (original) (raw)
The QImageIOHandler class defines the common image I/O interface for all image formats in Qt. More...
Member Function Documentation
QImageIOHandler::QImageIOHandler()
Constructs a QImageIOHandler object.
[virtual] QImageIOHandler::~QImageIOHandler()
Destructs the QImageIOHandler object.
[pure virtual] bool QImageIOHandler::canRead() const
Returns true if an image can be read from the device (i.e., the image format is supported, the device can be read from and the initial header information suggests that the image can be read); otherwise returns false.
When reimplementing canRead(), make sure that the I/O device (device()) is left in its original state (e.g., by using peek() rather than read()).
See also read() and QIODevice::peek().
[virtual] int QImageIOHandler::currentImageNumber() const
For image formats that support animation, this function returns the sequence number of the current image in the animation. If this function is called before any image is read(), -1 is returned. The number of the first image in the sequence is 0.
If the image format does not support animation, 0 is returned.
See also read().
[virtual] QRect QImageIOHandler::currentImageRect() const
Returns the rect of the current image. If no rect is defined for the image, and empty QRect() is returned.
This function is useful for animations, where only parts of the frame may be updated at a time.
QIODevice * QImageIOHandler::device() const
Returns the device currently assigned to the QImageIOHandler. If not device has been assigned, 0 is returned.
See also setDevice().
QByteArray QImageIOHandler::format() const
Returns the format that is currently assigned to QImageIOHandler. If no format has been assigned, an empty string is returned.
See also setFormat().
[virtual] int QImageIOHandler::imageCount() const
For image formats that support animation, this function returns the number of images in the animation. If the image format does not support animation, or if it is unable to determine the number of images, 0 is returned.
The default implementation returns 1 if canRead() returns true; otherwise 0 is returned.
[virtual] bool QImageIOHandler::jumpToImage(int imageNumber)
For image formats that support animation, this function jumps to the image whose sequence number is imageNumber. The next call to read() will attempt to read this image.
The default implementation does nothing, and returns false.
[virtual] bool QImageIOHandler::jumpToNextImage()
For image formats that support animation, this function jumps to the next image.
The default implementation does nothing, and returns false.
[virtual] int QImageIOHandler::loopCount() const
For image formats that support animation, this function returns the number of times the animation should loop. If the image format does not support animation, 0 is returned.
[virtual] int QImageIOHandler::nextImageDelay() const
For image formats that support animation, this function returns the number of milliseconds to wait until reading the next image. If the image format does not support animation, 0 is returned.
[virtual] QVariant QImageIOHandler::option(ImageOption option) const
Returns the value assigned to option as a QVariant. The type of the value depends on the option. For example, option(Size) returns a QSize variant.
See also setOption() and supportsOption().
[pure virtual] bool QImageIOHandler::read(QImage * image)
Read an image from the device, and stores it in image. Returns true if the image is successfully read; otherwise returns false.
For image formats that support incremental loading, and for animation formats, the image handler can assume that image points to the previous frame.
See also canRead().
void QImageIOHandler::setDevice(QIODevice * device)
Sets the device of the QImageIOHandler to device. The image handler will use this device when reading and writing images.
The device can only be set once and must be set before calling canRead(), read(), write(), etc. If you need to read multiple files, construct multiple instances of the appropriate QImageIOHandler subclass.
See also device().
void QImageIOHandler::setFormat(const QByteArray & format)
Sets the format of the QImageIOHandler to format. The format is most useful for handlers that support multiple image formats.
See also format().
void QImageIOHandler::setFormat(const QByteArray & format) const
Sets the format of the QImageIOHandler to format. The format is most useful for handlers that support multiple image formats.
This function is declared const so that it can be called from canRead().
See also format().
[virtual] void QImageIOHandler::setOption(ImageOption option, const QVariant & value)
Sets the option option with the value value.
See also option() and ImageOption.
[virtual] bool QImageIOHandler::supportsOption(ImageOption option) const
Returns true if the QImageIOHandler supports the option option; otherwise returns false. For example, if the QImageIOHandler supports the Size option, supportsOption(Size) must return true.
See also setOption() and option().
[virtual] bool QImageIOHandler::write(const QImage & image)
Writes the image image to the assigned device. Returns true on success; otherwise returns false.
The default implementation does nothing, and simply returns false.