[][src]Struct qt_gui::QImage

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

The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.

C++ class: QImage.

C++ documentation:

The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.

Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture. QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen. QBitmap is only a convenience class that inherits QPixmap, ensuring a depth of 1. Finally, the QPicture class is a paint device that records and replays QPainter commands.

Because QImage is a QPaintDevice subclass, QPainter can be used to draw directly onto images. When using QPainter on a QImage, the painting can be performed in another thread than the current GUI thread.

The QImage class supports several image formats described by the Format enum. These include monochrome, 8-bit, 32-bit and alpha-blended images which are available in all versions of Qt 4.x.

QImage provides a collection of functions that can be used to obtain a variety of information about the image. There are also several functions that enables transformation of the image.

QImage objects can be passed around by value since the QImage class uses implicit data sharing. QImage objects can also be streamed and compared.

Note: If you would like to load QImage objects in a static build of Qt, refer to the Plugin HowTo.

Warning: Painting on a QImage with the format QImage::Format_Indexed8 is not supported.

Methods

impl QImage[src]

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

Returns true if all the colors in the image are shades of gray (i.e. their red, green and blue components are equal); otherwise false.

Calls C++ function: bool QImage::allGray() const.

C++ documentation:

Returns true if all the colors in the image are shades of gray (i.e. their red, green and blue components are equal); otherwise false.

Note that this function is slow for images without color table.

See also isGrayscale().

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

Returns the alpha channel of the image as a new grayscale QImage in which each pixel's red, green, and blue values are given the alpha value of the original image. The color depth of the returned image is 8-bit.

Calls C++ function: QImage QImage::alphaChannel() const.

C++ documentation:

Returns the alpha channel of the image as a new grayscale QImage in which each pixel's red, green, and blue values are given the alpha value of the original image. The color depth of the returned image is 8-bit.

You can see an example of use of this function in QPixmap's alphaChannel(), which works in the same way as this function on QPixmaps.

Most usecases for this function can be replaced with QPainter and using composition modes.

Note this returns a color-indexed image if you want the alpha channel in the alpha8 format instead use convertToFormat(Format_Alpha8) on the source image.

Warning: This is an expensive function.

See also setAlphaChannel(), hasAlphaChannel(), convertToFormat(), Pixmap, and Image Transformations.

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

Returns the number of bit planes in the image.

Calls C++ function: int QImage::bitPlaneCount() const.

C++ documentation:

Returns the number of bit planes in the image.

The number of bit planes is the number of bits of color and transparency information for each pixel. This is different from (i.e. smaller than) the depth when the image format contains unused bits.

This function was introduced in Qt 4.7.

See also depth(), format(), and Image Formats.

pub unsafe fn bits_mut(&mut self) -> MutPtr<c_uchar>[src]

Returns a pointer to the first pixel data. This is equivalent to scanLine(0).

Calls C++ function: unsigned char* QImage::bits().

C++ documentation:

Returns a pointer to the first pixel data. This is equivalent to scanLine(0).

Note that QImage uses implicit data sharing. This function performs a deep copy of the shared pixel data, thus ensuring that this QImage is the only one using the current return value.

See also scanLine(), byteCount(), and constBits().

pub unsafe fn bits(&self) -> Ptr<c_uchar>[src]

This is an overloaded function.

Calls C++ function: const unsigned char* QImage::bits() const.

C++ documentation:

This is an overloaded function.

Note that QImage uses implicit data sharing, but this function does not perform a deep copy of the shared pixel data, because the returned data is const.

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

Returns the number of bytes occupied by the image data.

Calls C++ function: int QImage::byteCount() const.

C++ documentation:

Returns the number of bytes occupied by the image data.

This function was introduced in Qt 4.6.

See also bytesPerLine(), bits(), and Image Information.

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

Returns the number of bytes per image scanline.

Calls C++ function: int QImage::bytesPerLine() const.

C++ documentation:

Returns the number of bytes per image scanline.

This is equivalent to byteCount() / height().

See also scanLine().

pub unsafe fn cache_key(&self) -> i64[src]

Returns a number that identifies the contents of this QImage object. Distinct QImage objects can only have the same key if they refer to the same contents.

Calls C++ function: qint64 QImage::cacheKey() const.

C++ documentation:

Returns a number that identifies the contents of this QImage object. Distinct QImage objects can only have the same key if they refer to the same contents.

The key will change when the image is altered.

pub unsafe fn color(&self, i: c_int) -> c_uint[src]

Returns the color in the color table at index i. The first color is at index 0.

Calls C++ function: unsigned int QImage::color(int i) const.

C++ documentation:

Returns the color in the color table at index i. The first color is at index 0.

The colors in an image's color table are specified as ARGB quadruplets (QRgb). Use the qAlpha(), qRed(), qGreen(), and qBlue() functions to get the color value components.

See also setColor(), pixelIndex(), and Pixel Manipulation.

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

Returns the size of the color table for the image.

Calls C++ function: int QImage::colorCount() const.

C++ documentation:

Returns the size of the color table for the image.

Notice that colorCount() returns 0 for 32-bpp images because these images do not use color tables, but instead encode pixel values as ARGB quadruplets.

This function was introduced in Qt 4.6.

See also setColorCount() and Image Information.

pub unsafe fn color_table(&self) -> CppBox<QVectorOfUint>[src]

Returns a list of the colors contained in the image's color table, or an empty list if the image does not have a color table

Calls C++ function: QVector<unsigned int> QImage::colorTable() const.

C++ documentation:

Returns a list of the colors contained in the image's color table, or an empty list if the image does not have a color table

See also setColorTable(), colorCount(), and color().

pub unsafe fn const_bits(&self) -> Ptr<c_uchar>[src]

Returns a pointer to the first pixel data.

Calls C++ function: const unsigned char* QImage::constBits() const.

C++ documentation:

Returns a pointer to the first pixel data.

Note that QImage uses implicit data sharing, but this function does not perform a deep copy of the shared pixel data, because the returned data is const.

This function was introduced in Qt 4.7.

See also bits() and constScanLine().

pub unsafe fn const_scan_line(&self, arg1: c_int) -> Ptr<c_uchar>[src]

Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0.

Calls C++ function: const unsigned char* QImage::constScanLine(int arg1) const.

C++ documentation:

Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0.

The scanline data is aligned on a 32-bit boundary.

Note that QImage uses implicit data sharing, but this function does not perform a deep copy of the shared pixel data, because the returned data is const.

This function was introduced in Qt 4.7.

See also scanLine() and constBits().

pub unsafe fn convert_to_2a(
    &mut self,
    f: Format,
    flags: QFlags<ImageConversionFlag>
)
[src]

Detach and convert the image to the given format in place.

Calls C++ function: void QImage::convertTo(QImage::Format f, QFlags<Qt::ImageConversionFlag> flags = …).

C++ documentation:

Detach and convert the image to the given format in place.

The specified image conversion flags control how the image data is handled during the conversion process.

This function was introduced in Qt 5.13.

See also convertToFormat().

This item is available if cpp_lib_version="5.13.0".

pub unsafe fn convert_to_1a(&mut self, f: Format)[src]

Detach and convert the image to the given format in place.

Calls C++ function: void QImage::convertTo(QImage::Format f).

C++ documentation:

Detach and convert the image to the given format in place.

The specified image conversion flags control how the image data is handled during the conversion process.

This function was introduced in Qt 5.13.

See also convertToFormat().

This item is available if cpp_lib_version="5.13.0".

pub unsafe fn convert_to_format_format_q_flags_image_conversion_flag(
    &self,
    f: Format,
    flags: QFlags<ImageConversionFlag>
) -> CppBox<QImage>
[src]

Returns a copy of the image in the given format.

Calls C++ function: QImage QImage::convertToFormat(QImage::Format f, QFlags<Qt::ImageConversionFlag> flags = …) const.

C++ documentation:

Returns a copy of the image in the given format.

The specified image conversion flags control how the image data is handled during the conversion process.

See also Image Formats.

pub unsafe fn convert_to_format_format_q_flags_image_conversion_flag_mut(
    &mut self,
    f: Format,
    flags: QFlags<ImageConversionFlag>
) -> CppBox<QImage>
[src]

Returns a copy of the image in the given format.

Calls C++ function: QImage QImage::convertToFormat(QImage::Format f, QFlags<Qt::ImageConversionFlag> flags = …).

C++ documentation:

Returns a copy of the image in the given format.

The specified image conversion flags control how the image data is handled during the conversion process.

See also Image Formats.

pub unsafe fn convert_to_format_format_q_vector_of_uint_q_flags_image_conversion_flag(
    &self,
    f: Format,
    color_table: impl CastInto<Ref<QVectorOfUint>>,
    flags: QFlags<ImageConversionFlag>
) -> CppBox<QImage>
[src]

This is an overloaded function.

Calls C++ function: QImage QImage::convertToFormat(QImage::Format f, const QVector<unsigned int>& colorTable, QFlags<Qt::ImageConversionFlag> flags = …) const.

C++ documentation:

This is an overloaded function.

Returns a copy of the image converted to the given format, using the specified colorTable.

Conversion from RGB formats to indexed formats is a slow operation and will use a straightforward nearest color approach, with no dithering.

pub unsafe fn convert_to_format_format(&self, f: Format) -> CppBox<QImage>[src]

Returns a copy of the image in the given format.

