#[repr(C)]pub struct QBitmap { /* private fields */ }
Expand description
The QBitmap class provides monochrome (1-bit depth) pixmaps.
C++ class: QBitmap
.
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
impl QBitmap
sourcepub unsafe fn clear(&self)
pub unsafe fn clear(&self)
Clears the bitmap, setting all its bits to Qt::color0.
Calls C++ function: void QBitmap::clear()
.
Clears the bitmap, setting all its bits to Qt::color0.
sourcepub unsafe fn copy_from_q_bitmap(
&self,
other: impl CastInto<Ref<QBitmap>>
) -> Ref<QBitmap>
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)
.
Copy-assignment operator.
sourcepub unsafe fn copy_from_q_pixmap(
&self,
arg1: impl CastInto<Ref<QPixmap>>
) -> Ref<QBitmap>
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)
.
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().
sourcepub unsafe fn from_data_3a(
size: impl CastInto<Ref<QSize>>,
bits: *const c_uchar,
mono_format: Format
) -> CppBox<QBitmap>
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 = …)
.
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().
sourcepub unsafe fn from_data_2a(
size: impl CastInto<Ref<QSize>>,
bits: *const c_uchar
) -> CppBox<QBitmap>
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)
.
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().
sourcepub unsafe fn from_image_2a(
image: impl CastInto<Ref<QImage>>,
flags: QFlags<ImageConversionFlag>
) -> CppBox<QBitmap>
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 = …)
.
Returns a copy of the given image converted to a bitmap using the specified image conversion flags.
See also fromData().
sourcepub unsafe fn from_image_1a(
image: impl CastInto<Ref<QImage>>
) -> CppBox<QBitmap>
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)
.
Returns a copy of the given image converted to a bitmap using the specified image conversion flags.
See also fromData().
sourcepub unsafe fn new() -> CppBox<QBitmap>
pub unsafe fn new() -> CppBox<QBitmap>
Constructs a null bitmap.
Calls C++ function: [constructor] void QBitmap::QBitmap()
.
Constructs a null bitmap.
See also QPixmap::isNull().
sourcepub unsafe fn from_q_pixmap(
arg1: impl CastInto<Ref<QPixmap>>
) -> CppBox<QBitmap>
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)
.
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().
sourcepub unsafe fn from_2_int(w: c_int, h: c_int) -> CppBox<QBitmap>
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)
.
Constructs a bitmap with the given width and height. The pixels inside are uninitialized.
See also clear().
sourcepub unsafe fn from_q_size(arg1: impl CastInto<Ref<QSize>>) -> CppBox<QBitmap>
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)
.
Constructs a bitmap with the given size. The pixels in the bitmap are uninitialized.
See also clear().
sourcepub unsafe fn from_q_string_char(
file_name: impl CastInto<Ref<QString>>,
format: *const c_char
) -> CppBox<QBitmap>
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 = …)
.
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().
sourcepub unsafe fn from_q_string(
file_name: impl CastInto<Ref<QString>>
) -> CppBox<QBitmap>
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)
.
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().
sourcepub unsafe fn new_copy(other: impl CastInto<Ref<QBitmap>>) -> CppBox<QBitmap>
pub unsafe fn new_copy(other: impl CastInto<Ref<QBitmap>>) -> CppBox<QBitmap>
Copy constructor.
Calls C++ function: [constructor] void QBitmap::QBitmap(const QBitmap& other)
.
Copy constructor.
sourcepub unsafe fn swap(&self, other: impl CastInto<Ref<QBitmap>>)
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)
.
Swaps bitmap other with this bitmap. This operation is very fast and never fails.
This function was introduced in Qt 4.8.
sourcepub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
sourcepub unsafe fn transformed_q_matrix(
&self,
arg1: impl CastInto<Ref<QMatrix>>
) -> CppBox<QBitmap>
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().
sourcepub unsafe fn transformed_q_transform(
&self,
matrix: impl CastInto<Ref<QTransform>>
) -> CppBox<QBitmap>
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
.
Returns a copy of this bitmap, transformed according to the given matrix.
See also QPixmap::transformed().
Methods from Deref<Target = QPixmap>§
sourcepub unsafe fn cache_key(&self) -> i64
pub unsafe fn cache_key(&self) -> i64
sourcepub unsafe fn convert_from_image_2a(
&self,
img: impl CastInto<Ref<QImage>>,
flags: QFlags<ImageConversionFlag>
) -> bool
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 = …)
.
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().
sourcepub unsafe fn convert_from_image_1a(
&self,
img: impl CastInto<Ref<QImage>>
) -> bool
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)
.
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().
sourcepub unsafe fn copy_4a(
&self,
x: c_int,
y: c_int,
width: c_int,
height: c_int
) -> CppBox<QPixmap>
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
.
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).
sourcepub unsafe fn copy_1a(&self, rect: impl CastInto<Ref<QRect>>) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn copy_0a(&self) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn copy_from(
&self,
arg1: impl CastInto<Ref<QPixmap>>
) -> Ref<QPixmap>
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)
.
sourcepub unsafe fn create_heuristic_mask_1a(
&self,
clip_tight: bool
) -> CppBox<QBitmap>
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
.
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().
sourcepub unsafe fn create_heuristic_mask_0a(&self) -> CppBox<QBitmap>
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
.
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().
sourcepub unsafe fn create_mask_from_color_2a(
&self,
mask_color: impl CastInto<Ref<QColor>>,
mode: MaskMode
) -> CppBox<QBitmap>
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
.
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().
sourcepub unsafe fn create_mask_from_color_1a(
&self,
mask_color: impl CastInto<Ref<QColor>>
) -> CppBox<QBitmap>
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
.
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().
sourcepub unsafe fn depth(&self) -> c_int
pub unsafe fn depth(&self) -> c_int
Returns the depth of the pixmap.
Calls C++ function: int QPixmap::depth() const
.
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.
sourcepub unsafe fn detach(&self)
pub unsafe fn detach(&self)
Detaches the pixmap from shared pixmap data.
Calls C++ function: void QPixmap::detach()
.
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.
sourcepub unsafe fn dev_type(&self) -> c_int
pub unsafe fn dev_type(&self) -> c_int
Calls C++ function: virtual int QPixmap::devType() const
.
sourcepub unsafe fn device_pixel_ratio(&self) -> c_double
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
.
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.
sourcepub unsafe fn fill_1a(&self, fill_color: impl CastInto<Ref<QColor>>)
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)
:
sourcepub unsafe fn fill_2a(
&self,
device: impl CastInto<Ptr<QPaintDevice>>,
ofs: impl CastInto<Ref<QPoint>>
)
pub unsafe fn fill_2a( &self, device: impl CastInto<Ptr<QPaintDevice>>, ofs: impl CastInto<Ref<QPoint>> )
sourcepub unsafe fn fill_3a(
&self,
device: impl CastInto<Ptr<QPaintDevice>>,
xofs: c_int,
yofs: c_int
)
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)
:
sourcepub unsafe fn fill_0a(&self)
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)
:
sourcepub unsafe fn has_alpha(&self) -> bool
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
.
Returns true
if this pixmap has an alpha channel, or has a mask, otherwise returns false
.
See also hasAlphaChannel() and mask().
sourcepub unsafe fn has_alpha_channel(&self) -> bool
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
.
Returns true
if the pixmap has a format that respects the alpha channel, otherwise returns false
.
See also hasAlpha().
sourcepub unsafe fn height(&self) -> c_int
pub unsafe fn height(&self) -> c_int
Returns the height of the pixmap.
Calls C++ function: int QPixmap::height() const
.
Returns the height of the pixmap.
See also size() and Pixmap Information.
sourcepub unsafe fn is_detached(&self) -> bool
pub unsafe fn is_detached(&self) -> bool
Calls C++ function: bool QPixmap::isDetached() const
.
sourcepub unsafe fn is_null(&self) -> bool
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
.
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.
sourcepub unsafe fn is_q_bitmap(&self) -> bool
pub unsafe fn is_q_bitmap(&self) -> bool
sourcepub unsafe fn load_3a(
&self,
file_name: impl CastInto<Ref<QString>>,
format: *const c_char,
flags: QFlags<ImageConversionFlag>
) -> bool
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 = …)
.
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.
sourcepub unsafe fn load_2a(
&self,
file_name: impl CastInto<Ref<QString>>,
format: *const c_char
) -> bool
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 = …)
.
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.
sourcepub unsafe fn load_1a(&self, file_name: impl CastInto<Ref<QString>>) -> bool
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)
.
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.
sourcepub 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
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 = …)
.
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.
sourcepub 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
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 = …)
.
This is an overloaded function.
Loads a pixmap from the binary data using the specified format and conversion flags.
sourcepub unsafe fn load_from_data_uchar_uint_char(
&self,
buf: *const c_uchar,
len: c_uint,
format: *const c_char
) -> bool
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 = …)
.
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.
sourcepub unsafe fn load_from_data_uchar_uint(
&self,
buf: *const c_uchar,
len: c_uint
) -> bool
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)
.
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.
sourcepub unsafe fn load_from_data_q_byte_array_char(
&self,
data: impl CastInto<Ref<QByteArray>>,
format: *const c_char
) -> bool
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 = …)
.
This is an overloaded function.
Loads a pixmap from the binary data using the specified format and conversion flags.
sourcepub unsafe fn load_from_data_q_byte_array(
&self,
data: impl CastInto<Ref<QByteArray>>
) -> bool
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)
.
This is an overloaded function.
Loads a pixmap from the binary data using the specified format and conversion flags.
sourcepub unsafe fn mask(&self) -> CppBox<QBitmap>
pub unsafe fn mask(&self) -> CppBox<QBitmap>
Extracts a bitmap mask from the pixmap's alpha channel.
Calls C++ function: QBitmap QPixmap::mask() const
.
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.
sourcepub unsafe fn paint_engine(&self) -> Ptr<QPaintEngine>
pub unsafe fn paint_engine(&self) -> Ptr<QPaintEngine>
Calls C++ function: virtual QPaintEngine* QPixmap::paintEngine() const
.
sourcepub unsafe fn rect(&self) -> CppBox<QRect>
pub unsafe fn rect(&self) -> CppBox<QRect>
Returns the pixmap's enclosing rectangle.
Calls C++ function: QRect QPixmap::rect() const
.
Returns the pixmap’s enclosing rectangle.
See also Pixmap Information.
sourcepub unsafe fn save_q_string_char_int(
&self,
file_name: impl CastInto<Ref<QString>>,
format: *const c_char,
quality: c_int
) -> bool
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
.
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.
sourcepub unsafe fn save_q_io_device_char_int(
&self,
device: impl CastInto<Ptr<QIODevice>>,
format: *const c_char,
quality: c_int
) -> bool
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
.
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
sourcepub unsafe fn save_q_string_char(
&self,
file_name: impl CastInto<Ref<QString>>,
format: *const c_char
) -> bool
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
.
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.
sourcepub unsafe fn save_q_string(
&self,
file_name: impl CastInto<Ref<QString>>
) -> bool
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
.
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.
sourcepub unsafe fn save_q_io_device_char(
&self,
device: impl CastInto<Ptr<QIODevice>>,
format: *const c_char
) -> bool
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
.
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
sourcepub unsafe fn save_q_io_device(
&self,
device: impl CastInto<Ptr<QIODevice>>
) -> bool
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
.
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
sourcepub unsafe fn scaled_2_int_aspect_ratio_mode_transformation_mode(
&self,
w: c_int,
h: c_int,
aspect_mode: AspectRatioMode,
mode: TransformationMode
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_q_size_aspect_ratio_mode_transformation_mode(
&self,
s: impl CastInto<Ref<QSize>>,
aspect_mode: AspectRatioMode,
mode: TransformationMode
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_2_int_aspect_ratio_mode(
&self,
w: c_int,
h: c_int,
aspect_mode: AspectRatioMode
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_2_int(&self, w: c_int, h: c_int) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_q_size_aspect_ratio_mode(
&self,
s: impl CastInto<Ref<QSize>>,
aspect_mode: AspectRatioMode
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_q_size(
&self,
s: impl CastInto<Ref<QSize>>
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_to_height_2a(
&self,
h: c_int,
mode: TransformationMode
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_to_height_1a(&self, h: c_int) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_to_width_2a(
&self,
w: c_int,
mode: TransformationMode
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn scaled_to_width_1a(&self, w: c_int) -> CppBox<QPixmap>
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
.
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.
sourcepub 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>>
)
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 = …)
.
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().
sourcepub unsafe fn scroll_4a(
&self,
dx: c_int,
dy: c_int,
rect: impl CastInto<Ref<QRect>>,
exposed: impl CastInto<Ptr<QRegion>>
)
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 = …)
.
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().
sourcepub unsafe fn scroll_6a(
&self,
dx: c_int,
dy: c_int,
x: c_int,
y: c_int,
width: c_int,
height: c_int
)
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)
.
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().
sourcepub unsafe fn scroll_3a(
&self,
dx: c_int,
dy: c_int,
rect: impl CastInto<Ref<QRect>>
)
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)
.
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().
sourcepub unsafe fn set_device_pixel_ratio(&self, scale_factor: c_double)
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)
.
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().
sourcepub unsafe fn set_mask(&self, arg1: impl CastInto<Ref<QBitmap>>)
pub unsafe fn set_mask(&self, arg1: impl CastInto<Ref<QBitmap>>)
Sets a mask bitmap.
Calls C++ function: void QPixmap::setMask(const QBitmap& arg1)
.
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.
sourcepub unsafe fn size(&self) -> CppBox<QSize>
pub unsafe fn size(&self) -> CppBox<QSize>
Returns the size of the pixmap.
Calls C++ function: QSize QPixmap::size() const
.
Returns the size of the pixmap.
See also width(), height(), and Pixmap Information.
sourcepub unsafe fn swap(&self, other: impl CastInto<Ref<QPixmap>>)
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)
.
Swaps pixmap other with this pixmap. This operation is very fast and never fails.
This function was introduced in Qt 4.8.
sourcepub unsafe fn to_image(&self) -> CppBox<QImage>
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
.
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.
sourcepub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
sourcepub unsafe fn transformed_q_matrix_transformation_mode(
&self,
arg1: impl CastInto<Ref<QMatrix>>,
mode: TransformationMode
) -> CppBox<QPixmap>
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
.
This is an overloaded function.
This convenience function loads the matrix into a QTransform and calls the overloaded function.
sourcepub unsafe fn transformed_q_transform_transformation_mode(
&self,
arg1: impl CastInto<Ref<QTransform>>,
mode: TransformationMode
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn transformed_q_matrix(
&self,
arg1: impl CastInto<Ref<QMatrix>>
) -> CppBox<QPixmap>
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
.
This is an overloaded function.
This convenience function loads the matrix into a QTransform and calls the overloaded function.
sourcepub unsafe fn transformed_q_transform(
&self,
arg1: impl CastInto<Ref<QTransform>>
) -> CppBox<QPixmap>
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
.
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.
sourcepub unsafe fn width(&self) -> c_int
pub unsafe fn width(&self) -> c_int
Returns the width of the pixmap.
Calls C++ function: int QPixmap::width() const
.
Returns the width of the pixmap.
See also size() and Pixmap Information.
Methods from Deref<Target = QPaintDevice>§
sourcepub unsafe fn color_count(&self) -> c_int
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
.
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.
sourcepub unsafe fn depth(&self) -> c_int
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
.
Returns the bit depth (number of bit planes) of the paint device.
sourcepub unsafe fn dev_type(&self) -> c_int
pub unsafe fn dev_type(&self) -> c_int
Calls C++ function: virtual int QPaintDevice::devType() const
.
sourcepub unsafe fn device_pixel_ratio(&self) -> c_int
pub unsafe fn device_pixel_ratio(&self) -> c_int
Returns the device pixel ratio for device.
Calls C++ function: int QPaintDevice::devicePixelRatio() const
.
Returns the device pixel ratio for device.
Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.
sourcepub unsafe fn device_pixel_ratio_f(&self) -> c_double
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
.
Returns the device pixel ratio for the device as a floating point number.
This function was introduced in Qt 5.6.
sourcepub unsafe fn height(&self) -> c_int
pub unsafe fn height(&self) -> c_int
sourcepub unsafe fn height_m_m(&self) -> c_int
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
.
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().
sourcepub unsafe fn logical_dpi_x(&self) -> c_int
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
.
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().
sourcepub unsafe fn logical_dpi_y(&self) -> c_int
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
.
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().
sourcepub unsafe fn paint_engine(&self) -> Ptr<QPaintEngine>
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
.
Returns a pointer to the paint engine used for drawing on the device.
sourcepub unsafe fn painting_active(&self) -> bool
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
.
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().
sourcepub unsafe fn physical_dpi_x(&self) -> c_int
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
.
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().
sourcepub unsafe fn physical_dpi_y(&self) -> c_int
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
.
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().
sourcepub unsafe fn width(&self) -> c_int
pub unsafe fn width(&self) -> c_int
sourcepub unsafe fn width_m_m(&self) -> c_int
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
.
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
impl CppDeletable for QBitmap
source§impl DynamicCast<QBitmap> for QPaintDevice
impl DynamicCast<QBitmap> for QPaintDevice
source§unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QBitmap>
unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QBitmap>
Calls C++ function: QBitmap* dynamic_cast<QBitmap*>(QPaintDevice* ptr)
.
source§impl DynamicCast<QBitmap> for QPixmap
impl DynamicCast<QBitmap> for QPixmap
source§impl StaticDowncast<QBitmap> for QPaintDevice
impl StaticDowncast<QBitmap> for QPaintDevice
source§unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QBitmap>
unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QBitmap>
Calls C++ function: QBitmap* static_cast<QBitmap*>(QPaintDevice* ptr)
.
source§impl StaticDowncast<QBitmap> for QPixmap
impl StaticDowncast<QBitmap> for QPixmap
source§impl StaticUpcast<QPaintDevice> for QBitmap
impl StaticUpcast<QPaintDevice> for QBitmap
source§unsafe fn static_upcast(ptr: Ptr<QBitmap>) -> Ptr<QPaintDevice>
unsafe fn static_upcast(ptr: Ptr<QBitmap>) -> Ptr<QPaintDevice>
Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QBitmap* ptr)
.