Image Formats NG
|
Basic Image unput/output. More...
Public Member Functions | |
ImageIO () | |
Creates an ImageIO object. | |
ImageIO (const QString &fileName, const QMimeType &mimeType=QMimeType()) | |
Creates an ImageIO object with the given fileName and mimeType. | |
ImageIO (QIODevice *device, const QMimeType &mimeType=QMimeType()) | |
Creates an ImageIO object with the given device and mimeType. | |
ImageIO (const QString &fileName, const QString &mimeType) | |
Creates an ImageIO object with the given fileName and mimeType. | |
ImageIO (QIODevice *device, const QString &mimeType) | |
Creates an ImageIO object with the given device and mimeType. | |
~ImageIO () | |
Destroys ImageIO object. | |
QString | fileName () const |
This property holds the filename that is set to this ImageIO object. | |
QIODevice * | device () const |
This property holds the device that is set to this ImageIO object. | |
QMimeType | mimeType () const |
This property holds the mime type that is set to this ImageIO object. More... | |
QByteArray | subType () const |
This property holds the sub type that is set to this ImageIO object. More... | |
std::pair< ImageIOResult, ImageHeader > | readHeader () |
Reads the header of an image. More... | |
std::pair< ImageIOResult, ImageContents > | readContents (const ImageHeader &header, const ImageOptions &options=ImageOptions()) |
Reads the contents of an image. More... | |
std::pair< ImageIOResult, ImageContents > | read (const ImageOptions &options=ImageOptions()) |
Reads both header and contents of an image. More... | |
ImageIOResult | write (const ImageContents &contents, const ImageOptions &options=ImageOptions()) |
Writes the given contents with the given options to the device. More... | |
bool | supportsOption (ImageOptions::Option option, const QByteArray &subType=QByteArray()) const |
Returns true if current format supports the given option for the given subType, otherwise returns false. More... | |
Static Public Member Functions | |
static QVector< ImageFormatInfo > | supportedImageFormats (ImageFormatInfo::Capabilities caps=ImageFormatInfo::ReadWrite) |
Returns the list of supported image format for the given caps. | |
static Optional< ImageFormatInfo > | imageFormat (const QMimeType &mimeType) |
Returns information about format with the given mimeType. | |
static Optional< ImageFormatInfo > | imageFormat (const QString &mimeTypeName) |
Returns information about format with the given mimeTypeName. | |
Basic Image unput/output.
This class is used for a customised image reading/writing.
QMimeType ImageIO::mimeType | ( | ) | const |
This property holds the mime type that is set to this ImageIO object.
If no mime type is set, it is automatically determined from the device contents before reading.
std::pair< ImageIOResult, ImageContents > ImageIO::read | ( | const ImageOptions & | options = ImageOptions() | ) |
Reads both header and contents of an image.
Returns the status of the operation as an ImageIOResult. Empty ImageContents is returned in case of an error.
This is the easiest way to read an image. This can be done as following:
Reading can be customised by passing ImageOptions:
std::pair< ImageIOResult, ImageContents > ImageIO::readContents | ( | const ImageHeader & | header, |
const ImageOptions & | options = ImageOptions() |
||
) |
Reads the contents of an image.
This method should be called after readHeader(). If you don't need to read image header and contents separately, use read() instead.
Returns the status of the operation as an ImageIOResult. Empty ImageContents is returned in case of an error.
std::pair< ImageIOResult, ImageHeader > ImageIO::readHeader | ( | ) |
Reads the header of an image.
This method can be used to determine common imaпe meta information (size, image format, etc) without reading image data itself.
Returns the status of the operation as an ImageIOResult. Empty ImageHeader is returned in case of an error.
After reading header, you should call readContents() function to retreive actual image data.
Typical usage is following:
QByteArray ImageIO::subType | ( | ) | const |
This property holds the sub type that is set to this ImageIO object.
Sub type is used for writing to configure the type of the resulting image file.
bool ImageIO::supportsOption | ( | ImageOptions::Option | option, |
const QByteArray & | subType = QByteArray() |
||
) | const |
Returns true if current format supports the given option for the given subType, otherwise returns false.
Current format is the format specified by the ImageIO::mimeType.
ImageIOResult ImageIO::write | ( | const ImageContents & | contents, |
const ImageOptions & | options = ImageOptions() |
||
) |
Writes the given contents with the given options to the device.
Returns the status of the operation.