[][src]Struct qt_gui::QImageReader

#[repr(C)]pub struct QImageReader { /* fields omitted */ }

The QImageReader class provides a format independent interface for reading images from files or other devices.

C++ class: QImageReader.

C++ documentation:

The QImageReader class provides a format independent interface for reading images from files or other devices.

The most common way to read images is through QImage and QPixmap's constructors, or by calling QImage::load() and QPixmap::load(). QImageReader is a specialized class which gives you more control when reading images. For example, you can read an image into a specific size by calling setScaledSize(), and you can select a clip rect, effectively loading only parts of an image, by calling setClipRect(). Depending on the underlying support in the image format, this can save memory and speed up loading of images.

To read an image, you start by constructing a QImageReader object. Pass either a file name or a device pointer, and the image format to QImageReader's constructor. You can then set several options, such as the clip rect (by calling setClipRect()) and scaled size (by calling setScaledSize()). canRead() returns the image if the QImageReader can read the image (i.e., the image format is supported and the device is open for reading). Call read() to read the image.

If any error occurs when reading the image, read() will return a null QImage. 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.

Note: QImageReader assumes exclusive control over the file or device that is assigned. Any attempts to modify the assigned file or device during the lifetime of the QImageReader object will yield undefined results.

Methods

impl QImageReader[src]

pub unsafe fn auto_detect_image_format(&self) -> bool[src]

Returns true if image format autodetection is enabled on this image reader; otherwise returns false. By default, autodetection is enabled.

Calls C++ function: bool QImageReader::autoDetectImageFormat() const.

C++ documentation:

Returns true if image format autodetection is enabled on this image reader; otherwise returns false. By default, autodetection is enabled.

See also setAutoDetectImageFormat().

pub unsafe fn auto_transform(&self) -> bool[src]

Returns true if the image handler will apply transformation metadata on read().

Calls C++ function: bool QImageReader::autoTransform() const.

C++ documentation:

Returns true if the image handler will apply transformation metadata on read().

This function was introduced in Qt 5.5.

See also setAutoTransform(), transformation(), and read().

pub unsafe fn background_color(&self) -> CppBox<QColor>[src]

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.

Calls C++ function: QColor QImageReader::backgroundColor() const.

C++ documentation:

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().

pub unsafe fn can_read(&self) -> bool[src]

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.

Calls C++ function: bool QImageReader::canRead() const.

C++ documentation:

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.

Note: A QMimeDatabase lookup is normally a better approach than this function for identifying potentially non-image files or data.

For images that support animation, canRead() returns false when all frames have been read.

See also read(), supportedImageFormats(), and QMimeDatabase.

pub unsafe fn clip_rect(&self) -> CppBox<QRect>[src]

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.

Calls C++ function: QRect QImageReader::clipRect() const.

C++ documentation:

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().

pub unsafe fn current_image_number(&self) -> c_int[src]

For image formats that support animation, this function returns the sequence number of the current frame. If the image format doesn't support animation, 0 is returned.

Calls C++ function: int QImageReader::currentImageNumber() const.

C++ documentation:

For image formats that support animation, this function returns the sequence number of the current frame. If the image format doesn't support animation, 0 is returned.

This function returns -1 if an error occurred.

See also supportsAnimation(), QImageIOHandler::currentImageNumber(), and canRead().

pub unsafe fn current_image_rect(&self) -> CppBox<QRect>[src]

For image formats that support animation, this function returns the rect for the current frame. Otherwise, a null rect is returned.

Calls C++ function: QRect QImageReader::currentImageRect() const.

C++ documentation:

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().

pub unsafe fn decide_format_from_content(&self) -> bool[src]

Returns whether the image reader should decide which plugin to use only based on the contents of the datastream rather than on the file extension.

Calls C++ function: bool QImageReader::decideFormatFromContent() const.

C++ documentation:

Returns whether the image reader should decide which plugin to use only based on the contents of the datastream rather than on the file extension.

See also setDecideFormatFromContent().

pub unsafe fn device(&self) -> QPtr<QIODevice>[src]

Returns the device currently assigned to QImageReader, or 0 if no device has been assigned.

Calls C++ function: QIODevice* QImageReader::device() const.

C++ documentation:

Returns the device currently assigned to QImageReader, or 0 if no device has been assigned.

See also setDevice().

pub unsafe fn error(&self) -> ImageReaderError[src]

Returns the type of error that occurred last.

Calls C++ function: QImageReader::ImageReaderError QImageReader::error() const.

C++ documentation:

Returns the type of error that occurred last.

See also ImageReaderError and errorString().

pub unsafe fn error_string(&self) -> CppBox<QString>[src]

Returns a human readable description of the last error that occurred.

Calls C++ function: QString QImageReader::errorString() const.

C++ documentation:

Returns a human readable description of the last error that occurred.

See also error().

pub unsafe fn file_name(&self) -> CppBox<QString>[src]

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.

Calls C++ function: QString QImageReader::fileName() const.

C++ documentation:

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().

pub unsafe fn format(&self) -> CppBox<QByteArray>[src]

Returns the format QImageReader uses for reading images.

Calls C++ function: QByteArray QImageReader::format() const.

C++ documentation:

Returns the format QImageReader uses for reading images.

You can call this function after assigning a device to the reader to determine the format of the device. For example:

QImageReader reader("image.png"); // reader.format() == "png"

If the reader cannot read any image from the device (e.g., there is no image there, or the image has already been read), or if the format is unsupported, this function returns an empty QByteArray().

See also setFormat() and supportedImageFormats().

pub unsafe fn gamma(&self) -> c_float[src]

Returns the gamma level of the decoded image. If setGamma() has been called and gamma correction is supported it will return the gamma set. If gamma level is not supported by the image format, 0.0 is returned.

Calls C++ function: float QImageReader::gamma() const.

C++ documentation:

Returns the gamma level of the decoded image. If setGamma() has been called and gamma correction is supported it will return the gamma set. If gamma level is not supported by the image format, 0.0 is returned.

This function was introduced in Qt 5.6.

See also setGamma().

pub unsafe fn image_count(&self) -> c_int[src]

For image formats that support animation, this function returns the total number of images in the animation. If the format does not support animation, 0 is returned.

Calls C++ function: int QImageReader::imageCount() const.

C++ documentation:

For image formats that support animation, this function returns the total number of images in the animation. If the format does not support animation, 0 is returned.

This function returns -1 if an error occurred.

See also supportsAnimation(), QImageIOHandler::imageCount(), and canRead().

pub unsafe fn image_format(&self) -> Format[src]

Returns the format of the image, without actually reading the image contents. The format describes the image format QImageReader::read() returns, not the format of the actual image.

Calls C++ function: QImage::Format QImageReader::imageFormat() const.

C++ documentation:

Returns the format of the image, without actually reading the image contents. The format describes the image format QImageReader::read() returns, not the format of the actual image.

If the image format does not support this feature, this function returns an invalid format.

This function was introduced in Qt 4.5.

See also QImageIOHandler::ImageOption, QImageIOHandler::option(), and QImageIOHandler::supportsOption().

pub unsafe fn image_format_q_string(
    file_name: impl CastInto<Ref<QString>>
) -> CppBox<QByteArray>
[src]

If supported, this function returns the image format of the file fileName. Otherwise, an empty string is returned.

Calls C++ function: static QByteArray QImageReader::imageFormat(const QString& fileName).

C++ documentation:

If supported, this function returns the image format of the file fileName. Otherwise, an empty string is returned.

pub unsafe fn image_format_q_io_device(
    device: impl CastInto<Ptr<QIODevice>>
) -> CppBox<QByteArray>
[src]

If supported, this function returns the image format of the device device. Otherwise, an empty string is returned.

Calls C++ function: static QByteArray QImageReader::imageFormat(QIODevice* device).

C++ documentation:

If supported, this function returns the image format of the device device. Otherwise, an empty string is returned.

See also QImageReader::autoDetectImageFormat().

pub unsafe fn image_formats_for_mime_type(
    mime_type: impl CastInto<Ref<QByteArray>>
) -> CppBox<QListOfQByteArray>
[src]

This is supported on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the list of image formats corresponding to mimeType.

Calls C++ function: static QList<QByteArray> QImageReader::imageFormatsForMimeType(const QByteArray& mimeType).

C++ documentation:

Returns the list of image formats corresponding to mimeType.

Note that the QGuiApplication instance must be created before this function is called.

This function was introduced in Qt 5.12.

See also supportedImageFormats() and supportedMimeTypes().

pub unsafe fn jump_to_image(&self, image_number: c_int) -> bool[src]

For image formats that support animation, this function skips to the image whose sequence number is imageNumber, returning true if successful or false if the corresponding image cannot be found.

Calls C++ function: bool QImageReader::jumpToImage(int imageNumber).

C++ documentation:

For image formats that support animation, this function skips to the image whose sequence number is imageNumber, returning true if successful or false if the corresponding image cannot be found.

The next call to read() will attempt to read this image.

See also jumpToNextImage() and QImageIOHandler::jumpToImage().

pub unsafe fn jump_to_next_image(&self) -> bool[src]

For image formats that support animation, this function steps over the current image, returning true if successful or false if there is no following image in the animation.

Calls C++ function: bool QImageReader::jumpToNextImage().

C++ documentation:

For image formats that support animation, this function steps over the current image, returning true if successful or false if there is no following image in the animation.

The default implementation calls read(), 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().

pub unsafe fn loop_count(&self) -> c_int[src]

For image formats that support animation, this function returns the number of times the animation should loop. If this function returns -1, it can either mean the animation should loop forever, or that an error occurred. If an error occurred, canRead() will return false.

Calls C++ function: int QImageReader::loopCount() const.

C++ documentation:

For image formats that support animation, this function returns the number of times the animation should loop. If this function returns -1, it can either mean the animation should loop forever, or that an error occurred. If an error occurred, canRead() will return false.

See also supportsAnimation(), QImageIOHandler::loopCount(), and canRead().

pub unsafe fn new() -> CppBox<QImageReader>[src]

Constructs an empty QImageReader object. Before reading an image, call setDevice() or setFileName().

Calls C++ function: [constructor] void QImageReader::QImageReader().

C++ documentation:

Constructs an empty QImageReader object. Before reading an image, call setDevice() or setFileName().

pub unsafe fn from_q_io_device_q_byte_array(
    device: impl CastInto<Ptr<QIODevice>>,
    format: impl CastInto<Ref<QByteArray>>
) -> CppBox<QImageReader>
[src]

Constructs a QImageReader object with the device device and the image format format.

Calls C++ function: [constructor] void QImageReader::QImageReader(QIODevice* device, const QByteArray& format = …).

C++ documentation:

Constructs a QImageReader object with the device device and the image format format.

pub unsafe fn from_q_string_q_byte_array(
    file_name: impl CastInto<Ref<QString>>,
    format: impl CastInto<Ref<QByteArray>>
) -> CppBox<QImageReader>
[src]

Constructs a QImageReader object with the file name fileName and the image format format.

Calls C++ function: [constructor] void QImageReader::QImageReader(const QString& fileName, const QByteArray& format = …).

C++ documentation:

Constructs a QImageReader object with the file name fileName and the image format format.

See also setFileName().

pub unsafe fn from_q_io_device(
    device: impl CastInto<Ptr<QIODevice>>
) -> CppBox<QImageReader>
[src]

Constructs a QImageReader object with the device device and the image format format.

Calls C++ function: [constructor] void QImageReader::QImageReader(QIODevice* device).

C++ documentation:

Constructs a QImageReader object with the device device and the image format format.

pub unsafe fn from_q_string(
    file_name: impl CastInto<Ref<QString>>
) -> CppBox<QImageReader>
[src]

Constructs a QImageReader object with the file name fileName and the image format format.

Calls C++ function: [constructor] void QImageReader::QImageReader(const QString& fileName).

C++ documentation:

Constructs a QImageReader object with the file name fileName and the image format format.

See also setFileName().

pub unsafe fn next_image_delay(&self) -> c_int[src]

For image formats that support animation, this function returns the number of milliseconds to wait until displaying the next frame in the animation. If the image format doesn't support animation, 0 is returned.

Calls C++ function: int QImageReader::nextImageDelay() const.

C++ documentation:

For image formats that support animation, this function returns the number of milliseconds to wait until displaying the next frame in the animation. If the image format doesn't support animation, 0 is returned.

This function returns -1 if an error occurred.

See also supportsAnimation(), QImageIOHandler::nextImageDelay(), and canRead().

pub unsafe fn quality(&self) -> c_int[src]

Returns the quality setting of the image format.

Calls C++ function: int QImageReader::quality() const.

C++ documentation:

