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

QImageWriter Class Reference

List of all members.

Detailed Description

The QImageWriter class provides a format independent interface for writing images to files or other devices.

QImageWriter supports setting format specific options, such as the gamma level, compression level and quality, prior to storing the image. If you do not need such options, you can use QImage::save() or QPixmap::save() instead.

To store an image, you start by constructing a QImageWriter object. Pass either a file name or a device pointer, and the image format to QImageWriter's constructor. You can then set several options, such as the gamma level (by calling setGamma()) and quality (by calling setQuality()). canWrite() returns true if QImageWriter can write the image (i.e., the image format is supported and the device is open for writing). Call write() to write the image to the device.

If any error occurs when writing the image, write() will return false. You can then call error() to find the type of error that occurred, or errorString() to get a human readable description of what went wrong.

Call supportedImageFormats() for a list of formats that QImageWriter can write. QImageWriter supports all built-in image formats, in addition to any image format plugins that support writing.

See also:
QImageReader, QImageIOHandler, QImageIOPlugin

Definition at line 54 of file qimagewriter.h.

Public Types

enum  ImageWriterError { UnknownError, DeviceError, UnsupportedFormatError }

Public Member Functions

bool canWrite () const
int compression () const
QString description () const
QIODevicedevice () const
ImageWriterError error () const
QString errorString () const
QString fileName () const
QByteArray format () const
float gamma () const
 QImageWriter (const QString &fileName, const QByteArray &format=QByteArray())
 QImageWriter (QIODevice *device, const QByteArray &format)
 QImageWriter ()
int quality () const
void setCompression (int compression)
void setDescription (const QString &description)
void setDevice (QIODevice *device)
void setFileName (const QString &fileName)
void setFormat (const QByteArray &format)
void setGamma (float gamma)
void setQuality (int quality)
void setText (const QString &key, const QString &text)
bool supportsOption (QImageIOHandler::ImageOption option) const
bool write (const QImage &image)
 ~QImageWriter ()

Static Public Member Functions

static QList< QByteArraysupportedImageFormats ()

Private Attributes

QImageWriterPrivate * d

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

Generated by  Doxygen 1.6.0   Back to index