QImageReader Class Reference |
Constant | Value | Description |
---|---|---|
QImageReader::FileNotFoundError | 1 | QImageReader was used with a file name, but not file was found with that name. This can also happen if the file name contained no extension, and the file with the correct extension is not supported by Qt. |
QImageReader::DeviceError | 2 | QImageReader encountered a device error when reading the image. You can consult your particular device for more details on what went wrong. |
QImageReader::UnsupportedFormatError | 3 | Qt does not support the requested image format. |
QImageReader::InvalidDataError | 4 | The image data was invalid, and QImageReader was unable to read an image from it. The can happen if the image file is damaged. |
QImageReader::UnknownError | 0 | An unknown error occurred. If you get this value after calling read(), it is most likely caused by a bug in QImageReader. |
Constructs an empty QImageReader object. Before reading an image, call setDevice() or setFileName().
Constructs a QImageReader object with the device device and the image format format.
Constructs a QImageReader object with the file name fileName and the image format format.
See also setFileName().
Destructs the QImageReader object.
Returns the background color that's used when reading an image. If the image format does not support setting the background color an invalid color is returned.
This function was introduced in Qt 4.1.
See also setBackgroundColor() and read().
Returns true if an image can be read for the device (i.e., the image format is supported, and the device seems to contain valid data); otherwise returns false.
canRead() is a lightweight function that only does a quick test to see if the image data is valid. read() may still return false after canRead() returns true, if the image data is corrupt.
For images that support animation, canRead() returns false when all frames have been read.
See also read() and supportedImageFormats().
Returns the clip rect (also known as the ROI, or Region Of Interest) of the image. If no clip rect has been set, an invalid QRect is returned.
See also setClipRect().
For image formats that support animation, this function returns the sequence number of the current frame. Otherwise, -1 is returned.
See also supportsAnimation() and QImageIOHandler::currentImageNumber().
For image formats that support animation, this function returns the rect for the current frame. Otherwise, a null rect is returned.
See also supportsAnimation() and QImageIOHandler::currentImageRect().
Returns the device currently assigned to QImageReader, or 0 if no device has been assigned.
See also setDevice().
Returns the type of error that occurred last.
See also ImageReaderError and errorString().
Returns a human readable description of the last error that occurred.
See also error().
If the currently assigned device is a QFile, or if setFileName() has been called, this function returns the name of the file QImageReader reads from. Otherwise (i.e., if no device has been assigned or the device is not a QFile), an empty QString is returned.
See also setFileName() and setDevice().
Returns the format QImageReader uses for reading images.
See also setFormat().
For image formats that support animation, this function returns the total number of images in the animation.
Certain animation formats do not support this feature, in which case 0 is returned.
See also supportsAnimation() and QImageIOHandler::imageCount().
If supported, this function returns the image format of the file fileName. Otherwise, an empty string is returned.
This is an overloaded member function, provided for convenience.
If supported, this function returns the image format of the device device. Otherwise, an empty string is returned.
For image formats that support animation, this function skips to the image whose sequence number is imageNumber. The next call to read() will attempt to read this image.
See also jumpToNextImage() and QImageIOHandler::jumpToImage().
For image formats that support animation, this function steps over the current image.
The default implementation calls read(), and then discards the resulting image, but the image handler may have a more efficient way of implementing this operation.
See also jumpToImage() and QImageIOHandler::jumpToNextImage().
For image formats that support animation, this function returns the number of times the animation should loop. Otherwise, it returns -1.
See also supportsAnimation() and QImageIOHandler::loopCount().
For image formats that support animation, this function returns the number of milliseconds to wait until displaying the next frame in the animation. Otherwise, 0 is returned.
See also supportsAnimation() and QImageIOHandler::nextImageDelay().
Reads an image from the device. On success, the image that was read is returned; otherwise, a null QImage is returned. You can then call error() to find the type of error that occurred, or errorString() to get a human readable description of the error.
For image formats that support animation, calling read() repeatedly will return the next frame. When all frames have been read, a null image will be returned.
See also canRead(), supportedImageFormats(), supportsAnimation(), and QMovie.
Returns the scaled clip rect of the image.
See also setScaledClipRect().
Returns the scaled size of the image.
See also setScaledSize().
Sets the background color to color. Image formats that support this operation are expected to initialize the background to color before reading an image.
This function was introduced in Qt 4.1.
See also backgroundColor() and read().
Sets the image clip rect (also known as the ROI, or Region Of Interest) to rect. The coordinates of rect are relative to the untransformed image size, as returned by size().
See also clipRect(), setScaledSize(), and setScaledClipRect().
Sets QImageReader's device to device. If a device has already been set, the old device is removed from QImageReader and is otherwise left unchanged.
If the device is not already open, QImageReader will attempt to open the device in QIODevice::ReadOnly mode by calling open(). Note that this does not work for certain devices, such as QProcess, QTcpSocket and QUdpSocket, where more logic is required to open the device.
See also device() and setFileName().
Sets the file name of QImageReader to fileName. Internally, QImageReader will create a QFile object and open it in QIODevice::ReadOnly mode, and use this when reading images.
If fileName does not include a file extension (e.g., .png or .bmp), QImageReader will cycle through all supported extensions until it finds a matching file.
See also fileName(), setDevice(), and supportedImageFormats().
Sets the format QImageReader will use when reading images, to format. format is a case insensitive text string. Example:
QImageReader reader; reader.setFormat("png"); // same as reader.setFormat("PNG");
You can call supportedImageFormats() for the full list of formats QImageReader supports.
See also format().
Sets the scaled clip rect to rect. The scaled clip rect is the clip rect (also known as ROI, or Region Of Interest) that is applied after the image has been scaled.
See also scaledClipRect() and setScaledSize().
Sets the scaled size of the image to size. The scaling is performed after the initial clip rect, but before the scaled clip rect is applied. The algorithm used for scaling depends on the image format. By default (i.e., if the image format does not support scaling), QImageReader will use QImage::scale() with Qt::SmoothScaling.
See also scaledSize(), setClipRect(), and setScaledClipRect().
Returns the size of the image. This function may or may not read the entire image, depending on whether the image format supports checking the size of an image before loading it.
Returns the list of image formats supported by QImageReader.
By default, Qt can read the following formats:
Format | Description |
---|---|
BMP | Windows Bitmap |
GIF | Graphic Interchange Format (optional) |
JPG | Joint Photographic Experts Group |
JPEG | Joint Photographic Experts Group |
MNG | Multiple-image Network Graphics |
PNG | Portable Network Graphics |
PBM | Portable Bitmap |
PGM | Portable Graymap |
PPM | Portable Pixmap |
XBM | X11 Bitmap |
XPM | X11 Pixmap |
To configure Qt with GIF support, pass -qt-gif to the configure script or check the appropriate option in the graphical installer.
See also setFormat(), QImageWriter::supportedImageFormats(), and QImageIOPlugin.
Returns true if the image format supports animation; otherwise, false is returned.
This function was introduced in Qt 4.1.
See also QMovie::supportedFormats().
Returns the image text associated with key.
Support for this option is implemented through QImageIOHandler::Description.
This function was introduced in Qt 4.1.
See also textKeys() and QImageWriter::setText().
Returns the text keys for this image. You can use these keys with text() to list the image text for a certain key.
Support for this option is implemented through QImageIOHandler::Description.
This function was introduced in Qt 4.1.
See also text(), QImageWriter::setText(), and QImage::textKeys().
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.1 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com