Struct qt_gui::QBitmap

source ·
#[repr(C)]
pub struct QBitmap { /* private fields */ }
Expand description

The QBitmap class provides monochrome (1-bit depth) pixmaps.

C++ class: QBitmap.

C++ documentation:

The QBitmap class provides monochrome (1-bit depth) pixmaps.

The QBitmap class is a monochrome off-screen paint device used mainly for creating custom QCursor and QBrush objects, constructing QRegion objects, and for setting masks for pixmaps and widgets.

QBitmap is a QPixmap subclass ensuring a depth of 1, except for null objects which have a depth of 0. If a pixmap with a depth greater than 1 is assigned to a bitmap, the bitmap will be dithered automatically.

Use the QColor objects Qt::color0 and Qt::color1 when drawing on a QBitmap object (or a QPixmap object with depth 1).

Painting with Qt::color0 sets the bitmap bits to 0, and painting with Qt::color1 sets the bits to 1. For a bitmap, 0-bits indicate background (or transparent pixels) and 1-bits indicate foreground (or opaque pixels). Use the clear() function to set all the bits to Qt::color0. Note that using the Qt::black and Qt::white colors make no sense because the QColor::pixel() value is not necessarily 0 for black and 1 for white.

The QBitmap class provides the transformed() function returning a transformed copy of the bitmap; use the QTransform argument to translate, scale, shear, and rotate the bitmap. In addition, QBitmap provides the static fromData() function which returns a bitmap constructed from the given uchar data, and the static fromImage() function returning a converted copy of a QImage object.

Just like the QPixmap class, QBitmap is optimized by the use of implicit data sharing. For more information, see the Implicit Data Sharing documentation.

Implementations§

source§

impl QBitmap

source

pub unsafe fn clear(&self)

Clears the bitmap, setting all its bits to Qt::color0.

Calls C++ function: void QBitmap::clear().

C++ documentation:

Clears the bitmap, setting all its bits to Qt::color0.

source

pub unsafe fn copy_from_q_bitmap( &self, other: impl CastInto<Ref<QBitmap>> ) -> Ref<QBitmap>

Copy-assignment operator.

Calls C++ function: QBitmap& QBitmap::operator=(const QBitmap& other).

C++ documentation:

Copy-assignment operator.

source

pub unsafe fn copy_from_q_pixmap( &self, arg1: impl CastInto<Ref<QPixmap>> ) -> Ref<QBitmap>

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Assigns the given pixmap to this bitmap and returns a reference to this bitmap.

If the pixmap has a depth greater than 1, the resulting bitmap will be dithered automatically.

See also QPixmap::depth().

source

pub unsafe fn from_data_3a( size: impl CastInto<Ref<QSize>>, bits: *const c_uchar, mono_format: Format ) -> CppBox<QBitmap>

Constructs a bitmap with the given size, and sets the contents to the bits supplied.

Calls C++ function: static QBitmap QBitmap::fromData(const QSize& size, const unsigned char* bits, QImage::Format monoFormat = …).

C++ documentation:

Constructs a bitmap with the given size, and sets the contents to the bits supplied.

The bitmap data has to be byte aligned and provided in in the bit order specified by monoFormat. The mono format must be either QImage::Format_Mono or QImage::Format_MonoLSB. Use QImage::Format_Mono to specify data on the XBM format.

See also fromImage().

source

pub unsafe fn from_data_2a( size: impl CastInto<Ref<QSize>>, bits: *const c_uchar ) -> CppBox<QBitmap>

Constructs a bitmap with the given size, and sets the contents to the bits supplied.

Calls C++ function: static QBitmap QBitmap::fromData(const QSize& size, const unsigned char* bits).

C++ documentation:

Constructs a bitmap with the given size, and sets the contents to the bits supplied.

The bitmap data has to be byte aligned and provided in in the bit order specified by monoFormat. The mono format must be either QImage::Format_Mono or QImage::Format_MonoLSB. Use QImage::Format_Mono to specify data on the XBM format.

See also fromImage().

source

pub unsafe fn from_image_2a( image: impl CastInto<Ref<QImage>>, flags: QFlags<ImageConversionFlag> ) -> CppBox<QBitmap>

Returns a copy of the given image converted to a bitmap using the specified image conversion flags.

Calls C++ function: static QBitmap QBitmap::fromImage(const QImage& image, QFlags<Qt::ImageConversionFlag> flags = …).

C++ documentation:

Returns a copy of the given image converted to a bitmap using the specified image conversion flags.

See also fromData().

source

pub unsafe fn from_image_1a( image: impl CastInto<Ref<QImage>> ) -> CppBox<QBitmap>

Returns a copy of the given image converted to a bitmap using the specified image conversion flags.

Calls C++ function: static QBitmap QBitmap::fromImage(const QImage& image).

C++ documentation:

Returns a copy of the given image converted to a bitmap using the specified image conversion flags.

See also fromData().

source

pub unsafe fn new() -> CppBox<QBitmap>

Constructs a null bitmap.

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

C++ documentation:

Constructs a null bitmap.

See also QPixmap::isNull().

source

pub unsafe fn from_q_pixmap( arg1: impl CastInto<Ref<QPixmap>> ) -> CppBox<QBitmap>

Constructs a bitmap that is a copy of the given pixmap.

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

C++ documentation:

Constructs a bitmap that is a copy of the given pixmap.

If the pixmap has a depth greater than 1, the resulting bitmap will be dithered automatically.

See also QPixmap::depth(), fromImage(), and fromData().

source

pub unsafe fn from_2_int(w: c_int, h: c_int) -> CppBox<QBitmap>

Constructs a bitmap with the given width and height. The pixels inside are uninitialized.

Calls C++ function: [constructor] void QBitmap::QBitmap(int w, int h).

C++ documentation:

Constructs a bitmap with the given width and height. The pixels inside are uninitialized.

See also clear().

source

pub unsafe fn from_q_size(arg1: impl CastInto<Ref<QSize>>) -> CppBox<QBitmap>

Constructs a bitmap with the given size. The pixels in the bitmap are uninitialized.

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

C++ documentation:

Constructs a bitmap with the given size. The pixels in the bitmap are uninitialized.

See also clear().

source

pub unsafe fn from_q_string_char( file_name: impl CastInto<Ref<QString>>, format: *const c_char ) -> CppBox<QBitmap>

Constructs a bitmap from the file specified by the given fileName. If the file does not exist, or has an unknown format, the bitmap becomes a null bitmap.

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

C++ documentation:

Constructs a bitmap from the file specified by the given fileName. If the file does not exist, or has an unknown format, the bitmap becomes a null bitmap.

The fileName and format parameters are passed on to the QPixmap::load() function. If the file format uses more than 1 bit per pixel, the resulting bitmap will be dithered automatically.

See also QPixmap::isNull() and QImageReader::imageFormat().

source

pub unsafe fn from_q_string( file_name: impl CastInto<Ref<QString>> ) -> CppBox<QBitmap>

Constructs a bitmap from the file specified by the given fileName. If the file does not exist, or has an unknown format, the bitmap becomes a null bitmap.

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

C++ documentation:

Constructs a bitmap from the file specified by the given fileName. If the file does not exist, or has an unknown format, the bitmap becomes a null bitmap.

The fileName and format parameters are passed on to the QPixmap::load() function. If the file format uses more than 1 bit per pixel, the resulting bitmap will be dithered automatically.

See also QPixmap::isNull() and QImageReader::imageFormat().

source

pub unsafe fn new_copy(other: impl CastInto<Ref<QBitmap>>) -> CppBox<QBitmap>

Copy constructor.

Calls C++ function: [constructor] void QBitmap::QBitmap(const QBitmap& other).

C++ documentation:

Copy constructor.

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QBitmap>>)

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

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

C++ documentation:

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

This function was introduced in Qt 4.8.

source

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

Returns the bitmap as a QVariant.

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

C++ documentation:

Returns the bitmap as a QVariant.

source

pub unsafe fn transformed_q_matrix( &self, arg1: impl CastInto<Ref<QMatrix>> ) -> CppBox<QBitmap>

Returns a copy of this bitmap, transformed according to the given matrix.

Calls C++ function: QBitmap QBitmap::transformed(const QMatrix& arg1) const.

Warning: no exact match found in C++ documentation. Below is the C++ documentation for QBitmap QBitmap::transformed(const QTransform &matrix) const:

Returns a copy of this bitmap, transformed according to the given matrix.

See also QPixmap::transformed().

source

pub unsafe fn transformed_q_transform( &self, matrix: impl CastInto<Ref<QTransform>> ) -> CppBox<QBitmap>

Returns a copy of this bitmap, transformed according to the given matrix.

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

C++ documentation:

Returns a copy of this bitmap, transformed according to the given matrix.

See also QPixmap::transformed().

Methods from Deref<Target = QPixmap>§

source

pub unsafe fn cache_key(&self) -> i64

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

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

C++ documentation:

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

The cacheKey() will change when the pixmap is altered.

source

pub unsafe fn convert_from_image_2a( &self, img: impl CastInto<Ref<QImage>>, flags: QFlags<ImageConversionFlag> ) -> bool

Replaces this pixmap's data with the given image using the specified flags to control the conversion. The flags argument is a bitwise-OR of the Qt::ImageConversionFlags. Passing 0 for flags sets all the default options. Returns true if the result is that this pixmap is not null.

Calls C++ function: bool QPixmap::convertFromImage(const QImage& img, QFlags<Qt::ImageConversionFlag> flags = …).

C++ documentation:

Replaces this pixmap’s data with the given image using the specified flags to control the conversion. The flags argument is a bitwise-OR of the Qt::ImageConversionFlags. Passing 0 for flags sets all the default options. Returns true if the result is that this pixmap is not null.

Note: this function was part of Qt 3 support in Qt 4.6 and earlier. It has been promoted to official API status in 4.7 to support updating the pixmap's image without creating a new QPixmap as fromImage() would.

This function was introduced in Qt 4.7.

See also fromImage().

source

pub unsafe fn convert_from_image_1a( &self, img: impl CastInto<Ref<QImage>> ) -> bool

Replaces this pixmap's data with the given image using the specified flags to control the conversion. The flags argument is a bitwise-OR of the Qt::ImageConversionFlags. Passing 0 for flags sets all the default options. Returns true if the result is that this pixmap is not null.

Calls C++ function: bool QPixmap::convertFromImage(const QImage& img).

C++ documentation:

Replaces this pixmap’s data with the given image using the specified flags to control the conversion. The flags argument is a bitwise-OR of the Qt::ImageConversionFlags. Passing 0 for flags sets all the default options. Returns true if the result is that this pixmap is not null.

Note: this function was part of Qt 3 support in Qt 4.6 and earlier. It has been promoted to official API status in 4.7 to support updating the pixmap's image without creating a new QPixmap as fromImage() would.

This function was introduced in Qt 4.7.

See also fromImage().

source

pub unsafe fn copy_4a( &self, x: c_int, y: c_int, width: c_int, height: c_int ) -> CppBox<QPixmap>

This is an overloaded function.

Calls C++ function: QPixmap QPixmap::copy(int x, int y, int width, int height) const.

C++ documentation:

This is an overloaded function.

Returns a deep copy of the subset of the pixmap that is specified by the rectangle QRect( x, y, width, height).

source

pub unsafe fn copy_1a(&self, rect: impl CastInto<Ref<QRect>>) -> CppBox<QPixmap>

Returns a deep copy of the subset of the pixmap that is specified by the given rectangle. For more information on deep copies, see the Implicit Data Sharing documentation.

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

C++ documentation:

Returns a deep copy of the subset of the pixmap that is specified by the given rectangle. For more information on deep copies, see the Implicit Data Sharing documentation.

If the given rectangle is empty, the whole image is copied.

See also operator=(), QPixmap(), and Pixmap Transformations.

source

pub unsafe fn copy_0a(&self) -> CppBox<QPixmap>

Returns a deep copy of the subset of the pixmap that is specified by the given rectangle. For more information on deep copies, see the Implicit Data Sharing documentation.

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

C++ documentation:

Returns a deep copy of the subset of the pixmap that is specified by the given rectangle. For more information on deep copies, see the Implicit Data Sharing documentation.

If the given rectangle is empty, the whole image is copied.

See also operator=(), QPixmap(), and Pixmap Transformations.

source

pub unsafe fn copy_from( &self, arg1: impl CastInto<Ref<QPixmap>> ) -> Ref<QPixmap>

Assigns the given pixmap to this pixmap and returns a reference to this pixmap.

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

C++ documentation:

Assigns the given pixmap to this pixmap and returns a reference to this pixmap.

See also copy() and QPixmap().

source

pub unsafe fn create_heuristic_mask_1a( &self, clip_tight: bool ) -> CppBox<QBitmap>

Creates and returns a heuristic mask for this pixmap.

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

C++ documentation:

Creates and returns a heuristic mask for this pixmap.

The function works by selecting a color from one of the corners and then chipping away pixels of that color, starting at all the edges. 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.

The mask may not be perfect but it should be reasonable, so you can do things such as the following:

QPixmap myPixmap; myPixmap.setMask(myPixmap.createHeuristicMask());

This function is slow because it involves converting to/from a QImage, and non-trivial computations.

See also QImage::createHeuristicMask() and createMaskFromColor().

source

pub unsafe fn create_heuristic_mask_0a(&self) -> CppBox<QBitmap>

Creates and returns a heuristic mask for this pixmap.

Calls C++ function: QBitmap QPixmap::createHeuristicMask() const.

C++ documentation:

Creates and returns a heuristic mask for this pixmap.

The function works by selecting a color from one of the corners and then chipping away pixels of that color, starting at all the edges. 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.

The mask may not be perfect but it should be reasonable, so you can do things such as the following:

QPixmap myPixmap; myPixmap.setMask(myPixmap.createHeuristicMask());

This function is slow because it involves converting to/from a QImage, and non-trivial computations.

See also QImage::createHeuristicMask() and createMaskFromColor().

source

pub unsafe fn create_mask_from_color_2a( &self, mask_color: impl CastInto<Ref<QColor>>, mode: MaskMode ) -> CppBox<QBitmap>

Creates and returns a mask for this pixmap based on the given maskColor. If the mode is Qt::MaskInColor, all pixels matching the maskColor will be transparent. If mode is Qt::MaskOutColor, all pixels matching the maskColor will be opaque.

Calls C++ function: QBitmap QPixmap::createMaskFromColor(const QColor& maskColor, Qt::MaskMode mode = …) const.

C++ documentation:

Creates and returns a mask for this pixmap based on the given maskColor. If the mode is Qt::MaskInColor, all pixels matching the maskColor will be transparent. If mode is Qt::MaskOutColor, all pixels matching the maskColor will be opaque.

This function is slow because it involves converting to/from a QImage.

See also createHeuristicMask() and QImage::createMaskFromColor().

source

pub unsafe fn create_mask_from_color_1a( &self, mask_color: impl CastInto<Ref<QColor>> ) -> CppBox<QBitmap>

Creates and returns a mask for this pixmap based on the given maskColor. If the mode is Qt::MaskInColor, all pixels matching the maskColor will be transparent. If mode is Qt::MaskOutColor, all pixels matching the maskColor will be opaque.

Calls C++ function: QBitmap QPixmap::createMaskFromColor(const QColor& maskColor) const.

C++ documentation:

Creates and returns a mask for this pixmap based on the given maskColor. If the mode is Qt::MaskInColor, all pixels matching the maskColor will be transparent. If mode is Qt::MaskOutColor, all pixels matching the maskColor will be opaque.

This function is slow because it involves converting to/from a QImage.

See also createHeuristicMask() and QImage::createMaskFromColor().

source

pub unsafe fn depth(&self) -> c_int

Returns the depth of the pixmap.

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

C++ documentation:

Returns the depth of the pixmap.

The pixmap depth is also called bits per pixel (bpp) or bit planes of a pixmap. A null pixmap has depth 0.

See also defaultDepth() and Pixmap Information.

source

pub unsafe fn detach(&self)

Detaches the pixmap from shared pixmap data.

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

C++ documentation:

Detaches the pixmap from shared pixmap data.

A pixmap is automatically detached by Qt whenever its contents are about to change. This is done in almost all QPixmap member functions that modify the pixmap (fill(), fromImage(), load(), etc.), and in QPainter::begin() on a pixmap.

There are two exceptions in which detach() must be called explicitly, that is when calling the handle() or the x11PictureHandle() function (only available on X11). Otherwise, any modifications done using system calls, will be performed on the shared data.

The detach() function returns immediately if there is just a single reference or if the pixmap has not been initialized yet.

source

pub unsafe fn dev_type(&self) -> c_int

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

source

pub unsafe fn device_pixel_ratio(&self) -> c_double

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

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

C++ documentation:

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

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

The default value is 1.0.

See also setDevicePixelRatio() and QImageReader.

source

pub unsafe fn fill_1a(&self, fill_color: impl CastInto<Ref<QColor>>)

Use QPainter or the fill(QColor) overload instead.

Calls C++ function: void QPixmap::fill(const QColor& fillColor = …).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for void QPixmap::fill(const QPaintDevice *device, const QPoint &p):

Use QPainter or the fill(QColor) overload instead.

source

pub unsafe fn fill_2a( &self, device: impl CastInto<Ptr<QPaintDevice>>, ofs: impl CastInto<Ref<QPoint>> )

Use QPainter or the fill(QColor) overload instead.

Calls C++ function: void QPixmap::fill(const QPaintDevice* device, const QPoint& ofs).

C++ documentation:

Use QPainter or the fill(QColor) overload instead.

source

pub unsafe fn fill_3a( &self, device: impl CastInto<Ptr<QPaintDevice>>, xofs: c_int, yofs: c_int )

Use QPainter or the fill(QColor) overload instead.

Calls C++ function: void QPixmap::fill(const QPaintDevice* device, int xofs, int yofs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for void QPixmap::fill(const QPaintDevice *device, const QPoint &p):

Use QPainter or the fill(QColor) overload instead.

source

pub unsafe fn fill_0a(&self)

Use QPainter or the fill(QColor) overload instead.

Calls C++ function: void QPixmap::fill().

Warning: no exact match found in C++ documentation. Below is the C++ documentation for void QPixmap::fill(const QPaintDevice *device, const QPoint &p):

Use QPainter or the fill(QColor) overload instead.

source

pub unsafe fn has_alpha(&self) -> bool

Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false.

Calls C++ function: bool QPixmap::hasAlpha() const.

C++ documentation:

Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false.

See also hasAlphaChannel() and mask().

source

pub unsafe fn has_alpha_channel(&self) -> bool

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

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

C++ documentation:

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

See also hasAlpha().

source

pub unsafe fn height(&self) -> c_int

Returns the height of the pixmap.

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

C++ documentation:

Returns the height of the pixmap.

See also size() and Pixmap Information.

source

pub unsafe fn is_detached(&self) -> bool

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

source

pub unsafe fn is_null(&self) -> bool

Returns true if this is a null pixmap; otherwise returns false.

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

C++ documentation:

Returns true if this is a null pixmap; otherwise returns false.

A null pixmap has zero width, zero height and no contents. You cannot draw in a null pixmap.

source

pub unsafe fn is_q_bitmap(&self) -> bool

Returns true if this is a QBitmap; otherwise returns false.

Calls C++ function: bool QPixmap::isQBitmap() const.

C++ documentation:

Returns true if this is a QBitmap; otherwise returns false.

source

pub unsafe fn load_3a( &self, file_name: impl CastInto<Ref<QString>>, format: *const c_char, flags: QFlags<ImageConversionFlag> ) -> bool

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

Calls C++ function: bool QPixmap::load(const QString& fileName, const char* format = …, QFlags<Qt::ImageConversionFlag> flags = …).

C++ documentation:

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

The loader attempts to read the pixmap using the specified format. If the format is not specified (which is the default), the loader probes the file for a header to guess the file format.

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 pixmaps and other resource files in the application's executable.

If the data needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.

Note that QPixmaps are automatically added to the QPixmapCache when loaded from a file; the key used is internal and can not be acquired.

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

source

pub unsafe fn load_2a( &self, file_name: impl CastInto<Ref<QString>>, format: *const c_char ) -> bool

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

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

C++ documentation:

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

The loader attempts to read the pixmap using the specified format. If the format is not specified (which is the default), the loader probes the file for a header to guess the file format.

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 pixmaps and other resource files in the application's executable.

If the data needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.

Note that QPixmaps are automatically added to the QPixmapCache when loaded from a file; the key used is internal and can not be acquired.

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

source

pub unsafe fn load_1a(&self, file_name: impl CastInto<Ref<QString>>) -> bool

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

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

C++ documentation:

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

The loader attempts to read the pixmap using the specified format. If the format is not specified (which is the default), the loader probes the file for a header to guess the file format.

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 pixmaps and other resource files in the application's executable.

If the data needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.

Note that QPixmaps are automatically added to the QPixmapCache when loaded from a file; the key used is internal and can not be acquired.

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

source

pub unsafe fn load_from_data_uchar_uint_char_q_flags_image_conversion_flag( &self, buf: *const c_uchar, len: c_uint, format: *const c_char, flags: QFlags<ImageConversionFlag> ) -> bool

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

Calls C++ function: bool QPixmap::loadFromData(const unsigned char* buf, unsigned int len, const char* format = …, QFlags<Qt::ImageConversionFlag> flags = …).

C++ documentation:

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

The loader attempts to read the pixmap using the specified format. If the format is not specified (which is the default), the loader probes the file for a header to guess the file format.

If the data needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.

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

source

pub unsafe fn load_from_data_q_byte_array_char_q_flags_image_conversion_flag( &self, data: impl CastInto<Ref<QByteArray>>, format: *const c_char, flags: QFlags<ImageConversionFlag> ) -> bool

This is an overloaded function.

Calls C++ function: bool QPixmap::loadFromData(const QByteArray& data, const char* format = …, QFlags<Qt::ImageConversionFlag> flags = …).

C++ documentation:

This is an overloaded function.

Loads a pixmap from the binary data using the specified format and conversion flags.

source

pub unsafe fn load_from_data_uchar_uint_char( &self, buf: *const c_uchar, len: c_uint, format: *const c_char ) -> bool

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

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

C++ documentation:

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

The loader attempts to read the pixmap using the specified format. If the format is not specified (which is the default), the loader probes the file for a header to guess the file format.

If the data needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.

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

source

pub unsafe fn load_from_data_uchar_uint( &self, buf: *const c_uchar, len: c_uint ) -> bool

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

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

C++ documentation:

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

The loader attempts to read the pixmap using the specified format. If the format is not specified (which is the default), the loader probes the file for a header to guess the file format.

If the data needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.

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

source

pub unsafe fn load_from_data_q_byte_array_char( &self, data: impl CastInto<Ref<QByteArray>>, format: *const c_char ) -> bool

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Loads a pixmap from the binary data using the specified format and conversion flags.

source

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Loads a pixmap from the binary data using the specified format and conversion flags.

source

pub unsafe fn mask(&self) -> CppBox<QBitmap>

Extracts a bitmap mask from the pixmap's alpha channel.

Calls C++ function: QBitmap QPixmap::mask() const.

C++ documentation:

Extracts a bitmap mask from the pixmap’s alpha channel.

Warning: This is potentially an expensive operation. The mask of the pixmap is extracted dynamically from the pixeldata.

See also setMask() and Pixmap Information.

source

pub unsafe fn paint_engine(&self) -> Ptr<QPaintEngine>

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

source

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

Returns the pixmap's enclosing rectangle.

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

C++ documentation:

Returns the pixmap’s enclosing rectangle.

See also Pixmap Information.

source

pub unsafe fn save_q_string_char_int( &self, file_name: impl CastInto<Ref<QString>>, format: *const c_char, quality: c_int ) -> bool

Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. Returns true if successful; otherwise returns false.

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

C++ documentation:

Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. Returns true if successful; otherwise returns false.

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

If format is 0, an image format will be chosen from fileName's suffix.

See also Reading and Writing Image Files.

source

pub unsafe fn save_q_io_device_char_int( &self, device: impl CastInto<Ptr<QIODevice>>, format: *const c_char, quality: c_int ) -> bool

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

This function writes a QPixmap to the given device using the specified image file format and quality factor. This can be used, for example, to save a pixmap directly into a QByteArray:

QPixmap pixmap; QByteArray bytes; QBuffer buffer(&bytes); buffer.open(QIODevice::WriteOnly); pixmap.save(&buffer, “PNG”); // writes pixmap into bytes in PNG format

source

pub unsafe fn save_q_string_char( &self, file_name: impl CastInto<Ref<QString>>, format: *const c_char ) -> bool

Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. Returns true if successful; otherwise returns false.

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

C++ documentation:

Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. Returns true if successful; otherwise returns false.

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

If format is 0, an image format will be chosen from fileName's suffix.

See also Reading and Writing Image Files.

source

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

Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. Returns true if successful; otherwise returns false.

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

C++ documentation:

Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. Returns true if successful; otherwise returns false.

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

If format is 0, an image format will be chosen from fileName's suffix.

See also Reading and Writing Image Files.

source

pub unsafe fn save_q_io_device_char( &self, device: impl CastInto<Ptr<QIODevice>>, format: *const c_char ) -> bool

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

This function writes a QPixmap to the given device using the specified image file format and quality factor. This can be used, for example, to save a pixmap directly into a QByteArray:

QPixmap pixmap; QByteArray bytes; QBuffer buffer(&bytes); buffer.open(QIODevice::WriteOnly); pixmap.save(&buffer, “PNG”); // writes pixmap into bytes in PNG format

source

pub unsafe fn save_q_io_device( &self, device: impl CastInto<Ptr<QIODevice>> ) -> bool

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

This function writes a QPixmap to the given device using the specified image file format and quality factor. This can be used, for example, to save a pixmap directly into a QByteArray:

QPixmap pixmap; QByteArray bytes; QBuffer buffer(&bytes); buffer.open(QIODevice::WriteOnly); pixmap.save(&buffer, “PNG”); // writes pixmap into bytes in PNG format

source

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Returns a copy of the pixmap 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 pixmap.

source

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

Scales the pixmap to the given size, using the aspect ratio and transformation modes specified by aspectRatioMode and transformMode.

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

C++ documentation:

Scales the pixmap to the given size, using the aspect ratio and transformation modes specified by aspectRatioMode and transformMode.

  • If aspectRatioMode is Qt::IgnoreAspectRatio, the pixmap is scaled to size.
  • If aspectRatioMode is Qt::KeepAspectRatio, the pixmap is scaled to a rectangle as large as possible inside size, preserving the aspect ratio.
  • If aspectRatioMode is Qt::KeepAspectRatioByExpanding, the pixmap 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 pixmap.

In some cases it can be more beneficial to draw the pixmap to a painter with a scale set rather than scaling the pixmap. This is the case when the painter is for instance based on OpenGL or when the scale factor changes rapidly.

See also isNull() and Pixmap Transformations.

source

pub unsafe fn scaled_2_int_aspect_ratio_mode( &self, w: c_int, h: c_int, aspect_mode: AspectRatioMode ) -> CppBox<QPixmap>

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Returns a copy of the pixmap 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 pixmap.

source

pub unsafe fn scaled_2_int(&self, w: c_int, h: c_int) -> CppBox<QPixmap>

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Returns a copy of the pixmap 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 pixmap.

source

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

Scales the pixmap to the given size, using the aspect ratio and transformation modes specified by aspectRatioMode and transformMode.

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

C++ documentation:

Scales the pixmap to the given size, using the aspect ratio and transformation modes specified by aspectRatioMode and transformMode.

  • If aspectRatioMode is Qt::IgnoreAspectRatio, the pixmap is scaled to size.
  • If aspectRatioMode is Qt::KeepAspectRatio, the pixmap is scaled to a rectangle as large as possible inside size, preserving the aspect ratio.
  • If aspectRatioMode is Qt::KeepAspectRatioByExpanding, the pixmap 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 pixmap.

In some cases it can be more beneficial to draw the pixmap to a painter with a scale set rather than scaling the pixmap. This is the case when the painter is for instance based on OpenGL or when the scale factor changes rapidly.

See also isNull() and Pixmap Transformations.

source

pub unsafe fn scaled_q_size( &self, s: impl CastInto<Ref<QSize>> ) -> CppBox<QPixmap>

Scales the pixmap to the given size, using the aspect ratio and transformation modes specified by aspectRatioMode and transformMode.

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

C++ documentation:

Scales the pixmap to the given size, using the aspect ratio and transformation modes specified by aspectRatioMode and transformMode.

  • If aspectRatioMode is Qt::IgnoreAspectRatio, the pixmap is scaled to size.
  • If aspectRatioMode is Qt::KeepAspectRatio, the pixmap is scaled to a rectangle as large as possible inside size, preserving the aspect ratio.
  • If aspectRatioMode is Qt::KeepAspectRatioByExpanding, the pixmap 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 pixmap.

In some cases it can be more beneficial to draw the pixmap to a painter with a scale set rather than scaling the pixmap. This is the case when the painter is for instance based on OpenGL or when the scale factor changes rapidly.

See also isNull() and Pixmap Transformations.

source

pub unsafe fn scaled_to_height_2a( &self, h: c_int, mode: TransformationMode ) -> CppBox<QPixmap>

Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformation mode. The width of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

Calls C++ function: QPixmap QPixmap::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. The width of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

If height is 0 or negative, a null pixmap is returned.

See also isNull() and Pixmap Transformations.

source

pub unsafe fn scaled_to_height_1a(&self, h: c_int) -> CppBox<QPixmap>

Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformation mode. The width of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

Calls C++ function: QPixmap QPixmap::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. The width of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

If height is 0 or negative, a null pixmap is returned.

See also isNull() and Pixmap Transformations.

source

pub unsafe fn scaled_to_width_2a( &self, w: c_int, mode: TransformationMode ) -> CppBox<QPixmap>

Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformation mode. The height of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

Calls C++ function: QPixmap QPixmap::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. The height of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

If width is 0 or negative, a null pixmap is returned.

See also isNull() and Pixmap Transformations.

source

pub unsafe fn scaled_to_width_1a(&self, w: c_int) -> CppBox<QPixmap>

Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformation mode. The height of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

Calls C++ function: QPixmap QPixmap::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. The height of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

If width is 0 or negative, a null pixmap is returned.

See also isNull() and Pixmap Transformations.

source

pub unsafe fn scroll_7a( &self, dx: c_int, dy: c_int, x: c_int, y: c_int, width: c_int, height: c_int, exposed: impl CastInto<Ptr<QRegion>> )

This convenience function is equivalent to calling QPixmap::scroll(dx, dy, QRect(x, y, width, height), exposed).

Calls C++ function: void QPixmap::scroll(int dx, int dy, int x, int y, int width, int height, QRegion* exposed = …).

C++ documentation:

This convenience function is equivalent to calling QPixmap::scroll(dx, dy, QRect(x, y, width, height), exposed).

This function was introduced in Qt 4.6.

See also QWidget::scroll() and QGraphicsItem::scroll().

source

pub unsafe fn scroll_4a( &self, dx: c_int, dy: c_int, rect: impl CastInto<Ref<QRect>>, exposed: impl CastInto<Ptr<QRegion>> )

Scrolls the area rect of this pixmap by (dx, dy). The exposed region is left unchanged. You can optionally pass a pointer to an empty QRegion to get the region that is exposed by the scroll operation.

Calls C++ function: void QPixmap::scroll(int dx, int dy, const QRect& rect, QRegion* exposed = …).

C++ documentation:

Scrolls the area rect of this pixmap by (dx, dy). The exposed region is left unchanged. You can optionally pass a pointer to an empty QRegion to get the region that is exposed by the scroll operation.


  QPixmap pixmap("background.png");
  QRegion exposed;
  pixmap.scroll(10, 10, pixmap.rect(), &exposed);

You cannot scroll while there is an active painter on the pixmap.

This function was introduced in Qt 4.6.

See also QWidget::scroll() and QGraphicsItem::scroll().

source

pub unsafe fn scroll_6a( &self, dx: c_int, dy: c_int, x: c_int, y: c_int, width: c_int, height: c_int )

This convenience function is equivalent to calling QPixmap::scroll(dx, dy, QRect(x, y, width, height), exposed).

Calls C++ function: void QPixmap::scroll(int dx, int dy, int x, int y, int width, int height).

C++ documentation:

This convenience function is equivalent to calling QPixmap::scroll(dx, dy, QRect(x, y, width, height), exposed).

This function was introduced in Qt 4.6.

See also QWidget::scroll() and QGraphicsItem::scroll().

source

pub unsafe fn scroll_3a( &self, dx: c_int, dy: c_int, rect: impl CastInto<Ref<QRect>> )

Scrolls the area rect of this pixmap by (dx, dy). The exposed region is left unchanged. You can optionally pass a pointer to an empty QRegion to get the region that is exposed by the scroll operation.

Calls C++ function: void QPixmap::scroll(int dx, int dy, const QRect& rect).

C++ documentation:

Scrolls the area rect of this pixmap by (dx, dy). The exposed region is left unchanged. You can optionally pass a pointer to an empty QRegion to get the region that is exposed by the scroll operation.


  QPixmap pixmap("background.png");
  QRegion exposed;
  pixmap.scroll(10, 10, pixmap.rect(), &exposed);

You cannot scroll while there is an active painter on the pixmap.

This function was introduced in Qt 4.6.

See also QWidget::scroll() and QGraphicsItem::scroll().

source

pub unsafe fn set_device_pixel_ratio(&self, scale_factor: c_double)

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

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

C++ documentation:

Sets the device pixel ratio for the pixmap. 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 pixmap 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 pixmap size will take the ratio into account: QSize layoutSize = pixmap.size() / pixmap.devicePixelRatio() The net effect of this is that the pixmap is displayed as high-DPI pixmap rather than a large pixmap (see Drawing High Resolution Versions of Pixmaps and Images).

See also devicePixelRatio().

source

pub unsafe fn set_mask(&self, arg1: impl CastInto<Ref<QBitmap>>)

Sets a mask bitmap.

Calls C++ function: void QPixmap::setMask(const QBitmap& arg1).

C++ documentation:

Sets a mask bitmap.

This function merges the mask with the pixmap's alpha channel. A pixel value of 1 on the mask means the pixmap's pixel is unchanged; a value of 0 means the pixel is transparent. The mask must have the same size as this pixmap.

Setting a null mask resets the mask, leaving the previously transparent pixels black. The effect of this function is undefined when the pixmap is being painted on.

Warning: This is potentially an expensive operation.

See also mask(), Pixmap Transformations, and QBitmap.

source

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

Returns the size of the pixmap.

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

C++ documentation:

Returns the size of the pixmap.

See also width(), height(), and Pixmap Information.

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QPixmap>>)

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

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

C++ documentation:

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

This function was introduced in Qt 4.8.

source

pub unsafe fn to_image(&self) -> CppBox<QImage>

Converts the pixmap to a QImage. Returns a null image if the conversion fails.

Calls C++ function: QImage QPixmap::toImage() const.

C++ documentation:

Converts the pixmap to a QImage. Returns a null image if the conversion fails.

If the pixmap has 1-bit depth, the returned image will also be 1 bit deep. Images with more bits will be returned in a format closely represents the underlying system. Usually this will be QImage::Format_ARGB32_Premultiplied for pixmaps with an alpha and QImage::Format_RGB32 or QImage::Format_RGB16 for pixmaps without alpha.

Note that for the moment, alpha masks on monochrome images are ignored.

See also fromImage() and Image Formats.

source

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

Returns the pixmap as a QVariant.

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

C++ documentation:

Returns the pixmap as a QVariant.

source

pub unsafe fn transformed_q_matrix_transformation_mode( &self, arg1: impl CastInto<Ref<QMatrix>>, mode: TransformationMode ) -> CppBox<QPixmap>

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

This convenience function loads the matrix into a QTransform and calls the overloaded function.

source

pub unsafe fn transformed_q_transform_transformation_mode( &self, arg1: impl CastInto<Ref<QTransform>>, mode: TransformationMode ) -> CppBox<QPixmap>

Returns a copy of the pixmap that is transformed using the given transformation transform and transformation mode. The original pixmap is not changed.

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

C++ documentation:

Returns a copy of the pixmap that is transformed using the given transformation transform and transformation mode. The original pixmap is not changed.

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

This function is slow because it involves transformation to a QImage, non-trivial computations and a transformation back to a QPixmap.

See also trueMatrix() and Pixmap Transformations.

source

pub unsafe fn transformed_q_matrix( &self, arg1: impl CastInto<Ref<QMatrix>> ) -> CppBox<QPixmap>

This is an overloaded function.

Calls C++ function: QPixmap QPixmap::transformed(const QMatrix& arg1) const.

C++ documentation:

This is an overloaded function.

This convenience function loads the matrix into a QTransform and calls the overloaded function.

source

pub unsafe fn transformed_q_transform( &self, arg1: impl CastInto<Ref<QTransform>> ) -> CppBox<QPixmap>

Returns a copy of the pixmap that is transformed using the given transformation transform and transformation mode. The original pixmap is not changed.

Calls C++ function: QPixmap QPixmap::transformed(const QTransform& arg1) const.

C++ documentation:

Returns a copy of the pixmap that is transformed using the given transformation transform and transformation mode. The original pixmap is not changed.

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

This function is slow because it involves transformation to a QImage, non-trivial computations and a transformation back to a QPixmap.

