Skip to content

PythonQt.QtGui.QBitmap

QBitmap

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

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.

Source: https://doc.qt.io/archives/qt-5.15/qbitmap.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
PaintDeviceMetric attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PdmDepth attribute Any (shared captured text)
PdmDevicePixelRatio attribute Any (shared captured text)
PdmDevicePixelRatioScaled attribute Any (shared captured text)
PdmDpiX attribute Any (shared captured text)
PdmDpiY attribute Any (shared captured text)
PdmHeight attribute Any (shared captured text)
PdmHeightMM attribute Any (shared captured text)
PdmNumColors attribute Any (shared captured text)
PdmPhysicalDpiX attribute Any (shared captured text)
PdmPhysicalDpiY attribute Any (shared captured text)
PdmWidth attribute Any (shared captured text)
PdmWidthMM attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
cacheKey function (self) -> int X.cacheKey() -> int
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clear function (self) -> None Clears the bitmap, setting all its bits to [Qt::color0](https://doc.qt.io/archives/qt-5.15/qt.html#GlobalColor-enum).
colorCount function (self) -> int X.colorCount() -> int (shared captured text)
convertFromImage function (self, img: Any, arg1: flags) -> bool X.convertFromImage(img, flags) -> bool
copy function (self, x: Any, y: Any, width: Any, height: Any) -> Any X.copy(x, y, width, height) -> PythonQt.QtGui.QPixmap
createHeuristicMask function (self, clipTight: Any) -> Any X.createHeuristicMask(clipTight) -> PythonQt.QtGui.QBitmap
createMaskFromColor function (self, maskColor: Any, mode: Any) -> Any X.createMaskFromColor(maskColor, mode) -> PythonQt.QtGui.QBitmap
defaultDepth function (self) -> int X.defaultDepth() -> int
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
depth function (self) -> int X.depth() -> int (shared captured text)
devType function (self) -> int X.devType() -> int (shared captured text)
devicePixelRatio function (self) -> float X.devicePixelRatio() -> float (shared captured text)
devicePixelRatioF function (self) -> float X.devicePixelRatioF() -> float (shared captured text)
devicePixelRatioFScale function (self) -> float X.devicePixelRatioFScale() -> float (shared captured text)
fill function (self, device: Any, xofs: Any, yofs: Any) -> Any X.fill(device, xofs, yofs)
fromImage function (self, image: Any, arg1: flags) -> Any X.fromImage(image, flags) -> PythonQt.QtGui.QBitmap
fromImageReader function (self, imageReader: Any, arg1: flags) -> Any X.fromImageReader(imageReader, flags) -> PythonQt.QtGui.QPixmap
grabWidget function (self, widget: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.grabWidget(widget, x, y, w, h) -> PythonQt.QtGui.QPixmap
grabWindow function (self, arg__1: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.grabWindow(arg__1, x, y, w, h) -> PythonQt.QtGui.QPixmap
hasAlpha function (self) -> bool X.hasAlpha() -> bool
hasAlphaChannel function (self) -> bool X.hasAlphaChannel() -> bool
height function (self) -> int X.height() -> int
heightMM function (self) -> int X.heightMM() -> int (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
initPainter function (self, painter: Any) -> Any (shared captured text)
isNull function (self) -> bool X.isNull() -> bool
isQBitmap function (self) -> bool X.isQBitmap() -> bool
load function (self, fileName: Any, format: Any, arg2: flags) -> bool X.load(fileName, format, flags) -> bool
loadFromData function (self, data: Any, format: Any, arg2: flags) -> bool X.loadFromData(data, format, flags) -> bool
logicalDpiX function (self) -> int X.logicalDpiX() -> int (shared captured text)
logicalDpiY function (self) -> int X.logicalDpiY() -> int (shared captured text)
mask function (self) -> Any X.mask() -> PythonQt.QtGui.QBitmap
metric function (self, arg__1: Any) -> int X.metric(arg__1) -> int (shared captured text)
paintEngine function (self) -> Any X.paintEngine() -> PythonQt.QtGui.QPaintEngine (shared captured text)
paintingActive function (self) -> bool X.paintingActive() -> bool (shared captured text)
physicalDpiX function (self) -> int X.physicalDpiX() -> int (shared captured text)
physicalDpiY function (self) -> int X.physicalDpiY() -> int (shared captured text)
readFrom function (self, arg__1: Any) -> Any (shared captured text)
rect function (self) -> Any X.rect() -> PythonQt.QtCore.QRect
redirected function (self, offset: Any) -> Any X.redirected(offset) -> PythonQt.QtGui.QPaintDevice (shared captured text)
save function (self, device: Any, format: Any, quality: Any) -> bool X.save(device, format, quality) -> bool
scaled function (self, w: Any, h: Any, aspectMode: Any, mode: Any) -> Any X.scaled(w, h, aspectMode, mode) -> PythonQt.QtGui.QPixmap
scaledToHeight function (self, h: Any, mode: Any) -> Any X.scaledToHeight(h, mode) -> PythonQt.QtGui.QPixmap
scaledToWidth function (self, w: Any, mode: Any) -> Any X.scaledToWidth(w, mode) -> PythonQt.QtGui.QPixmap
scroll function (self, dx: Any, dy: Any, x: Any, y: Any, width: Any, height: Any, exposed: Any) -> Any X.scroll(dx, dy, x, y, width, height, exposed)
setDevicePixelRatio function (self, scaleFactor: Any) -> Any
setMask function (self, arg__1: Any) -> Any (shared captured text)
sharedPainter function (self) -> Any X.sharedPainter() -> PythonQt.QtGui.QPainter (shared captured text)
size function (self) -> Any X.size() -> PythonQt.QtCore.QSize
swap function (self, other: Any) -> None Swaps bitmap other with this bitmap.
toImage function (self) -> Any X.toImage() -> PythonQt.QtGui.QImage
transformed function (self, arg__1: Any, mode: Any) -> Any X.transformed(arg__1, mode) -> PythonQt.QtGui.QBitmap
trueMatrix function (self, m: Any, w: Any, h: Any) -> Any X.trueMatrix(m, w, h) -> PythonQt.QtGui.QMatrix
width function (self) -> int X.width() -> int
widthMM function (self) -> int X.widthMM() -> int (shared captured text)
writeTo function (self, arg__1: Any) -> Any (shared captured text)