Calls C++ function: QImage QImage::convertToFormat(QImage::Format f) const.

C++ documentation:

Returns a copy of the image in the given format.

The specified image conversion flags control how the image data is handled during the conversion process.

See also Image Formats.

pub unsafe fn convert_to_format_format_mut(
    &mut self,
    f: Format
) -> CppBox<QImage>
[src]

Returns a copy of the image in the given format.

Calls C++ function: QImage QImage::convertToFormat(QImage::Format f).

C++ documentation:

Returns a copy of the image in the given format.

The specified image conversion flags control how the image data is handled during the conversion process.

See also Image Formats.

pub unsafe fn convert_to_format_format_q_vector_of_uint(
    &self,
    f: Format,
    color_table: impl CastInto<Ref<QVectorOfUint>>
) -> CppBox<QImage>
[src]

This is an overloaded function.

Calls C++ function: QImage QImage::convertToFormat(QImage::Format f, const QVector<unsigned int>& colorTable) const.

C++ documentation:

This is an overloaded function.

Returns a copy of the image converted to the given format, using the specified colorTable.

Conversion from RGB formats to indexed formats is a slow operation and will use a straightforward nearest color approach, with no dithering.

pub unsafe fn copy_1a(&self, rect: impl CastInto<Ref<QRect>>) -> CppBox<QImage>[src]

Returns a sub-area of the image as a new image.

Calls C++ function: QImage QImage::copy(const QRect& rect = …) const.

C++ documentation:

Returns a sub-area of the image as a new image.

The returned image is copied from the position (rectangle.x(), rectangle.y()) in this image, and will always have the size of the given rectangle.

In areas beyond this image, pixels are set to 0. For 32-bit RGB images, this means black; for 32-bit ARGB images, this means transparent black; for 8-bit images, this means the color with index 0 in the color table which can be anything; for 1-bit images, this means Qt::color0.

If the given rectangle is a null rectangle the entire image is copied.

See also QImage().

pub unsafe fn copy_4a(
    &self,
    x: c_int,
    y: c_int,
    w: c_int,
    h: c_int
) -> CppBox<QImage>
[src]

This is an overloaded function.

Calls C++ function: QImage QImage::copy(int x, int y, int w, int h) const.

C++ documentation:

This is an overloaded function.

The returned image is copied from the position (x, y) in this image, and will always have the given width and height. In areas beyond this image, pixels are set to 0.

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

Returns a sub-area of the image as a new image.

Calls C++ function: QImage QImage::copy() const.

C++ documentation:

Returns a sub-area of the image as a new image.

The returned image is copied from the position (rectangle.x(), rectangle.y()) in this image, and will always have the size of the given rectangle.

In areas beyond this image, pixels are set to 0. For 32-bit RGB images, this means black; for 32-bit ARGB images, this means transparent black; for 8-bit images, this means the color with index 0 in the color table which can be anything; for 1-bit images, this means Qt::color0.

If the given rectangle is a null rectangle the entire image is copied.

See also QImage().

pub unsafe fn copy_from(
    &mut self,
    arg1: impl CastInto<Ref<QImage>>
) -> MutRef<QImage>
[src]

Assigns a shallow copy of the given image to this image and returns a reference to this image.

Calls C++ function: QImage& QImage::operator=(const QImage& arg1).

C++ documentation:

Assigns a shallow copy of the given image to this image and returns a reference to this image.

For more information about shallow copies, see the Implicit Data Sharing documentation.

See also copy() and QImage().

pub unsafe fn create_alpha_mask_1a(
    &self,
    flags: QFlags<ImageConversionFlag>
) -> CppBox<QImage>
[src]

Builds and returns a 1-bpp mask from the alpha buffer in this image. Returns a null image if the image's format is QImage::Format_RGB32.

Calls C++ function: QImage QImage::createAlphaMask(QFlags<Qt::ImageConversionFlag> flags = …) const.

C++ documentation:

Builds and returns a 1-bpp mask from the alpha buffer in this image. Returns a null image if the image's format is QImage::Format_RGB32.

The flags argument is a bitwise-OR of the Qt::ImageConversionFlags, and controls the conversion process. Passing 0 for flags sets all the default options.

