The QImageIO class contains parameters for loading and saving images. More...
#include <qimage.h>
QImageIO contains a QIODevice object that is used for image data I/O. The programmer can install new image file formats in addition to those that Qt implements.
Qt currently supports the following image file formats: BMP, XBM and PNM. The different PNM formats are: PBM (P1), PGM (P2), PPM (P3), PBMRAW (P4), PGMRAW (P5) and PPMRAW (P6).
You will normally not need to use this class, QPixmap::load(), QPixmap::save() and QImage contain most of the needed functionality.
See also: QImage, QPixmap and QFile.
Bugs and limitations:
Constructs a QImageIO object with an I/O device and a format tag.
Constructs a QImageIO object with a file name and a format tag.
Constructs a QImageIO object with all parameters set to zero.
Destroys the object an all related data.
[static]
Defines a image IO handler for a specified image format. An image IO handler is responsible for reading and writing images.
Arguments:
Example:
void readGIF( QImageIO *image ) { // read the image, using the image->ioDevice() } void writeGIF( QImageIO *image ) { // write the image, using the image->ioDevice() } // add the GIF image handler QImageIO::defineIOHandler( "GIF", "^GIF[0-9][0-9][a-z]", 0, read_gif_image, write_gif_image );
Returns the image description string.
See also: setDescription().
Returns the file name currently set.
See also: setFileName().
Returns the image format string, or 0 if no format has been set.
Returns the image currently set.
See also: setImage().
[static]
Returns a string that specifies the image format of the image read from d, or null if the file cannot be read or if the format is not recognized.
[static]
Returns a string that specifies the image format of the file fileName, or null if the file cannot not be read or if the format is not recognized.
Returns the IO device currently set.
See also: setIODevice().
Returns image parameters string.
See also: setParameters().
Reads an image into memory and returns TRUE if the image was successfully read.
Before reading an image, you must set an IO device or a file name. If both an IO device and a file name has been set, then the IO device will be used.
Setting the image file format string is optional.
Example:
QImageIO iio; QPixmap pixmap; iio.setFileName( "burger.bmp" ); if ( image.read() ) // ok pixmap = iio.image(); // convert to pixmap
See also: setIODevice(), setFileName(), setFormat(), write() and QPixmap::load().
Sets the image description string for image handlers that support image descriptions.
Currently, no image format supported by Qt use the description string.
Sets the name of the file to read or write an image.
See also: setIODevice().
Sets the image format name of the image about to be read or written.
It is necessary to specify a format before writing an image.
It is not necessary to specify a format before reading an image. If not format has been set, Qt guesses the image format before reading it. If a format is set, but the image has another (valid) format, the image will not be read.
See also: read(), write() and format().
Sets the IO device to be used for reading or writing an image.
Setting the IO device allows images to be read/written to any block-oriented QIODevice.
If ioDevice is not null, this IO device will override file name settings.
See also: setFileName().
Sets the image.
See also: image().
Sets the image parameters string for image handlers that require special parameters.
Although all image formats supported by Qt ignore the parameters string, it will be useful for future extentions or contributions (like JPEG).
Sets the image IO status. A non-zero value indicates an error, while 0 means that the IO operation was successful.
See also: status().
Returns the image IO status. A non-zero value indicates an error, while 0 means that the IO operation was successful.
See also: setStatus().
Writes an image to an IO device and returns TRUE if the image was successfully written.
Before writing an image, you must set an IO device or a file name. If both an IO device and a file name has been set, then the IO device will be used.
The image will be written using the specified image format.
Example:
QImageIO iio; QImage im; im = pixmap; // convert to image iio.setImage( im ); iio.setFileName( "burger.bmp" ); iio.setFormat( "BMP" ); iio.write(); // TRUE if ok
See also: setIODevice(), setFileName(), setFormat(), read() and QPixmap::save().
This file is part of the Qt toolkit, copyright © 1995-96 Troll Tech, all rights reserved.
It was generated from the following files: