Skip to content

PythonQt.Qt.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 (shared captured text)
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). (shared captured text)
colorCount function (self) -> int X.colorCount() -> int (shared captured text)
convertFromImage function (self, img: Any, arg1: flags) -> bool X.convertFromImage(img, flags) -> bool (shared captured text)
copy function (self, x: Any, y: Any, width: Any, height: Any) -> Any X.copy(x, y, width, height) -> PythonQt.QtGui.QPixmap (shared captured text)
createHeuristicMask function (self, clipTight: Any) -> Any X.createHeuristicMask(clipTight) -> PythonQt.QtGui.QBitmap (shared captured text)
createMaskFromColor function (self, maskColor: Any, mode: Any) -> Any X.createMaskFromColor(maskColor, mode) -> PythonQt.QtGui.QBitmap (shared captured text)
defaultDepth function (self) -> int X.defaultDepth() -> int (shared captured text)
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) (shared captured text)
fromImage function (self, image: Any, arg1: flags) -> Any X.fromImage(image, flags) -> PythonQt.QtGui.QBitmap (shared captured text)
fromImageReader function (self, imageReader: Any, arg1: flags) -> Any X.fromImageReader(imageReader, flags) -> PythonQt.QtGui.QPixmap (shared captured text)
grabWidget function (self, widget: Any, x: Any, y: Any, w: Any, h: Any) -> Any X.grabWidget(widget, x, y, w, h) -> PythonQt.QtGui.QPixmap (shared captured text)
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 (shared captured text)
hasAlpha function (self) -> bool X.hasAlpha() -> bool (shared captured text)
hasAlphaChannel function (self) -> bool X.hasAlphaChannel() -> bool (shared captured text)
height function (self) -> int X.height() -> int (shared captured text)
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 (shared captured text)
isQBitmap function (self) -> bool X.isQBitmap() -> bool (shared captured text)
load function (self, fileName: Any, format: Any, arg2: flags) -> bool X.load(fileName, format, flags) -> bool (shared captured text)
loadFromData function (self, data: Any, format: Any, arg2: flags) -> bool X.loadFromData(data, format, flags) -> bool (shared captured text)
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 (shared captured text)
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 (shared captured text)
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 (shared captured text)
scaled function (self, w: Any, h: Any, aspectMode: Any, mode: Any) -> Any X.scaled(w, h, aspectMode, mode) -> PythonQt.QtGui.QPixmap (shared captured text)
scaledToHeight function (self, h: Any, mode: Any) -> Any X.scaledToHeight(h, mode) -> PythonQt.QtGui.QPixmap (shared captured text)
scaledToWidth function (self, w: Any, mode: Any) -> Any X.scaledToWidth(w, mode) -> PythonQt.QtGui.QPixmap (shared captured text)
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) (shared captured text)
setDevicePixelRatio function (self, scaleFactor: Any) -> Any (shared captured text)
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 (shared captured text)
swap function (self, other: Any) -> None Swaps bitmap other with this bitmap. (shared captured text)
toImage function (self) -> Any X.toImage() -> PythonQt.QtGui.QImage (shared captured text)
transformed function (self, arg__1: Any, mode: Any) -> Any X.transformed(arg__1, mode) -> PythonQt.QtGui.QBitmap (shared captured text)
trueMatrix function (self, m: Any, w: Any, h: Any) -> Any X.trueMatrix(m, w, h) -> PythonQt.QtGui.QMatrix (shared captured text)
width function (self) -> int X.width() -> int (shared captured text)
widthMM function (self) -> int X.widthMM() -> int (shared captured text)
writeTo function (self, arg__1: Any) -> Any (shared captured text)