Returns the quality setting of the image format.

This function was introduced in Qt 4.2.

See also setQuality().

pub unsafe fn read_0a(&self) -> CppBox<QImage>[src]

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.

Calls C++ function: QImage QImageReader::read().

C++ documentation:

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.

pub unsafe fn read_1a(&self, image: impl CastInto<Ptr<QImage>>) -> bool[src]

This is an overloaded function.

Calls C++ function: bool QImageReader::read(QImage* image).

C++ documentation:

This is an overloaded function.

Reads an image from the device into image, which must point to a QImage. Returns true on success; otherwise, returns false.

If image has same format and size as the image data that is about to be read, this function may not need to allocate a new image before reading. Because of this, it can be faster than the other read() overload, which always constructs a new image; especially when reading several images with the same format and size.

QImage icon(64, 64, QImage::Format_RGB32); QImageReader reader("icon_64x64.bmp"); if (reader.read(&icon)) { // Display icon }

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.

pub unsafe fn scaled_clip_rect(&self) -> CppBox<QRect>[src]

Returns the scaled clip rect of the image.

Calls C++ function: QRect QImageReader::scaledClipRect() const.

C++ documentation:

Returns the scaled clip rect of the image.

See also setScaledClipRect().

pub unsafe fn scaled_size(&self) -> CppBox<QSize>[src]

Returns the scaled size of the image.

Calls C++ function: QSize QImageReader::scaledSize() const.

C++ documentation:

Returns the scaled size of the image.

See also setScaledSize().

pub unsafe fn set_auto_detect_image_format(&self, enabled: bool)[src]

If enabled is true, image format autodetection is enabled; otherwise, it is disabled. By default, autodetection is enabled.

Calls C++ function: void QImageReader::setAutoDetectImageFormat(bool enabled).

C++ documentation:

If enabled is true, image format autodetection is enabled; otherwise, it is disabled. By default, autodetection is enabled.

QImageReader uses an extensive approach to detecting the image format; firstly, if you pass a file name to QImageReader, it will attempt to detect the file extension if the given file name does not point to an existing file, by appending supported default extensions to the given file name, one at a time. It then uses the following approach to detect the image format:

  • Image plugins are queried first, based on either the optional format string, or the file name suffix (if the source device is a file). No content detection is done at this stage. QImageReader will choose the first plugin that supports reading for this format.
  • If no plugin supports the image format, Qt's built-in handlers are checked based on either the optional format string, or the file name suffix.
  • If no capable plugins or built-in handlers are found, each plugin is tested by inspecting the content of the data stream.
  • If no plugins could detect the image format based on data contents, each built-in image handler is tested by inspecting the contents.
  • Finally, if all above approaches fail, QImageReader will report failure when trying to read the image.

By disabling image format autodetection, QImageReader will only query the plugins and built-in handlers based on the format string (i.e., no file name extensions are tested).

See also autoDetectImageFormat(), QImageIOHandler::canRead(), and QImageIOPlugin::capabilities().

pub unsafe fn set_auto_transform(&self, enabled: bool)[src]

Determines that images returned by read() should have transformation metadata automatically applied if enabled is true.

Calls C++ function: void QImageReader::setAutoTransform(bool enabled).

C++ documentation:

Determines that images returned by read() should have transformation metadata automatically applied if enabled is true.

This function was introduced in Qt 5.5.

See also autoTransform(), transformation(), and read().

pub unsafe fn set_background_color(&self, color: impl CastInto<Ref<QColor>>)[src]

Sets the background color to color. Image formats that support this operation are expected to initialize the background to color before reading an image.

Calls C++ function: void QImageReader::setBackgroundColor(const QColor& color).

C++ documentation:

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().

pub unsafe fn set_clip_rect(&self, rect: impl CastInto<Ref<QRect>>)[src]

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().

Calls C++ function: void QImageReader::setClipRect(const QRect& rect).

C++ documentation:

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().

pub unsafe fn set_decide_format_from_content(&self, ignored: bool)[src]

If ignored is set to true, then the image reader will ignore specified formats or file extensions and decide which plugin to use only based on the contents in the datastream.

Calls C++ function: void QImageReader::setDecideFormatFromContent(bool ignored).

C++ documentation:

If ignored is set to true, then the image reader will ignore specified formats or file extensions and decide which plugin to use only based on the contents in the datastream.

Setting this flag means that all image plugins gets loaded. Each plugin will read the first bytes in the image data and decide if the plugin is compatible or not.

This also disables auto detecting the image format.

See also decideFormatFromContent().

pub unsafe fn set_device(&self, device: impl CastInto<Ptr<QIODevice>>)[src]

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.

Calls C++ function: void QImageReader::setDevice(QIODevice* device).

C++ documentation:

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().

pub unsafe fn set_file_name(&self, file_name: impl CastInto<Ref<QString>>)[src]

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.

Calls C++ function: void QImageReader::setFileName(const QString& fileName).

C++ documentation:

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().

pub unsafe fn set_format(&self, format: impl CastInto<Ref<QByteArray>>)[src]

Sets the format QImageReader will use when reading images, to format. format is a case insensitive text string. Example:

Calls C++ function: void QImageReader::setFormat(const QByteArray& format).

C++ documentation:

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().

pub unsafe fn set_gamma(&self, gamma: c_float)[src]

This is an image format specific function that forces images with gamma information to be gamma corrected to gamma. For image formats that do not support gamma correction, this value is ignored.

Calls C++ function: void QImageReader::setGamma(float gamma).

C++ documentation:

This is an image format specific function that forces images with gamma information to be gamma corrected to gamma. For image formats that do not support gamma correction, this value is ignored.

To gamma correct to a standard PC color-space, set gamma to 1/2.2.

This function was introduced in Qt 5.6.

See also gamma().

pub unsafe fn set_quality(&self, quality: c_int)[src]

Sets the quality setting of the image format to quality.

Calls C++ function: void QImageReader::setQuality(int quality).

C++ documentation:

Sets the quality setting of the image format to quality.

Some image formats, in particular lossy ones, entail a tradeoff between a) visual quality of the resulting image, and b) decoding execution time. This function sets the level of that tradeoff for image formats that support it.

In case of scaled image reading, the quality setting may also influence the tradeoff level between visual quality and execution speed of the scaling algorithm.

The value range of quality depends on the image format. For example, the "jpeg" format supports a quality range from 0 (low visual quality) to 100 (high visual quality).

This function was introduced in Qt 4.2.

See also quality() and setScaledSize().

pub unsafe fn set_scaled_clip_rect(&self, rect: impl CastInto<Ref<QRect>>)[src]

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.

Calls C++ function: void QImageReader::setScaledClipRect(const QRect& rect).

C++ documentation:

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().

pub unsafe fn set_scaled_size(&self, size: impl CastInto<Ref<QSize>>)[src]

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.

Calls C++ function: void QImageReader::setScaledSize(const QSize& size).

C++ documentation:

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().

pub unsafe fn size(&self) -> CppBox<QSize>[src]

Returns the size of the image, without actually reading the image contents.

Calls C++ function: QSize QImageReader::size() const.

C++ documentation:

Returns the size of the image, without actually reading the image contents.

If the image format does not support this feature, this function returns an invalid size. Qt's built-in image handlers all support this feature, but custom image format plugins are not required to do so.

See also QImageIOHandler::ImageOption, QImageIOHandler::option(), and QImageIOHandler::supportsOption().

pub unsafe fn sub_type(&self) -> CppBox<QByteArray>[src]

Returns the subtype of the image.

Calls C++ function: QByteArray QImageReader::subType() const.

C++ documentation:

Returns the subtype of the image.

This function was introduced in Qt 5.4.

pub unsafe fn supported_image_formats() -> CppBox<QListOfQByteArray>[src]

Returns the list of image formats supported by QImageReader.

Calls C++ function: static QList<QByteArray> QImageReader::supportedImageFormats().

C++ documentation:

Returns the list of image formats supported by QImageReader.

By default, Qt can read the following formats:

FormatMIME typeDescription
BMPimage/bmpWindows Bitmap
GIFimage/gifGraphic Interchange Format (optional)
JPGimage/jpegJoint Photographic Experts Group
PNGimage/pngPortable Network Graphics
PBMimage/x-portable-bitmapPortable Bitmap
PGMimage/x-portable-graymapPortable Graymap
PPMimage/x-portable-pixmapPortable Pixmap
XBMimage/x-xbitmapX11 Bitmap
XPMimage/x-xpixmapX11 Pixmap
SVGimage/svg+xmlScalable Vector Graphics

Reading and writing SVG files is supported through the Qt SVG module. The Qt Image Formats module provides support for additional image formats.

Note that the QApplication instance must be created before this function is called.

See also setFormat(), QImageWriter::supportedImageFormats(), and QImageIOPlugin.

pub unsafe fn supported_mime_types() -> CppBox<QListOfQByteArray>[src]

Returns the list of MIME types supported by QImageReader.

Calls C++ function: static QList<QByteArray> QImageReader::supportedMimeTypes().

C++ documentation:

Returns the list of MIME types supported by QImageReader.

Note that the QApplication instance must be created before this function is called.

See also supportedImageFormats() and QImageWriter::supportedMimeTypes().

pub unsafe fn supported_sub_types(&self) -> CppBox<QListOfQByteArray>[src]

Returns the list of subtypes supported by an image.

Calls C++ function: QList<QByteArray> QImageReader::supportedSubTypes() const.

C++ documentation:

Returns the list of subtypes supported by an image.

This function was introduced in Qt 5.4.

pub unsafe fn supports_animation(&self) -> bool[src]

Returns true if the image format supports animation; otherwise, false is returned.

Calls C++ function: bool QImageReader::supportsAnimation() const.

C++ documentation:

Returns true if the image format supports animation; otherwise, false is returned.

This function was introduced in Qt 4.1.

See also QMovie::supportedFormats().

pub unsafe fn supports_option(&self, option: ImageOption) -> bool[src]

Returns true if the reader supports option; otherwise returns false.

Calls C++ function: bool QImageReader::supportsOption(QImageIOHandler::ImageOption option) const.

C++ documentation:

Returns true if the reader supports option; otherwise returns false.

Different image formats support different options. Call this function to determine whether a certain option is supported by the current format. For example, the PNG format allows you to embed text into the image's metadata (see text()), and the BMP format allows you to determine the image's size without loading the whole image into memory (see size()).

QImageReader reader(":/image.png"); if (reader.supportsOption(QImageIOHandler::Size)) qDebug() << "Size:" << reader.size();

This function was introduced in Qt 4.2.

See also QImageWriter::supportsOption().

pub unsafe fn text(&self, key: impl CastInto<Ref<QString>>) -> CppBox<QString>[src]

Returns the image text associated with key.

Calls C++ function: QString QImageReader::text(const QString& key) const.

C++ documentation:

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().

pub unsafe fn text_keys(&self) -> CppBox<QStringList>[src]

Returns the text keys for this image. You can use these keys with text() to list the image text for a certain key.

Calls C++ function: QStringList QImageReader::textKeys() const.

C++ documentation:

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().

pub unsafe fn tr(
    source_text: *const c_char,
    disambiguation: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QImageReader::tr(const char* sourceText, const char* disambiguation, int n).

pub unsafe fn tr_utf8(
    source_text: *const c_char,
    disambiguation: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QImageReader::trUtf8(const char* sourceText, const char* disambiguation, int n).

pub unsafe fn transformation(&self) -> QFlags<Transformation>[src]

Returns the transformation metadata of the image, including image orientation. If the format does not support transformation metadata QImageIOHandler::Transformation_None is returned.

Calls C++ function: QFlags<QImageIOHandler::Transformation> QImageReader::transformation() const.

C++ documentation:

Returns the transformation metadata of the image, including image orientation. If the format does not support transformation metadata QImageIOHandler::Transformation_None is returned.

This function was introduced in Qt 5.5.

See also setAutoTransform() and autoTransform().

Trait Implementations

impl CppDeletable for QImageReader[src]

unsafe fn delete(&self)[src]

Destructs the QImageReader object.

Calls C++ function: [destructor] void QImageReader::~QImageReader().

C++ documentation:

Destructs the QImageReader object.

impl Size for QImageReader[src]

unsafe fn size(&self) -> usize[src]

Returns the size of the image, without actually reading the image contents.

Calls C++ function: QSize QImageReader::size() const.

C++ documentation:

Returns the size of the image, without actually reading the image contents.

If the image format does not support this feature, this function returns an invalid size. Qt's built-in image handlers all support this feature, but custom image format plugins are not required to do so.

See also QImageIOHandler::ImageOption, QImageIOHandler::option(), and QImageIOHandler::supportsOption().

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.