Skip to content

PythonQt.QtGui.QPixmap · declarations 001

Back to PythonQt.QtGui.QPixmap

cacheKey

cacheKey() -> int

X.cacheKey() -> int

Supplemental documentation: Qt 5 reference:

qint64 QPixmap::cacheKey() const

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.

Upstream PySide2 reference signatures (binding differences may apply):

cacheKey(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#cacheKey

convertFromImage

convertFromImage(img: Any, arg1: flags) -> bool

X.convertFromImage(img, flags) -> bool

Supplemental documentation: Qt 5 reference:

bool QPixmap::convertFromImage(const QImage \&image, Qt::ImageConversionFlags flags \= Qt::AutoColor)

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

Upstream PySide2 reference signatures (binding differences may apply):

convertFromImage(self, img: PySide2.QtGui.QImage, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#convertFromImage

copy

copy(x: Any, y: Any, width: Any, height: Any) -> Any

X.copy(x, y, width, height) -> PythonQt.QtGui.QPixmap

Supplemental documentation: Qt 5 reference:

QPixmap QPixmap::copy(const QRect \&rectangle \= QRect()) 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.

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

Upstream PySide2 reference signatures (binding differences may apply):

copy(self, rect: PySide2.QtCore.QRect=...) -> PySide2.QtGui.QPixmap
copy(self, x: int, y: int, width: int, height: int) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#copy

createHeuristicMask

createHeuristicMask(clipTight: bool) -> Any

X.createHeuristicMask(clipTight) -> PythonQt.QtGui.QBitmap

Supplemental documentation: Qt 5 reference:

QBitmap QPixmap::createHeuristicMask(bool clipTight \= true) 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().

Upstream PySide2 reference signatures (binding differences may apply):

createHeuristicMask(self, clipTight: bool=...) -> PySide2.QtGui.QBitmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#createHeuristicMask

createMaskFromColor

createMaskFromColor(maskColor: Any, mode: Any) -> Any

X.createMaskFromColor(maskColor, mode) -> PythonQt.QtGui.QBitmap

Supplemental documentation: Qt 5 reference:

QBitmap QPixmap::createMaskFromColor(const QColor \&maskColor, Qt::MaskMode mode \= Qt::MaskInColor) 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().

Upstream PySide2 reference signatures (binding differences may apply):

createMaskFromColor(self, maskColor: PySide2.QtGui.QColor, mode: PySide2.QtCore.Qt.MaskMode=...) -> PySide2.QtGui.QBitmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#createMaskFromColor

defaultDepth

defaultDepth() -> int

X.defaultDepth() -> int

Supplemental documentation: Qt 5 reference:

[static] int QPixmap::defaultDepth()

Returns the default pixmap depth used by the application.

On all platforms the depth of the primary screen will be returned.

Note: QGuiApplication must be created before calling this function.

See also depth(), QColormap::depth(), and Pixmap Information.

Upstream PySide2 reference signatures (binding differences may apply):

defaultDepth() -> int

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#defaultDepth

depth

depth() -> int

X.depth() -> int

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

depth(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#depth

devType

devType() -> int

X.devType() -> int

Upstream PySide2 reference signatures (binding differences may apply):

devType(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#devType

devicePixelRatio

devicePixelRatio() -> float

X.devicePixelRatio() -> float

Supplemental documentation: Qt 5 reference:

qreal 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.

Upstream PySide2 reference signatures (binding differences may apply):

devicePixelRatio(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#devicePixelRatio

fill

fill(device: Any, xofs: Any, yofs: Any) -> None

X.fill(device, xofs, yofs)

Supplemental documentation: Qt 5 reference:

void QPixmap::fill(const QColor \&color \= Qt::white)

Fills the pixmap with the given color.

The effect of this function is undefined when the pixmap is being painted on.

See also Pixmap Transformations.

Upstream PySide2 reference signatures (binding differences may apply):

fill(self, device: PySide2.QtGui.QPaintDevice, ofs: PySide2.QtCore.QPoint) -> None
fill(self, device: PySide2.QtGui.QPaintDevice, xofs: int, yofs: int) -> None
fill(self, fillColor: PySide2.QtGui.QColor=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#fill

fromImage

fromImage(image: Any, arg1: flags) -> Any

X.fromImage(image, flags) -> PythonQt.QtGui.QPixmap

Supplemental documentation: Qt 5 reference:

[static] QPixmap QPixmap::fromImage(const QImage \&image, Qt::ImageConversionFlags flags \= Qt::AutoColor)

Converts the given image to a pixmap 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.

In case of monochrome and 8-bit images, the image is first converted to a 32-bit pixmap and then filled with the colors in the color table. If this is too expensive an operation, you can use QBitmap::fromImage() instead.

See also fromImageReader(), toImage(), and Pixmap Conversion.

[static] QPixmap QPixmap::fromImage(QImage \&\&image, Qt::ImageConversionFlags flags \= Qt::AutoColor)

This is an overloaded function.

Converts the given image to a pixmap without copying if possible.

This function was introduced in Qt 5.3.

Upstream PySide2 reference signatures (binding differences may apply):

fromImage(image: PySide2.QtGui.QImage, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#fromImage

fromImageReader

fromImageReader(imageReader: Any, arg1: flags) -> Any

X.fromImageReader(imageReader, flags) -> PythonQt.QtGui.QPixmap

Supplemental documentation: Qt 5 reference:

[static] QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags \= Qt::AutoColor)

Create a QPixmap from an image read directly from an imageReader. The flags argument is a bitwise-OR of the Qt::ImageConversionFlags. Passing 0 for flags sets all the default options.

On some systems, reading an image directly to QPixmap can use less memory than reading a QImage to convert it to QPixmap.

See also fromImage(), toImage(), and Pixmap Conversion.

Upstream PySide2 reference signatures (binding differences may apply):

fromImageReader(imageReader: PySide2.QtGui.QImageReader, flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#fromImageReader

grabWidget

grabWidget(widget: Any, x: Any, y: Any, w: Any, h: Any) -> Any

X.grabWidget(widget, x, y, w, h) -> PythonQt.QtGui.QPixmap

Upstream PySide2 reference signatures (binding differences may apply):

grabWidget(widget: PySide2.QtCore.QObject, rect: PySide2.QtCore.QRect) -> PySide2.QtGui.QPixmap
grabWidget(widget: PySide2.QtCore.QObject, x: int=..., y: int=..., w: int=..., h: int=...) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#grabWidget

grabWindow

grabWindow(arg__1: int, x: int, y: int, w: int, h: int) -> Any

X.grabWindow(arg__1, x, y, w, h) -> PythonQt.QtGui.QPixmap

Upstream PySide2 reference signatures (binding differences may apply):

grabWindow(arg__1: int, x: int=..., y: int=..., w: int=..., h: int=...) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#grabWindow

hasAlpha

hasAlpha() -> bool

X.hasAlpha() -> bool

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

hasAlpha(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#hasAlpha

hasAlphaChannel

hasAlphaChannel() -> bool

X.hasAlphaChannel() -> bool

Supplemental documentation: Qt 5 reference:

bool QPixmap::hasAlphaChannel() const

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

See also hasAlpha().

Upstream PySide2 reference signatures (binding differences may apply):

hasAlphaChannel(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#hasAlphaChannel

height

height() -> int

X.height() -> int

Supplemental documentation: Qt 5 reference:

int QPixmap::height() const

Returns the height of the pixmap.

See also size() and Pixmap Information.

Upstream PySide2 reference signatures (binding differences may apply):

height(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#height

isNull

isNull() -> bool

X.isNull() -> bool

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

isNull(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#isNull

isQBitmap

isQBitmap() -> bool

X.isQBitmap() -> bool

Supplemental documentation: Qt 5 reference:

bool QPixmap::isQBitmap() const

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

Upstream PySide2 reference signatures (binding differences may apply):

isQBitmap(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#isQBitmap

load

load(fileName: str, format: Any, arg2: flags) -> bool

X.load(fileName, format, flags) -> bool

Supplemental documentation: Qt 5 reference:

bool QPixmap::load(const QString \&fileName, const char *format \= nullptr, Qt::ImageConversionFlags flags \= Qt::AutoColor)

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 in main thread; the key used is internal and cannot be acquired.

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

Upstream PySide2 reference signatures (binding differences may apply):

load(self, fileName: str, format: typing.Optional[str]=..., flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#load

loadFromData

loadFromData(data: Any, format: Any, arg2: flags) -> bool

X.loadFromData(data, format, flags) -> bool

Supplemental documentation: Qt 5 reference:

bool QPixmap::loadFromData(const uchar *data, uint len, const char *format \= nullptr, Qt::ImageConversionFlags flags \= Qt::AutoColor)

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.

bool QPixmap::loadFromData(const QByteArray \&data, const char *format \= nullptr, Qt::ImageConversionFlags flags \= Qt::AutoColor)

This is an overloaded function.

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

Upstream PySide2 reference signatures (binding differences may apply):

loadFromData(self, buf: str, len: int, format: typing.Optional[str]=..., flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> bool
loadFromData(self, data: PySide2.QtCore.QByteArray, format: typing.Optional[str]=..., flags: PySide2.QtCore.Qt.ImageConversionFlags=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#loadFromData

mask

mask() -> Any

X.mask() -> PythonQt.QtGui.QBitmap

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

mask(self) -> PySide2.QtGui.QBitmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#mask

metric

metric(arg__1: Any) -> int

X.metric(arg__1) -> int

Upstream PySide2 reference signatures (binding differences may apply):

metric(self, arg__1: PySide2.QtGui.QPaintDevice.PaintDeviceMetric) -> int

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#metric

paintEngine

paintEngine() -> Any

X.paintEngine() -> PythonQt.QtGui.QPaintEngine

Upstream PySide2 reference signatures (binding differences may apply):

paintEngine(self) -> PySide2.QtGui.QPaintEngine

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#paintEngine

rect

rect() -> Any

X.rect() -> PythonQt.QtCore.QRect

Supplemental documentation: Qt 5 reference:

QRect QPixmap::rect() const

Returns the pixmap's enclosing rectangle.

See also Pixmap Information.

Upstream PySide2 reference signatures (binding differences may apply):

rect(self) -> PySide2.QtCore.QRect

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#rect

save

save(device: Any, format: Any, quality: int) -> bool

X.save(device, format, quality) -> bool

Supplemental documentation: Qt 5 reference:

bool QPixmap::save(const QString \&fileName, const char *format \= nullptr, int quality \= -1) 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 nullptr, an image format will be chosen from fileName's suffix.

See also Reading and Writing Image Files.

bool QPixmap::save(QIODevice *device, const char *format \= nullptr, int quality \= -1) 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

Upstream PySide2 reference signatures (binding differences may apply):

save(self, device: PySide2.QtCore.QIODevice, format: typing.Optional[str]=..., quality: int=...) -> bool
save(self, fileName: str, format: typing.Optional[str]=..., quality: int=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#save

scaled

scaled(w: Any, h: Any, aspectMode: Any, mode: Any) -> Any

X.scaled(w, h, aspectMode, mode) -> PythonQt.QtGui.QPixmap

Supplemental documentation: Qt 5 reference:

QPixmap QPixmap::scaled(const QSize \&size, Qt::AspectRatioMode aspectRatioMode \= Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode \= Qt::FastTransformation) 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.

QPixmap QPixmap::scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode \= Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode \= Qt::FastTransformation) 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.

Upstream PySide2 reference signatures (binding differences may apply):

scaled(self, s: PySide2.QtCore.QSize, aspectMode: PySide2.QtCore.Qt.AspectRatioMode=..., mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QPixmap
scaled(self, w: int, h: int, aspectMode: PySide2.QtCore.Qt.AspectRatioMode=..., mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#scaled

scaledToHeight

scaledToHeight(h: int, mode: Any) -> Any

X.scaledToHeight(h, mode) -> PythonQt.QtGui.QPixmap

Supplemental documentation: Qt 5 reference:

QPixmap QPixmap::scaledToHeight(int height, Qt::TransformationMode mode \= Qt::FastTransformation) 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.

Upstream PySide2 reference signatures (binding differences may apply):

scaledToHeight(self, h: int, mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#scaledToHeight

scaledToWidth

scaledToWidth(w: int, mode: Any) -> Any

X.scaledToWidth(w, mode) -> PythonQt.QtGui.QPixmap

Supplemental documentation: Qt 5 reference:

QPixmap QPixmap::scaledToWidth(int width, Qt::TransformationMode mode \= Qt::FastTransformation) 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.

Upstream PySide2 reference signatures (binding differences may apply):

scaledToWidth(self, w: int, mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#scaledToWidth

scroll

scroll(dx: int, dy: int, x: Any, y: Any, width: Any, height: Any, exposed: Any) -> None

X.scroll(dx, dy, x, y, width, height, exposed)

Supplemental documentation: Qt 5 reference:

void QPixmap::scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed \= nullptr)

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

void QPixmap::scroll(int dx, int dy, const QRect \&rect, QRegion *exposed \= nullptr)

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

Upstream PySide2 reference signatures (binding differences may apply):

scroll(self, dx: int, dy: int, rect: PySide2.QtCore.QRect, exposed: typing.Optional[PySide2.QtGui.QRegion]=...) -> None
scroll(self, dx: int, dy: int, x: int, y: int, width: int, height: int, exposed: typing.Optional[PySide2.QtGui.QRegion]=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#scroll

setDevicePixelRatio

setDevicePixelRatio(scaleFactor: float) -> None

X.setDevicePixelRatio(scaleFactor)

Supplemental documentation: Qt 5 reference:

void QPixmap::setDevicePixelRatio(qreal 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().

Upstream PySide2 reference signatures (binding differences may apply):

setDevicePixelRatio(self, scaleFactor: float) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#setDevicePixelRatio

setMask

setMask(arg__1: Any) -> None

X.setMask(arg__1)

Supplemental documentation: Qt 5 reference:

void QPixmap::setMask(const QBitmap \&mask)

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.

Upstream PySide2 reference signatures (binding differences may apply):

setMask(self, arg__1: PySide2.QtGui.QBitmap) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#setMask

size

size() -> Any

X.size() -> PythonQt.QtCore.QSize

Supplemental documentation: Qt 5 reference:

QSize QPixmap::size() const

Returns the size of the pixmap.

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

Upstream PySide2 reference signatures (binding differences may apply):

size(self) -> PySide2.QtCore.QSize

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#size

swap

swap(other: Any) -> None

X.swap(other)

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

swap(self, other: PySide2.QtGui.QPixmap) -> None

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#swap

toImage

toImage() -> Any

X.toImage() -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

toImage(self) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#toImage

transformed

transformed(arg__1: Any, mode: Any) -> Any

X.transformed(arg__1, mode) -> PythonQt.QtGui.QPixmap

Supplemental documentation: Qt 5 reference:

QPixmap QPixmap::transformed(const QTransform \&transform, Qt::TransformationMode mode \= Qt::FastTransformation) 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.

Upstream PySide2 reference signatures (binding differences may apply):

transformed(self, arg__1: PySide2.QtGui.QMatrix, mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QPixmap
transformed(self, arg__1: PySide2.QtGui.QTransform, mode: PySide2.QtCore.Qt.TransformationMode=...) -> PySide2.QtGui.QPixmap

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#transformed

trueMatrix

trueMatrix(m: Any, w: int, h: int) -> Any

X.trueMatrix(m, w, h) -> PythonQt.QtGui.QMatrix

Supplemental documentation: Qt 5 reference:

[static] QTransform QPixmap::trueMatrix(const QTransform \&matrix, int width, int height)

Returns the actual matrix used for transforming a pixmap with the given width, height and matrix.

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

See also transformed() and Pixmap Transformations.

Upstream PySide2 reference signatures (binding differences may apply):

trueMatrix(m: PySide2.QtGui.QMatrix, w: int, h: int) -> PySide2.QtGui.QMatrix
trueMatrix(m: PySide2.QtGui.QTransform, w: int, h: int) -> PySide2.QtGui.QTransform

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#trueMatrix

width

width() -> int

X.width() -> int

Supplemental documentation: Qt 5 reference:

int QPixmap::width() const

Returns the width of the pixmap.

See also size() and Pixmap Information.

Upstream PySide2 reference signatures (binding differences may apply):

width(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qpixmap.html#width