The returned image has little-endian bit order (i.e. the image's format is QImage::Format_MonoLSB), which you can convert to big-endian (QImage::Format_Mono) using the convertToFormat() function.

See also createHeuristicMask() and Image Transformations.

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

Builds and returns a 1-bpp mask from the alpha buffer in this image. Returns a null image if the image's format is QImage::Format_RGB32.

Calls C++ function: QImage QImage::createAlphaMask() const.

C++ documentation:

Builds and returns a 1-bpp mask from the alpha buffer in this image. Returns a null image if the image's format is QImage::Format_RGB32.

The flags argument is a bitwise-OR of the Qt::ImageConversionFlags, and controls the conversion process. Passing 0 for flags sets all the default options.

The returned image has little-endian bit order (i.e. the image's format is QImage::Format_MonoLSB), which you can convert to big-endian (QImage::Format_Mono) using the convertToFormat() function.

See also createHeuristicMask() and Image Transformations.

pub unsafe fn create_heuristic_mask_1a(
    &self,
    clip_tight: bool
) -> CppBox<QImage>
[src]

Creates and returns a 1-bpp heuristic mask for this image.

Calls C++ function: QImage QImage::createHeuristicMask(bool clipTight = …) const.

C++ documentation:

Creates and returns a 1-bpp heuristic mask for this image.

The function works by selecting a color from one of the corners, then chipping away pixels of that color starting at all the edges. The four corners vote for which color is to be masked away. In case of a draw (this generally means that this function is not applicable to the image), the result is arbitrary.

The returned image has little-endian bit order (i.e. the image's format is QImage::Format_MonoLSB), which you can convert to big-endian (QImage::Format_Mono) using the convertToFormat() function.

If clipTight is true (the default) the mask is just large enough to cover the pixels; otherwise, the mask is larger than the data pixels.

Note that this function disregards the alpha buffer.

See also createAlphaMask() and Image Transformations.

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

Creates and returns a 1-bpp heuristic mask for this image.

Calls C++ function: QImage QImage::createHeuristicMask() const.

C++ documentation:

Creates and returns a 1-bpp heuristic mask for this image.

The function works by selecting a color from one of the corners, then chipping away pixels of that color starting at all the edges. The four corners vote for which color is to be masked away. In case of a draw (this generally means that this function is not applicable to the image), the result is arbitrary.

The returned image has little-endian bit order (i.e. the image's format is QImage::Format_MonoLSB), which you can convert to big-endian (QImage::Format_Mono) using the convertToFormat() function.

If clipTight is true (the default) the mask is just large enough to cover the pixels; otherwise, the mask is larger than the data pixels.

Note that this function disregards the alpha buffer.

See also createAlphaMask() and Image Transformations.

pub unsafe fn create_mask_from_color_2a(
    &self,
    color: c_uint,
    mode: MaskMode
) -> CppBox<QImage>
[src]

Creates and returns a mask for this image based on the given color value. If the mode is MaskInColor (the default value), all pixels matching color will be opaque pixels in the mask. If mode is MaskOutColor, all pixels matching the given color will be transparent.

Calls C++ function: QImage QImage::createMaskFromColor(unsigned int color, Qt::MaskMode mode = …) const.

C++ documentation:

Creates and returns a mask for this image based on the given color value. If the mode is MaskInColor (the default value), all pixels matching color will be opaque pixels in the mask. If mode is MaskOutColor, all pixels matching the given color will be transparent.

See also createAlphaMask() and createHeuristicMask().

pub unsafe fn create_mask_from_color_1a(&self, color: c_uint) -> CppBox<QImage>[src]

Creates and returns a mask for this image based on the given color value. If the mode is MaskInColor (the default value), all pixels matching color will be opaque pixels in the mask. If mode is MaskOutColor, all pixels matching the given color will be transparent.

Calls C++ function: QImage QImage::createMaskFromColor(unsigned int color) const.

C++ documentation:

Creates and returns a mask for this image based on the given color value. If the mode is MaskInColor (the default value), all pixels matching color will be opaque pixels in the mask. If mode is MaskOutColor, all pixels matching the given color will be transparent.

See also createAlphaMask() and createHeuristicMask().

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

Returns the depth of the image.

Calls C++ function: int QImage::depth() const.

C++ documentation:

Returns the depth of the image.

The image depth is the number of bits used to store a single pixel, also called bits per pixel (bpp).

The supported depths are 1, 8, 16, 24 and 32.

See also bitPlaneCount(), convertToFormat(), Image Formats, and Image Information.

pub unsafe fn detach(&mut self)[src]

Calls C++ function: void QImage::detach().

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

Calls C++ function: virtual int QImage::devType() const.

pub unsafe fn device_pixel_ratio(&self) -> c_double[src]

Returns the device pixel ratio for the image. This is the ratio between device pixels and device independent pixels.

Calls C++ function: double QImage::devicePixelRatio() const.

C++ documentation:

Returns the device pixel ratio for the image. This is the ratio between device pixels and device independent pixels.

Use this function when calculating layout geometry based on the image size: QSize layoutSize = image.size() / image.devicePixelRatio()

The default value is 1.0.

See also setDevicePixelRatio() and QImageReader.

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

Returns the number of pixels that fit horizontally in a physical meter. Together with dotsPerMeterY(), this number defines the intended scale and aspect ratio of the image.

Calls C++ function: int QImage::dotsPerMeterX() const.

C++ documentation:

Returns the number of pixels that fit horizontally in a physical meter. Together with dotsPerMeterY(), this number defines the intended scale and aspect ratio of the image.

See also setDotsPerMeterX() and Image Information.

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

Returns the number of pixels that fit vertically in a physical meter. Together with dotsPerMeterX(), this number defines the intended scale and aspect ratio of the image.

Calls C++ function: int QImage::dotsPerMeterY() const.

C++ documentation:

Returns the number of pixels that fit vertically in a physical meter. Together with dotsPerMeterX(), this number defines the intended scale and aspect ratio of the image.

See also setDotsPerMeterY() and Image Information.

pub unsafe fn fill_uint(&mut self, pixel: c_uint)[src]

Fills the entire image with the given pixelValue.

Calls C++ function: void QImage::fill(unsigned int pixel).

C++ documentation:

Fills the entire image with the given pixelValue.

If the depth of this image is 1, only the lowest bit is used. If you say fill(0), fill(2), etc., the image is filled with 0s. If you say fill(1), fill(3), etc., the image is filled with 1s. If the depth is 8, the lowest 8 bits are used and if the depth is 16 the lowest 16 bits are used.

Note: QImage::pixel() returns the color of the pixel at the given coordinates while QColor::pixel() returns the pixel value of the underlying window system (essentially an index value), so normally you will want to use QImage::pixel() to use a color from an existing image or QColor::rgb() to use a specific color.

See also depth() and Image Transformations.

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

This is an overloaded function.

Calls C++ function: void QImage::fill(const QColor& color).

C++ documentation:

This is an overloaded function.

Fills the entire image with the given color.

If the depth of the image is 1, the image will be filled with 1 if color equals Qt::color1; it will otherwise be filled with 0.

If the depth of the image is 8, the image will be filled with the index corresponding the color in the color table if present; it will otherwise be filled with 0.

This function was introduced in Qt 4.8.

pub unsafe fn fill_global_color(&mut self, color: GlobalColor)[src]

This is an overloaded function.

Calls C++ function: void QImage::fill(Qt::GlobalColor color).

C++ documentation:

This is an overloaded function.

Fills the image with the given color, described as a standard global color.

This function was introduced in Qt 4.8.

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

Returns the format of the image.

Calls C++ function: QImage::Format QImage::format() const.

C++ documentation:

Returns the format of the image.

See also Image Formats.

pub unsafe fn from_data_uchar_int_char(
    data: impl CastInto<Ptr<c_uchar>>,
    size: c_int,
    format: impl CastInto<Ptr<c_char>>
) -> CppBox<QImage>
[src]

Constructs a QImage from the first size bytes of the given binary data. The loader attempts to read the image using the specified format. If format is not specified (which is the default), the loader probes the data for a header to guess the file format.

Calls C++ function: static QImage QImage::fromData(const unsigned char* data, int size, const char* format = …).

C++ documentation:

Constructs a QImage from the first size bytes of the given binary data. The loader attempts to read the image using the specified format. If format is not specified (which is the default), the loader probes the data for a header to guess the file format.

If format is specified, it must be one of the values returned by QImageReader::supportedImageFormats().

If the loading of the image fails, the image returned will be a null image.

See also load(), save(), and Reading and Writing Image Files.

pub unsafe fn from_data_q_byte_array_char(
    data: impl CastInto<Ref<QByteArray>>,
    format: impl CastInto<Ptr<c_char>>
) -> CppBox<QImage>
[src]

This is an overloaded function.

Calls C++ function: static QImage QImage::fromData(const QByteArray& data, const char* format = …).

C++ documentation:

This is an overloaded function.

Loads an image from the given QByteArray data.

pub unsafe fn from_data_uchar_int(
    data: impl CastInto<Ptr<c_uchar>>,
    size: c_int
) -> CppBox<QImage>
[src]

Constructs a QImage from the first size bytes of the given binary data. The loader attempts to read the image using the specified format. If format is not specified (which is the default), the loader probes the data for a header to guess the file format.

Calls C++ function: static QImage QImage::fromData(const unsigned char* data, int size).

C++ documentation:

Constructs a QImage from the first size bytes of the given binary data. The loader attempts to read the image using the specified format. If format is not specified (which is the default), the loader probes the data for a header to guess the file format.

If format is specified, it must be one of the values returned by QImageReader::supportedImageFormats().

If the loading of the image fails, the image returned will be a null image.

See also load(), save(), and Reading and Writing Image Files.

pub unsafe fn from_data_q_byte_array(
    data: impl CastInto<Ref<QByteArray>>
) -> CppBox<QImage>
[src]

This is an overloaded function.

Calls C++ function: static QImage QImage::fromData(const QByteArray& data).

C++ documentation:

This is an overloaded function.

Loads an image from the given QByteArray data.

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

Returns true if the image has a format that respects the alpha channel, otherwise returns false.

Calls C++ function: bool QImage::hasAlphaChannel() const.

C++ documentation:

Returns true if the image has a format that respects the alpha channel, otherwise returns false.

See also Image Information.

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

Returns the height of the image.

Calls C++ function: int QImage::height() const.

C++ documentation:

Returns the height of the image.

See also Image Information.

pub unsafe fn invert_pixels_1a(&mut self, arg1: InvertMode)[src]

Inverts all pixel values in the image.

Calls C++ function: void QImage::invertPixels(QImage::InvertMode arg1 = …).

C++ documentation:

Inverts all pixel values in the image.

The given invert mode only have a meaning when the image's depth is 32. The default mode is InvertRgb, which leaves the alpha channel unchanged. If the mode is InvertRgba, the alpha bits are also inverted.

Inverting an 8-bit image means to replace all pixels using color index i with a pixel using color index 255 minus i. The same is the case for a 1-bit image. Note that the color table is not changed.

If the image has a premultiplied alpha channel, the image is first converted to ARGB32 to be inverted and then converted back.

See also Image Transformations.

pub unsafe fn invert_pixels_0a(&mut self)[src]

Inverts all pixel values in the image.

Calls C++ function: void QImage::invertPixels().

C++ documentation:

Inverts all pixel values in the image.

The given invert mode only have a meaning when the image's depth is 32. The default mode is InvertRgb, which leaves the alpha channel unchanged. If the mode is InvertRgba, the alpha bits are also inverted.

Inverting an 8-bit image means to replace all pixels using color index i with a pixel using color index 255 minus i. The same is the case for a 1-bit image. Note that the color table is not changed.

If the image has a premultiplied alpha channel, the image is first converted to ARGB32 to be inverted and then converted back.

See also Image Transformations.

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

Calls C++ function: bool QImage::isDetached() const.

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

For 32-bit images, this function is equivalent to allGray().

Calls C++ function: bool QImage::isGrayscale() const.

C++ documentation:

For 32-bit images, this function is equivalent to allGray().

For color indexed images, this function returns true if color(i) is QRgb(i, i, i) for all indexes of the color table; otherwise returns false.

See also allGray() and Image Formats.

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

Returns true if it is a null image, otherwise returns false.

Calls C++ function: bool QImage::isNull() const.

C++ documentation:

Returns true if it is a null image, otherwise returns false.

A null image has all parameters set to zero and no allocated data.

pub unsafe fn load_q_io_device_char(
    &mut self,
    device: impl CastInto<MutPtr<QIODevice>>,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QImage::load(QIODevice* device, const char* format).

C++ documentation:

This is an overloaded function.

This function reads a QImage from the given device. This can, for example, be used to load an image directly into a QByteArray.

pub unsafe fn load_q_string_char(
    &mut self,
    file_name: impl CastInto<Ref<QString>>,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

Loads an image from the file with the given fileName. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

Calls C++ function: bool QImage::load(const QString& fileName, const char* format = …).

C++ documentation:

Loads an image from the file with the given fileName. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), it is auto-detected based on the file's suffix and header. For details, see {QImageReader::setAutoDetectImageFormat()}{QImageReader}.

The file name can either refer to an actual file on disk or to one of the application's embedded resources. See the Resource System overview for details on how to embed images and other resource files in the application's executable.

See also Reading and Writing Image Files.

pub unsafe fn load_q_string(
    &mut self,
    file_name: impl CastInto<Ref<QString>>
) -> bool
[src]

Loads an image from the file with the given fileName. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

Calls C++ function: bool QImage::load(const QString& fileName).

C++ documentation:

Loads an image from the file with the given fileName. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), it is auto-detected based on the file's suffix and header. For details, see {QImageReader::setAutoDetectImageFormat()}{QImageReader}.

The file name can either refer to an actual file on disk or to one of the application's embedded resources. See the Resource System overview for details on how to embed images and other resource files in the application's executable.

See also Reading and Writing Image Files.

pub unsafe fn load_from_data_uchar_int_char(
    &mut self,
    buf: impl CastInto<Ptr<c_uchar>>,
    len: c_int,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

Loads an image from the first len bytes of the given binary data. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

Calls C++ function: bool QImage::loadFromData(const unsigned char* buf, int len, const char* format = …).

C++ documentation:

Loads an image from the first len bytes of the given binary data. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), the loader probes the file for a header to guess the file format.

See also Reading and Writing Image Files.

pub unsafe fn load_from_data_q_byte_array_char(
    &mut self,
    data: impl CastInto<Ref<QByteArray>>,
    aformat: impl CastInto<Ptr<c_char>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QImage::loadFromData(const QByteArray& data, const char* aformat = …).

C++ documentation:

This is an overloaded function.

Loads an image from the given QByteArray data.

pub unsafe fn load_from_data_uchar_int(
    &mut self,
    buf: impl CastInto<Ptr<c_uchar>>,
    len: c_int
) -> bool
[src]

Loads an image from the first len bytes of the given binary data. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

Calls C++ function: bool QImage::loadFromData(const unsigned char* buf, int len).

C++ documentation:

Loads an image from the first len bytes of the given binary data. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.

The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), the loader probes the file for a header to guess the file format.

See also Reading and Writing Image Files.

pub unsafe fn load_from_data_q_byte_array(
    &mut self,
    data: impl CastInto<Ref<QByteArray>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QImage::loadFromData(const QByteArray& data).

C++ documentation:

This is an overloaded function.

Loads an image from the given QByteArray data.

pub unsafe fn mirrored_2a(
    &self,
    horizontally: bool,
    vertically: bool
) -> CppBox<QImage>
[src]

Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false.

Calls C++ function: QImage QImage::mirrored(bool horizontally = …, bool vertically = …) const.

C++ documentation:

Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false.

Note that the original image is not changed.

See also Image Transformations.

pub unsafe fn mirrored_1a(&self, horizontally: bool) -> CppBox<QImage>[src]

Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false.

Calls C++ function: QImage QImage::mirrored(bool horizontally = …) const.

C++ documentation:

Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false.

Note that the original image is not changed.

See also Image Transformations.

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

Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false.

Calls C++ function: QImage QImage::mirrored() const.

C++ documentation:

Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false.

Note that the original image is not changed.

See also Image Transformations.

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

Constructs a null image.

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

C++ documentation:

Constructs a null image.

See also isNull().

pub unsafe fn from_q_size_format(
    size: impl CastInto<Ref<QSize>>,
    format: Format
) -> CppBox<QImage>
[src]

Constructs an image with the given size and format.

Calls C++ function: [constructor] void QImage::QImage(const QSize& size, QImage::Format format).

C++ documentation:

Constructs an image with the given size and format.

A null image is returned if memory cannot be allocated.

Warning: This will create a QImage with uninitialized data. Call fill() to fill the image with an appropriate pixel value before drawing onto it with QPainter.

pub unsafe fn from_2_int_format(
    width: c_int,
    height: c_int,
    format: Format
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format.

Calls C++ function: [constructor] void QImage::QImage(int width, int height, QImage::Format format).

C++ documentation:

Constructs an image with the given width, height and format.

A null image will be returned if memory cannot be allocated.

Warning: This will create a QImage with uninitialized data. Call fill() to fill the image with an appropriate pixel value before drawing onto it with QPainter.

pub unsafe fn from_uchar2_int_format_option_fn_void(
    data: impl CastInto<MutPtr<c_uchar>>,
    width: c_int,
    height: c_int,
    format: Format,
    cleanup_function: Option<extern "C" fn(_: *mut c_void)>,
    cleanup_info: impl CastInto<MutPtr<c_void>>
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

Calls C++ function: [constructor] void QImage::QImage(unsigned char* data, int width, int height, QImage::Format format, void (*FN_PTR)(void*) cleanupFunction = …, void* cleanupInfo = …).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

pub unsafe fn from_uchar2_int_format_option_fn_void2(
    data: impl CastInto<Ptr<c_uchar>>,
    width: c_int,
    height: c_int,
    format: Format,
    cleanup_function: Option<extern "C" fn(_: *mut c_void)>,
    cleanup_info: impl CastInto<MutPtr<c_void>>
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

Calls C++ function: [constructor] void QImage::QImage(const unsigned char* data, int width, int height, QImage::Format format, void (*FN_PTR)(void*) cleanupFunction = …, void* cleanupInfo = …).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed.

pub unsafe fn from_uchar3_int_format_option_fn_void(
    data: impl CastInto<MutPtr<c_uchar>>,
    width: c_int,
    height: c_int,
    bytes_per_line: c_int,
    format: Format,
    cleanup_function: Option<extern "C" fn(_: *mut c_void)>,
    cleanup_info: impl CastInto<MutPtr<c_void>>
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

Calls C++ function: [constructor] void QImage::QImage(unsigned char* data, int width, int height, int bytesPerLine, QImage::Format format, void (*FN_PTR)(void*) cleanupFunction = …, void* cleanupInfo = …).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

pub unsafe fn from_uchar3_int_format_option_fn_void2(
    data: impl CastInto<Ptr<c_uchar>>,
    width: c_int,
    height: c_int,
    bytes_per_line: c_int,
    format: Format,
    cleanup_function: Option<extern "C" fn(_: *mut c_void)>,
    cleanup_info: impl CastInto<MutPtr<c_void>>
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

Calls C++ function: [constructor] void QImage::QImage(const unsigned char* data, int width, int height, int bytesPerLine, QImage::Format format, void (*FN_PTR)(void*) cleanupFunction = …, void* cleanupInfo = …).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed.

pub unsafe fn from_q_string_char(
    file_name: impl CastInto<Ref<QString>>,
    format: impl CastInto<Ptr<c_char>>
) -> CppBox<QImage>
[src]

Constructs an image and tries to load the image from the file with the given fileName.

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

C++ documentation:

Constructs an image and tries to load the image from the file with the given fileName.

The loader attempts to read the image using the specified format. If the format is not specified (which is the default), it is auto-detected based on the file's suffix and header. For details, see {QImageReader::setAutoDetectImageFormat()}{QImageReader}.

If the loading of the image failed, this object is a null image.

The file name can either refer to an actual file on disk or to one of the application's embedded resources. See the Resource System overview for details on how to embed images and other resource files in the application's executable.

See also isNull() and Reading and Writing Image Files.

pub unsafe fn from_uchar2_int_format_option_fn(
    data: impl CastInto<MutPtr<c_uchar>>,
    width: c_int,
    height: c_int,
    format: Format,
    cleanup_function: Option<extern "C" fn(_: *mut c_void)>
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

Calls C++ function: [constructor] void QImage::QImage(unsigned char* data, int width, int height, QImage::Format format, void (*FN_PTR)(void*) cleanupFunction = …).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

pub unsafe fn from_uchar2_int_format(
    data: impl CastInto<MutPtr<c_uchar>>,
    width: c_int,
    height: c_int,
    format: Format
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

Calls C++ function: [constructor] void QImage::QImage(unsigned char* data, int width, int height, QImage::Format format).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

pub unsafe fn from_uchar2_int_format_option_fn2(
    data: impl CastInto<Ptr<c_uchar>>,
    width: c_int,
    height: c_int,
    format: Format,
    cleanup_function: Option<extern "C" fn(_: *mut c_void)>
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

Calls C++ function: [constructor] void QImage::QImage(const unsigned char* data, int width, int height, QImage::Format format, void (*FN_PTR)(void*) cleanupFunction = …).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed.

pub unsafe fn from_uchar2_int_format2(
    data: impl CastInto<Ptr<c_uchar>>,
    width: c_int,
    height: c_int,
    format: Format
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

Calls C++ function: [constructor] void QImage::QImage(const unsigned char* data, int width, int height, QImage::Format format).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed.

pub unsafe fn from_uchar3_int_format_option_fn(
    data: impl CastInto<MutPtr<c_uchar>>,
    width: c_int,
    height: c_int,
    bytes_per_line: c_int,
    format: Format,
    cleanup_function: Option<extern "C" fn(_: *mut c_void)>
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

Calls C++ function: [constructor] void QImage::QImage(unsigned char* data, int width, int height, int bytesPerLine, QImage::Format format, void (*FN_PTR)(void*) cleanupFunction = …).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

pub unsafe fn from_uchar3_int_format(
    data: impl CastInto<MutPtr<c_uchar>>,
    width: c_int,
    height: c_int,
    bytes_per_line: c_int,
    format: Format
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

Calls C++ function: [constructor] void QImage::QImage(unsigned char* data, int width, int height, int bytesPerLine, QImage::Format format).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

pub unsafe fn from_uchar3_int_format_option_fn2(
    data: impl CastInto<Ptr<c_uchar>>,
    width: c_int,
    height: c_int,
    bytes_per_line: c_int,
    format: Format,
    cleanup_function: Option<extern "C" fn(_: *mut c_void)>
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

Calls C++ function: [constructor] void QImage::QImage(const unsigned char* data, int width, int height, int bytesPerLine, QImage::Format format, void (*FN_PTR)(void*) cleanupFunction = …).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed.

pub unsafe fn from_uchar3_int_format2(
    data: impl CastInto<Ptr<c_uchar>>,
    width: c_int,
    height: c_int,
    bytes_per_line: c_int,
    format: Format
) -> CppBox<QImage>
[src]

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

Calls C++ function: [constructor] void QImage::QImage(const unsigned char* data, int width, int height, int bytesPerLine, QImage::Format format).

C++ documentation:

Constructs an image with the given width, height and format, that uses an existing memory buffer, data. The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).

The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.

Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed.

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

Constructs an image and tries to load the image from the file with the given fileName.

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

C++ documentation:

Constructs an image and tries to load the image from the file with the given fileName.

The loader attempts to read the image using the specified format. If the format is not specified (which is the default), it is auto-detected based on the file's suffix and header. For details, see {QImageReader::setAutoDetectImageFormat()}{QImageReader}.

If the loading of the image failed, this object is a null image.

The file name can either refer to an actual file on disk or to one of the application's embedded resources. See the Resource System overview for details on how to embed images and other resource files in the application's executable.

See also isNull() and Reading and Writing Image Files.

pub unsafe fn new_copy(arg1: impl CastInto<Ref<QImage>>) -> CppBox<QImage>[src]

Constructs a shallow copy of the given image.

Calls C++ function: [constructor] void QImage::QImage(const QImage& arg1).

C++ documentation:

Constructs a shallow copy of the given image.

For more information about shallow copies, see the Implicit Data Sharing documentation.

See also copy().

pub unsafe fn offset(&self) -> CppBox<QPoint>[src]

Returns the number of pixels by which the image is intended to be offset by when positioning relative to other images.

Calls C++ function: QPoint QImage::offset() const.

C++ documentation:

Returns the number of pixels by which the image is intended to be offset by when positioning relative to other images.

See also setOffset() and Image Information.

pub unsafe fn paint_engine(&self) -> MutPtr<QPaintEngine>[src]

Calls C++ function: virtual QPaintEngine* QImage::paintEngine() const.

pub unsafe fn pixel_2a(&self, x: c_int, y: c_int) -> c_uint[src]

This is an overloaded function.

Calls C++ function: unsigned int QImage::pixel(int x, int y) const.

C++ documentation:

This is an overloaded function.

Returns the color of the pixel at coordinates (x, y).

pub unsafe fn pixel_1a(&self, pt: impl CastInto<Ref<QPoint>>) -> c_uint[src]

Returns the color of the pixel at the given position.

Calls C++ function: unsigned int QImage::pixel(const QPoint& pt) const.

C++ documentation:

Returns the color of the pixel at the given position.

If the position is not valid, the results are undefined.

Warning: This function is expensive when used for massive pixel manipulations. Use constBits() or constScanLine() when many pixels needs to be read.

See also setPixel(), valid(), constBits(), constScanLine(), and Pixel Manipulation.

pub unsafe fn pixel_color_2a(&self, x: c_int, y: c_int) -> CppBox<QColor>[src]

This is an overloaded function.

Calls C++ function: QColor QImage::pixelColor(int x, int y) const.

C++ documentation:

This is an overloaded function.

Returns the color of the pixel at coordinates (x, y) as a QColor.

This function was introduced in Qt 5.6.

pub unsafe fn pixel_color_1a(
    &self,
    pt: impl CastInto<Ref<QPoint>>
) -> CppBox<QColor>
[src]

Returns the color of the pixel at the given position as a QColor.

Calls C++ function: QColor QImage::pixelColor(const QPoint& pt) const.

C++ documentation:

Returns the color of the pixel at the given position as a QColor.

If the position is not valid, an invalid QColor is returned.

Warning: This function is expensive when used for massive pixel manipulations. Use constBits() or constScanLine() when many pixels needs to be read.

This function was introduced in Qt 5.6.

See also setPixelColor(), setPixel(), valid(), constBits(), constScanLine(), and Pixel Manipulation.

pub unsafe fn pixel_format(&self) -> CppBox<QPixelFormat>[src]

Returns the QImage::Format as a QPixelFormat

Calls C++ function: QPixelFormat QImage::pixelFormat() const.

C++ documentation:

Returns the QImage::Format as a QPixelFormat

pub unsafe fn pixel_index_2a(&self, x: c_int, y: c_int) -> c_int[src]

This is an overloaded function.

Calls C++ function: int QImage::pixelIndex(int x, int y) const.

C++ documentation:

This is an overloaded function.

Returns the pixel index at (x, y).

pub unsafe fn pixel_index_1a(&self, pt: impl CastInto<Ref<QPoint>>) -> c_int[src]

Returns the pixel index at the given position.

Calls C++ function: int QImage::pixelIndex(const QPoint& pt) const.

C++ documentation:

Returns the pixel index at the given position.

If position is not valid, or if the image is not a paletted image (depth() > 8), the results are undefined.

See also valid(), depth(), and Pixel Manipulation.

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

Returns the enclosing rectangle (0, 0, width(), height()) of the image.

Calls C++ function: QRect QImage::rect() const.

C++ documentation:

Returns the enclosing rectangle (0, 0, width(), height()) of the image.

See also Image Information.

pub unsafe fn reinterpret_as_format(&mut self, f: Format) -> bool[src]

Changes the format of the image without changing the data. Only works between formats of the same depth.

Calls C++ function: bool QImage::reinterpretAsFormat(QImage::Format f).

C++ documentation:

Changes the format of the image without changing the data. Only works between formats of the same depth.

Returns true if successful.

This function can be used to change images with alpha-channels to their corresponding opaque formats if the data is known to be opaque-only, or to change the format of a given image buffer before overwriting it with new data.

Warning: The function does not check if the image data is valid in the new format and will still return true if the depths are compatible. Operations on an image with invalid data are undefined.

Warning: If the image is not detached, this will cause the data to be copied.

This function was introduced in Qt 5.9.

See also hasAlphaChannel() and convertToFormat().

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

Returns a QImage in which the values of the red and blue components of all pixels have been swapped, effectively converting an RGB image to an BGR image.

Calls C++ function: QImage QImage::rgbSwapped() const.

C++ documentation:

Returns a QImage in which the values of the red and blue components of all pixels have been swapped, effectively converting an RGB image to an BGR image.

The original QImage is not changed.

See also Image Transformations.

pub unsafe fn save_q_string_char_int(
    &self,
    file_name: impl CastInto<Ref<QString>>,
    format: impl CastInto<Ptr<c_char>>,
    quality: c_int
) -> bool
[src]

Saves the image to the file with the given fileName, using the given image file format and quality factor. If format is 0, QImage will attempt to guess the format by looking at fileName's suffix.

Calls C++ function: bool QImage::save(const QString& fileName, const char* format = …, int quality = …) const.

C++ documentation:

Saves the image to the file with the given fileName, using the given image file format and quality factor. If format is 0, QImage will attempt to guess the format by looking at fileName's suffix.

The quality factor must be in the range 0 to 100 or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 (the default) to use the default settings.

Returns true if the image was successfully saved; otherwise returns false.

See also Reading and Writing Image Files.

pub unsafe fn save_q_io_device_char_int(
    &self,
    device: impl CastInto<MutPtr<QIODevice>>,
    format: impl CastInto<Ptr<c_char>>,
    quality: c_int
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QImage::save(QIODevice* device, const char* format = …, int quality = …) const.

C++ documentation:

This is an overloaded function.

This function writes a QImage to the given device.

This can, for example, be used to save an image directly into a QByteArray:

QImage image; QByteArray ba; QBuffer buffer(&ba); buffer.open(QIODevice::WriteOnly); image.save(&buffer, "PNG"); // writes image into ba in PNG format

pub unsafe fn save_q_string_char(
    &self,
    file_name: impl CastInto<Ref<QString>>,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

Saves the image to the file with the given fileName, using the given image file format and quality factor. If format is 0, QImage will attempt to guess the format by looking at fileName's suffix.

Calls C++ function: bool QImage::save(const QString& fileName, const char* format = …) const.

C++ documentation:

Saves the image to the file with the given fileName, using the given image file format and quality factor. If format is 0, QImage will attempt to guess the format by looking at fileName's suffix.

The quality factor must be in the range 0 to 100 or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 (the default) to use the default settings.

Returns true if the image was successfully saved; otherwise returns false.

See also Reading and Writing Image Files.

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

Saves the image to the file with the given fileName, using the given image file format and quality factor. If format is 0, QImage will attempt to guess the format by looking at fileName's suffix.

Calls C++ function: bool QImage::save(const QString& fileName) const.

C++ documentation:

Saves the image to the file with the given fileName, using the given image file format and quality factor. If format is 0, QImage will attempt to guess the format by looking at fileName's suffix.

The quality factor must be in the range 0 to 100 or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 (the default) to use the default settings.

Returns true if the image was successfully saved; otherwise returns false.

See also Reading and Writing Image Files.

pub unsafe fn save_q_io_device_char(
    &self,
    device: impl CastInto<MutPtr<QIODevice>>,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QImage::save(QIODevice* device, const char* format = …) const.

C++ documentation:

This is an overloaded function.

This function writes a QImage to the given device.

This can, for example, be used to save an image directly into a QByteArray:

QImage image; QByteArray ba; QBuffer buffer(&ba); buffer.open(QIODevice::WriteOnly); image.save(&buffer, "PNG"); // writes image into ba in PNG format

pub unsafe fn save_q_io_device(
    &self,
    device: impl CastInto<MutPtr<QIODevice>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QImage::save(QIODevice* device) const.

C++ documentation:

This is an overloaded function.

This function writes a QImage to the given device.

This can, for example, be used to save an image directly into a QByteArray:

QImage image; QByteArray ba; QBuffer buffer(&ba); buffer.open(QIODevice::WriteOnly); image.save(&buffer, "PNG"); // writes image into ba in PNG format

pub unsafe fn scaled_2_int_aspect_ratio_mode_transformation_mode(
    &self,
    w: c_int,
    h: c_int,
    aspect_mode: AspectRatioMode,
    mode: TransformationMode
) -> CppBox<QImage>
[src]

This is an overloaded function.

Calls C++ function: QImage QImage::scaled(int w, int h, Qt::AspectRatioMode aspectMode = …, Qt::TransformationMode mode = …) const.

C++ documentation:

This is an overloaded function.

Returns a copy of the image scaled to a rectangle with the given width and height according to the given aspectRatioMode and transformMode.

If either the width or the height is zero or negative, this function returns a null image.

pub unsafe fn scaled_q_size_aspect_ratio_mode_transformation_mode(
    &self,
    s: impl CastInto<Ref<QSize>>,
    aspect_mode: AspectRatioMode,
    mode: TransformationMode
) -> CppBox<QImage>
[src]

Returns a copy of the image scaled to a rectangle defined by the given size according to the given aspectRatioMode and transformMode.

Calls C++ function: QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode = …, Qt::TransformationMode mode = …) const.

C++ documentation:

Returns a copy of the image scaled to a rectangle defined by the given size according to the given aspectRatioMode and transformMode.

  • If aspectRatioMode is Qt::IgnoreAspectRatio, the image is scaled to size.
  • If aspectRatioMode is Qt::KeepAspectRatio, the image is scaled to a rectangle as large as possible inside size, preserving the aspect ratio.
  • If aspectRatioMode is Qt::KeepAspectRatioByExpanding, the image is scaled to a rectangle as small as possible outside size, preserving the aspect ratio.

If the given size is empty, this function returns a null image.

See also isNull() and Image Transformations.

pub unsafe fn scaled_2_int_aspect_ratio_mode(
    &self,
    w: c_int,
    h: c_int,
    aspect_mode: AspectRatioMode
) -> CppBox<QImage>
[src]

This is an overloaded function.

Calls C++ function: QImage QImage::scaled(int w, int h, Qt::AspectRatioMode aspectMode = …) const.

C++ documentation:

This is an overloaded function.

Returns a copy of the image scaled to a rectangle with the given width and height according to the given aspectRatioMode and transformMode.

If either the width or the height is zero or negative, this function returns a null image.

pub unsafe fn scaled_2_int(&self, w: c_int, h: c_int) -> CppBox<QImage>[src]

This is an overloaded function.

Calls C++ function: QImage QImage::scaled(int w, int h) const.

C++ documentation:

This is an overloaded function.

Returns a copy of the image scaled to a rectangle with the given width and height according to the given aspectRatioMode and transformMode.

If either the width or the height is zero or negative, this function returns a null image.

pub unsafe fn scaled_q_size_aspect_ratio_mode(
    &self,
    s: impl CastInto<Ref<QSize>>,
    aspect_mode: AspectRatioMode
) -> CppBox<QImage>
[src]

Returns a copy of the image scaled to a rectangle defined by the given size according to the given aspectRatioMode and transformMode.

Calls C++ function: QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode = …) const.

C++ documentation:

Returns a copy of the image scaled to a rectangle defined by the given size according to the given aspectRatioMode and transformMode.

  • If aspectRatioMode is Qt::IgnoreAspectRatio, the image is scaled to size.
  • If aspectRatioMode is Qt::KeepAspectRatio, the image is scaled to a rectangle as large as possible inside size, preserving the aspect ratio.
  • If aspectRatioMode is Qt::KeepAspectRatioByExpanding, the image is scaled to a rectangle as small as possible outside size, preserving the aspect ratio.

If the given size is empty, this function returns a null image.

See also isNull() and Image Transformations.

pub unsafe fn scaled_q_size(
    &self,
    s: impl CastInto<Ref<QSize>>
) -> CppBox<QImage>
[src]

Returns a copy of the image scaled to a rectangle defined by the given size according to the given aspectRatioMode and transformMode.

Calls C++ function: QImage QImage::scaled(const QSize& s) const.

C++ documentation:

Returns a copy of the image scaled to a rectangle defined by the given size according to the given aspectRatioMode and transformMode.

  • If aspectRatioMode is Qt::IgnoreAspectRatio, the image is scaled to size.
  • If aspectRatioMode is Qt::KeepAspectRatio, the image is scaled to a rectangle as large as possible inside size, preserving the aspect ratio.
  • If aspectRatioMode is Qt::KeepAspectRatioByExpanding, the image is scaled to a rectangle as small as possible outside size, preserving the aspect ratio.

If the given size is empty, this function returns a null image.

See also isNull() and Image Transformations.

pub unsafe fn scaled_to_height_2a(
    &self,
    h: c_int,
    mode: TransformationMode
) -> CppBox<QImage>
[src]

Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformation mode.

Calls C++ function: QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode = …) const.

C++ documentation:

Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformation mode.

This function automatically calculates the width of the image so that the ratio of the image is preserved.

If the given height is 0 or negative, a null image is returned.

See also Image Transformations.

pub unsafe fn scaled_to_height_1a(&self, h: c_int) -> CppBox<QImage>[src]

Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformation mode.

Calls C++ function: QImage QImage::scaledToHeight(int h) const.

C++ documentation:

Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformation mode.

This function automatically calculates the width of the image so that the ratio of the image is preserved.

If the given height is 0 or negative, a null image is returned.

See also Image Transformations.

pub unsafe fn scaled_to_width_2a(
    &self,
    w: c_int,
    mode: TransformationMode
) -> CppBox<QImage>
[src]

Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformation mode.

Calls C++ function: QImage QImage::scaledToWidth(int w, Qt::TransformationMode mode = …) const.

C++ documentation:

Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformation mode.

This function automatically calculates the height of the image so that its aspect ratio is preserved.

If the given width is 0 or negative, a null image is returned.

See also Image Transformations.

pub unsafe fn scaled_to_width_1a(&self, w: c_int) -> CppBox<QImage>[src]

Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformation mode.

Calls C++ function: QImage QImage::scaledToWidth(int w) const.

C++ documentation:

Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformation mode.

This function automatically calculates the height of the image so that its aspect ratio is preserved.

If the given width is 0 or negative, a null image is returned.

See also Image Transformations.

pub unsafe fn scan_line_mut(&mut self, arg1: c_int) -> MutPtr<c_uchar>[src]

Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0.

Calls C++ function: unsigned char* QImage::scanLine(int arg1).

C++ documentation:

Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0.

The scanline data is aligned on a 32-bit boundary.

Warning: If you are accessing 32-bpp image data, cast the returned pointer to QRgb* (QRgb has a 32-bit size) and use it to read/write the pixel value. You cannot use the uchar* pointer directly, because the pixel format depends on the byte order on the underlying platform. Use qRed(), qGreen(), qBlue(), and qAlpha() to access the pixels.

See also bytesPerLine(), bits(), Pixel Manipulation, and constScanLine().

pub unsafe fn scan_line(&self, arg1: c_int) -> Ptr<c_uchar>[src]

Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0.

Calls C++ function: const unsigned char* QImage::scanLine(int arg1) const.

C++ documentation:

Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0.

The scanline data is aligned on a 32-bit boundary.

Warning: If you are accessing 32-bpp image data, cast the returned pointer to QRgb* (QRgb has a 32-bit size) and use it to read/write the pixel value. You cannot use the uchar* pointer directly, because the pixel format depends on the byte order on the underlying platform. Use qRed(), qGreen(), qBlue(), and qAlpha() to access the pixels.

See also bytesPerLine(), bits(), Pixel Manipulation, and constScanLine().

pub unsafe fn set_alpha_channel(
    &mut self,
    alpha_channel: impl CastInto<Ref<QImage>>
)
[src]

Sets the alpha channel of this image to the given alphaChannel.

Calls C++ function: void QImage::setAlphaChannel(const QImage& alphaChannel).

C++ documentation:

Sets the alpha channel of this image to the given alphaChannel.

If alphaChannel is an 8 bit grayscale image, the intensity values are written into this buffer directly. Otherwise, alphaChannel is converted to 32 bit and the intensity of the RGB pixel values is used.

Note that the image will be converted to the Format_ARGB32_Premultiplied format if the function succeeds.

Use one of the composition modes in QPainter::CompositionMode instead.

Warning: This function is expensive.

See also alphaChannel(), Image Transformations, and Image Formats.

pub unsafe fn set_color(&mut self, i: c_int, c: c_uint)[src]

Sets the color at the given index in the color table, to the given to colorValue. The color value is an ARGB quadruplet.

Calls C++ function: void QImage::setColor(int i, unsigned int c).

C++ documentation:

Sets the color at the given index in the color table, to the given to colorValue. The color value is an ARGB quadruplet.

If index is outside the current size of the color table, it is expanded with setColorCount().

See also color(), colorCount(), setColorTable(), and Pixel Manipulation.

pub unsafe fn set_color_count(&mut self, arg1: c_int)[src]

Resizes the color table to contain colorCount entries.

Calls C++ function: void QImage::setColorCount(int arg1).

C++ documentation:

Resizes the color table to contain colorCount entries.

If the color table is expanded, all the extra colors will be set to transparent (i.e qRgba(0, 0, 0, 0)).

When the image is used, the color table must be large enough to have entries for all the pixel/index values present in the image, otherwise the results are undefined.

This function was introduced in Qt 4.6.

See also colorCount(), colorTable(), setColor(), and Image Transformations.

pub unsafe fn set_color_table(
    &mut self,
    colors: impl CastInto<Ref<QVectorOfUint>>
)
[src]

Sets the color table used to translate color indexes to QRgb values, to the specified colors.

Calls C++ function: void QImage::setColorTable(QVector<unsigned int> colors).

C++ documentation:

Sets the color table used to translate color indexes to QRgb values, to the specified colors.

When the image is used, the color table must be large enough to have entries for all the pixel/index values present in the image, otherwise the results are undefined.

See also colorTable(), setColor(), and Image Transformations.

pub unsafe fn set_device_pixel_ratio(&mut self, scale_factor: c_double)[src]

Sets the device pixel ratio for the image. This is the ratio between image pixels and device-independent pixels.

Calls C++ function: void QImage::setDevicePixelRatio(double scaleFactor).

C++ documentation:

Sets the device pixel ratio for the image. This is the ratio between image pixels and device-independent pixels.

The default scaleFactor is 1.0. Setting it to something else has two effects:

QPainters that are opened on the image will be scaled. For example, painting on a 200x200 image if with a ratio of 2.0 will result in effective (device-independent) painting bounds of 100x100.

Code paths in Qt that calculate layout geometry based on the image size will take the ratio into account: QSize layoutSize = image.size() / image.devicePixelRatio() The net effect of this is that the image is displayed as high-DPI image rather than a large image (see Drawing High Resolution Versions of Pixmaps and Images).

See also devicePixelRatio().

pub unsafe fn set_dots_per_meter_x(&mut self, arg1: c_int)[src]

Sets the number of pixels that fit horizontally in a physical meter, to x.

Calls C++ function: void QImage::setDotsPerMeterX(int arg1).

C++ documentation:

Sets the number of pixels that fit horizontally in a physical meter, to x.

Together with dotsPerMeterY(), this number defines the intended scale and aspect ratio of the image, and determines the scale at which QPainter will draw graphics on the image. It does not change the scale or aspect ratio of the image when it is rendered on other paint devices.

See also dotsPerMeterX() and Image Information.

pub unsafe fn set_dots_per_meter_y(&mut self, arg1: c_int)[src]

Sets the number of pixels that fit vertically in a physical meter, to y.

Calls C++ function: void QImage::setDotsPerMeterY(int arg1).

C++ documentation:

Sets the number of pixels that fit vertically in a physical meter, to y.

Together with dotsPerMeterX(), this number defines the intended scale and aspect ratio of the image, and determines the scale at which QPainter will draw graphics on the image. It does not change the scale or aspect ratio of the image when it is rendered on other paint devices.

See also dotsPerMeterY() and Image Information.

pub unsafe fn set_offset(&mut self, arg1: impl CastInto<Ref<QPoint>>)[src]

Sets the number of pixels by which the image is intended to be offset by when positioning relative to other images, to offset.

Calls C++ function: void QImage::setOffset(const QPoint& arg1).

C++ documentation:

Sets the number of pixels by which the image is intended to be offset by when positioning relative to other images, to offset.

See also offset() and Image Information.

pub unsafe fn set_pixel_3a(&mut self, x: c_int, y: c_int, index_or_rgb: c_uint)[src]

This is an overloaded function.

Calls C++ function: void QImage::setPixel(int x, int y, unsigned int index_or_rgb).

C++ documentation:

This is an overloaded function.

Sets the pixel index or color at (x, y) to index_or_rgb.

pub unsafe fn set_pixel_2a(
    &mut self,
    pt: impl CastInto<Ref<QPoint>>,
    index_or_rgb: c_uint
)
[src]

Sets the pixel index or color at the given position to index_or_rgb.

Calls C++ function: void QImage::setPixel(const QPoint& pt, unsigned int index_or_rgb).

C++ documentation:

Sets the pixel index or color at the given position to index_or_rgb.

If the image's format is either monochrome or paletted, the given index_or_rgb value must be an index in the image's color table, otherwise the parameter must be a QRgb value.

If position is not a valid coordinate pair in the image, or if index_or_rgb >= colorCount() in the case of monochrome and paletted images, the result is undefined.

Warning: This function is expensive due to the call of the internal detach() function called within; if performance is a concern, we recommend the use of scanLine() or bits() to access pixel data directly.

See also pixel() and Pixel Manipulation.

pub unsafe fn set_pixel_color_3a(
    &mut self,
    x: c_int,
    y: c_int,
    c: impl CastInto<Ref<QColor>>
)
[src]

This is an overloaded function.

Calls C++ function: void QImage::setPixelColor(int x, int y, const QColor& c).

C++ documentation:

This is an overloaded function.

Sets the pixel color at (x, y) to color.

This function was introduced in Qt 5.6.

pub unsafe fn set_pixel_color_2a(
    &mut self,
    pt: impl CastInto<Ref<QPoint>>,
    c: impl CastInto<Ref<QColor>>
)
[src]

Sets the color at the given position to color.

Calls C++ function: void QImage::setPixelColor(const QPoint& pt, const QColor& c).

C++ documentation:

Sets the color at the given position to color.

If position is not a valid coordinate pair in the image, or the image's format is either monochrome or paletted, the result is undefined.

Warning: This function is expensive due to the call of the internal detach() function called within; if performance is a concern, we recommend the use of scanLine() or bits() to access pixel data directly.

This function was introduced in Qt 5.6.

See also pixelColor(), pixel(), bits(), scanLine(), and Pixel Manipulation.

pub unsafe fn set_text(
    &mut self,
    key: impl CastInto<Ref<QString>>,
    value: impl CastInto<Ref<QString>>
)
[src]

Sets the image text to the given text and associate it with the given key. The text is recorded in the specified language, or in a default language if language is 0.

Calls C++ function: void QImage::setText(const QString& key, const QString& value).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for void QImage::setText(const char *key, const char *language, const QString &text):

Sets the image text to the given text and associate it with the given key. The text is recorded in the specified language, or in a default language if language is 0.

Use setText() instead.

The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.

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

Returns the size of the image, i.e. its width() and height().

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

C++ documentation:

Returns the size of the image, i.e. its width() and height().

See also Image Information.

pub unsafe fn size_in_bytes(&self) -> c_longlong[src]

Returns the image data size in bytes.

Calls C++ function: long long QImage::sizeInBytes() const.

C++ documentation:

Returns the image data size in bytes.

This function was introduced in Qt 5.10.

See also byteCount(), bytesPerLine(), bits(), and Image Information.

This item is available if any(cpp_lib_version="5.11.3", cpp_lib_version="5.12.2", cpp_lib_version="5.13.0").

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

This item is available if any(cpp_lib_version="5.12.2", cpp_lib_version="5.13.0").

pub unsafe fn swap(&mut self, other: impl CastInto<MutRef<QImage>>)[src]

Swaps image other with this image. This operation is very fast and never fails.

Calls C++ function: void QImage::swap(QImage& other).

C++ documentation:

Swaps image other with this image. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

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

Returns the text recorded for the given key in the given language, or in a default language if language is 0.

Calls C++ function: QString QImage::text(const QString& key = …) const.

Warning: no exact match found in C++ documentation. Below is the C++ documentation for QString QImage::text(const char *key, const char *language = Q_NULLPTR) const:

Returns the text recorded for the given key in the given language, or in a default language if language is 0.

Use text() instead.

The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.

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

Returns the text recorded for the given key in the given language, or in a default language if language is 0.

Calls C++ function: QString QImage::text() const.

Warning: no exact match found in C++ documentation. Below is the C++ documentation for QString QImage::text(const char *key, const char *language = Q_NULLPTR) const:

Returns the text recorded for the given key in the given language, or in a default language if language is 0.

Use text() instead.

The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.

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

Returns the text keys for this image.

Calls C++ function: QStringList QImage::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.

See also text().

pub unsafe fn to_image_format(
    format: impl CastInto<Ref<QPixelFormat>>
) -> Format
[src]

Converts format into a QImage::Format

Calls C++ function: static QImage::Format QImage::toImageFormat(QPixelFormat format).

C++ documentation:

Converts format into a QImage::Format

pub unsafe fn to_pixel_format(format: Format) -> CppBox<QPixelFormat>[src]

Converts format into a QPixelFormat

Calls C++ function: static QPixelFormat QImage::toPixelFormat(QImage::Format format).

C++ documentation:

Converts format into a QPixelFormat

pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>[src]

Returns the image as a QVariant.

Calls C++ function: QVariant QImage::operator QVariant() const.

C++ documentation:

Returns the image as a QVariant.

pub unsafe fn transformed_q_matrix_transformation_mode(
    &self,
    matrix: impl CastInto<Ref<QMatrix>>,
    mode: TransformationMode
) -> CppBox<QImage>
[src]

Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.

Calls C++ function: QImage QImage::transformed(const QMatrix& matrix, Qt::TransformationMode mode = …) const.

C++ documentation:

Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.

The transformation matrix is internally adjusted to compensate for unwanted translation; i.e. the image produced is the smallest image that contains all the transformed points of the original image. Use the trueMatrix() function to retrieve the actual matrix used for transforming an image.

See also trueMatrix() and Image Transformations.

pub unsafe fn transformed_q_transform_transformation_mode(
    &self,
    matrix: impl CastInto<Ref<QTransform>>,
    mode: TransformationMode
) -> CppBox<QImage>
[src]

Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.

Calls C++ function: QImage QImage::transformed(const QTransform& matrix, Qt::TransformationMode mode = …) const.

C++ documentation:

Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.

The transformation matrix is internally adjusted to compensate for unwanted translation; i.e. the image produced is the smallest image that contains all the transformed points of the original image. Use the trueMatrix() function to retrieve the actual matrix used for transforming an image.

Unlike the other overload, this function can be used to perform perspective transformations on images.

See also trueMatrix() and Image Transformations.

pub unsafe fn transformed_q_matrix(
    &self,
    matrix: impl CastInto<Ref<QMatrix>>
) -> CppBox<QImage>
[src]

Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.

Calls C++ function: QImage QImage::transformed(const QMatrix& matrix) const.

C++ documentation:

Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.

The transformation matrix is internally adjusted to compensate for unwanted translation; i.e. the image produced is the smallest image that contains all the transformed points of the original image. Use the trueMatrix() function to retrieve the actual matrix used for transforming an image.

See also trueMatrix() and Image Transformations.

pub unsafe fn transformed_q_transform(
    &self,
    matrix: impl CastInto<Ref<QTransform>>
) -> CppBox<QImage>
[src]

Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.

Calls C++ function: QImage QImage::transformed(const QTransform& matrix) const.

C++ documentation:

Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.

The transformation matrix is internally adjusted to compensate for unwanted translation; i.e. the image produced is the smallest image that contains all the transformed points of the original image. Use the trueMatrix() function to retrieve the actual matrix used for transforming an image.

Unlike the other overload, this function can be used to perform perspective transformations on images.

See also trueMatrix() and Image Transformations.

pub unsafe fn true_matrix_q_matrix2_int(
    arg1: impl CastInto<Ref<QMatrix>>,
    w: c_int,
    h: c_int
) -> CppBox<QMatrix>
[src]

Returns the actual matrix used for transforming an image with the given width, height and matrix.

Calls C++ function: static QMatrix QImage::trueMatrix(const QMatrix& arg1, int w, int h).

C++ documentation:

Returns the actual matrix used for transforming an image with the given width, height and matrix.

When transforming an image using the transformed() function, the transformation matrix is internally adjusted to compensate for unwanted translation, i.e. transformed() returns the smallest image containing all transformed points of the original image. This function returns the modified matrix, which maps points correctly from the original image into the new image.

See also transformed() and Image Transformations.

pub unsafe fn true_matrix_q_transform2_int(
    arg1: impl CastInto<Ref<QTransform>>,
    w: c_int,
    h: c_int
) -> CppBox<QTransform>
[src]

Returns the actual matrix used for transforming an image with the given width, height and matrix.

Calls C++ function: static QTransform QImage::trueMatrix(const QTransform& arg1, int w, int h).

C++ documentation:

Returns the actual matrix used for transforming an image with the given width, height and matrix.

When transforming an image using the transformed() function, the transformation matrix is internally adjusted to compensate for unwanted translation, i.e. transformed() returns the smallest image containing all transformed points of the original image. This function returns the modified matrix, which maps points correctly from the original image into the new image.

Unlike the other overload, this function creates transformation matrices that can be used to perform perspective transformations on images.

See also transformed() and Image Transformations.

pub unsafe fn valid_2a(&self, x: c_int, y: c_int) -> bool[src]

This is an overloaded function.

Calls C++ function: bool QImage::valid(int x, int y) const.

C++ documentation:

This is an overloaded function.

Returns true if QPoint(x, y) is a valid coordinate pair within the image; otherwise returns false.

pub unsafe fn valid_1a(&self, pt: impl CastInto<Ref<QPoint>>) -> bool[src]

Returns true if pos is a valid coordinate pair within the image; otherwise returns false.

Calls C++ function: bool QImage::valid(const QPoint& pt) const.

C++ documentation:

Returns true if pos is a valid coordinate pair within the image; otherwise returns false.

See also rect() and QRect::contains().

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

Returns the width of the image.

Calls C++ function: int QImage::width() const.

C++ documentation:

Returns the width of the image.

See also Image Information.

Methods from Deref<Target = QPaintDevice>

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

Returns the number of different colors available for the paint device. If the number of colors available is too great to be represented by the int data type, then INT_MAX will be returned instead.

Calls C++ function: int QPaintDevice::colorCount() const.

C++ documentation:

Returns the number of different colors available for the paint device. If the number of colors available is too great to be represented by the int data type, then INT_MAX will be returned instead.

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

Returns the bit depth (number of bit planes) of the paint device.

Calls C++ function: int QPaintDevice::depth() const.

C++ documentation:

Returns the bit depth (number of bit planes) of the paint device.

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

Calls C++ function: virtual int QPaintDevice::devType() const.

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

Returns the device pixel ratio for device.

Calls C++ function: int QPaintDevice::devicePixelRatio() const.

C++ documentation:

Returns the device pixel ratio for device.

Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.

pub unsafe fn device_pixel_ratio_f(&self) -> c_double[src]

Returns the device pixel ratio for the device as a floating point number.

Calls C++ function: double QPaintDevice::devicePixelRatioF() const.

C++ documentation:

Returns the device pixel ratio for the device as a floating point number.

This function was introduced in Qt 5.6.

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

Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

Calls C++ function: int QPaintDevice::height() const.

C++ documentation:

Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

See also heightMM().

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

Returns the height of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

Calls C++ function: int QPaintDevice::heightMM() const.

C++ documentation:

Returns the height of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

See also height().

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

Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from widthMM().

Calls C++ function: int QPaintDevice::logicalDpiX() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from widthMM().

Note that if the logicalDpiX() doesn't equal the physicalDpiX(), the corresponding QPaintEngine must handle the resolution mapping.

See also logicalDpiY() and physicalDpiX().

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

Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from heightMM().

Calls C++ function: int QPaintDevice::logicalDpiY() const.

C++ documentation:

Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from heightMM().

Note that if the logicalDpiY() doesn't equal the physicalDpiY(), the corresponding QPaintEngine must handle the resolution mapping.

See also logicalDpiX() and physicalDpiY().

pub unsafe fn paint_engine(&self) -> MutPtr<QPaintEngine>[src]

Returns a pointer to the paint engine used for drawing on the device.

Calls C++ function: pure virtual QPaintEngine* QPaintDevice::paintEngine() const.

C++ documentation:

Returns a pointer to the paint engine used for drawing on the device.

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

Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

Calls C++ function: bool QPaintDevice::paintingActive() const.

C++ documentation:

Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

See also QPainter::isActive().

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

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Calls C++ function: int QPaintDevice::physicalDpiX() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Note that if the physicalDpiX() doesn't equal the logicalDpiX(), the corresponding QPaintEngine must handle the resolution mapping.

See also physicalDpiY() and logicalDpiX().

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

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Calls C++ function: int QPaintDevice::physicalDpiY() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Note that if the physicalDpiY() doesn't equal the logicalDpiY(), the corresponding QPaintEngine must handle the resolution mapping.

See also physicalDpiX() and logicalDpiY().

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

Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

Calls C++ function: int QPaintDevice::width() const.

C++ documentation:

Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

See also widthMM().

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

Returns the width of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

Calls C++ function: int QPaintDevice::widthMM() const.

C++ documentation:

Returns the width of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

See also width().

Trait Implementations

impl CppDeletable for QImage[src]

unsafe fn delete(&mut self)[src]

Destroys the image and cleans up.

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

C++ documentation:

Destroys the image and cleans up.

impl Deref for QImage[src]

type Target = QPaintDevice

The resulting type after dereferencing.

fn deref(&self) -> &QPaintDevice[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QImage* ptr).

impl DerefMut for QImage[src]

fn deref_mut(&mut self) -> &mut QPaintDevice[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QImage* ptr).

impl DynamicCast<QImage> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QImage>[src]

Calls C++ function: QImage* dynamic_cast<QImage*>(QPaintDevice* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QPaintDevice>) -> MutPtr<QImage>[src]

Calls C++ function: QImage* dynamic_cast<QImage*>(QPaintDevice* ptr).

impl PartialEq<Ref<QImage>> for QImage[src]

fn eq(&self, arg1: &Ref<QImage>) -> bool[src]

Returns true if this image and the given image have the same contents; otherwise returns false.

Calls C++ function: bool QImage::operator==(const QImage& arg1) const.

C++ documentation:

Returns true if this image and the given image have the same contents; otherwise returns false.

The comparison can be slow, unless there is some obvious difference (e.g. different size or format), in which case the function will return quickly.

See also operator=().

impl Size for QImage[src]

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

Returns the size of the image, i.e. its width() and height().

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

C++ documentation:

Returns the size of the image, i.e. its width() and height().

See also Image Information.

impl StaticDowncast<QImage> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QImage>[src]

Calls C++ function: QImage* static_cast<QImage*>(QPaintDevice* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QPaintDevice>) -> MutPtr<QImage>[src]

Calls C++ function: QImage* static_cast<QImage*>(QPaintDevice* ptr).

impl StaticUpcast<QPaintDevice> for QImage[src]

unsafe fn static_upcast(ptr: Ptr<QImage>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QImage* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QImage>) -> MutPtr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QImage* ptr).

Auto Trait Implementations

impl RefUnwindSafe for QImage

impl Send for QImage

impl Sync for QImage

impl Unpin for QImage

impl UnwindSafe for QImage

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.