See also trueMatrix() and Pixmap Transformations.

source

pub unsafe fn width(&self) -> c_int

Returns the width of the pixmap.

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

C++ documentation:

Returns the width of the pixmap.

See also size() and Pixmap Information.

Methods from Deref<Target = QPaintDevice>§

source

pub unsafe fn color_count(&self) -> c_int

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.

source

pub unsafe fn depth(&self) -> c_int

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.

source

pub unsafe fn dev_type(&self) -> c_int

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

source

pub unsafe fn device_pixel_ratio(&self) -> c_int

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.

source

pub unsafe fn device_pixel_ratio_f(&self) -> c_double

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.

source

pub unsafe fn height(&self) -> c_int

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

source

pub unsafe fn height_m_m(&self) -> c_int

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

source

pub unsafe fn logical_dpi_x(&self) -> c_int

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

source

pub unsafe fn logical_dpi_y(&self) -> c_int

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

source

pub unsafe fn paint_engine(&self) -> Ptr<QPaintEngine>

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.

source

pub unsafe fn painting_active(&self) -> bool

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

source

pub unsafe fn physical_dpi_x(&self) -> c_int

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

source

pub unsafe fn physical_dpi_y(&self) -> c_int

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

source

pub unsafe fn width(&self) -> c_int

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

source

pub unsafe fn width_m_m(&self) -> c_int

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§

source§

impl CppDeletable for QBitmap

source§

unsafe fn delete(&self)

Destroys the bitmap.

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

C++ documentation:

Destroys the bitmap.

source§

impl Deref for QBitmap

source§

fn deref(&self) -> &QPixmap

Calls C++ function: QPixmap* static_cast<QPixmap*>(QBitmap* ptr).

§

type Target = QPixmap

The resulting type after dereferencing.
source§

impl DynamicCast<QBitmap> for QPaintDevice

source§

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QBitmap>

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

source§

impl DynamicCast<QBitmap> for QPixmap

source§

unsafe fn dynamic_cast(ptr: Ptr<QPixmap>) -> Ptr<QBitmap>

Calls C++ function: QBitmap* dynamic_cast<QBitmap*>(QPixmap* ptr).

source§

impl StaticDowncast<QBitmap> for QPaintDevice

source§

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QBitmap>

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

source§

impl StaticDowncast<QBitmap> for QPixmap

source§

unsafe fn static_downcast(ptr: Ptr<QPixmap>) -> Ptr<QBitmap>

Calls C++ function: QBitmap* static_cast<QBitmap*>(QPixmap* ptr).

source§

impl StaticUpcast<QPaintDevice> for QBitmap

source§

unsafe fn static_upcast(ptr: Ptr<QBitmap>) -> Ptr<QPaintDevice>

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

source§

impl StaticUpcast<QPixmap> for QBitmap

source§

unsafe fn static_upcast(ptr: Ptr<QBitmap>) -> Ptr<QPixmap>

Calls C++ function: QPixmap* static_cast<QPixmap*>(QBitmap* ptr).

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.