QBitmap¶

Synopsis¶
Functions¶
def
clear()def
swap(other)def
transformed(arg__1)def
transformed(matrix)
Static functions¶
def
fromData(size, bits[, monoFormat=QImage.Format_MonoLSB])
Detailed Description¶
The
QBitmapclass is a monochrome off-screen paint device used mainly for creating customQCursorandQBrushobjects, constructingQRegionobjects, and for setting masks for pixmaps and widgets.
QBitmapis aQPixmapsubclass 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
QColorobjectscolor0andcolor1when drawing on aQBitmapobject (or aQPixmapobject with depth 1).Painting with
color0sets the bitmap bits to 0, and painting withcolor1sets the bits to 1. For a bitmap, 0-bits indicate background (or transparent pixels) and 1-bits indicate foreground (or opaque pixels). Use theclear()function to set all the bits tocolor0. Note that using theblackandwhitecolors make no sense because the QColor::pixel() value is not necessarily 0 for black and 1 for white.The
QBitmapclass provides thetransformed()function returning a transformed copy of the bitmap; use theQTransformargument to translate, scale, shear, and rotate the bitmap. In addition,QBitmapprovides the staticfromData()function which returns a bitmap constructed from the givenuchardata, and the staticfromImage()function returning a converted copy of aQImageobject.Just like the
QPixmapclass,QBitmapis optimized by the use of implicit data sharing. For more information, see the Implicit Data Sharing documentation.See also
- class PySide2.QtGui.QBitmap¶
PySide2.QtGui.QBitmap(other)
PySide2.QtGui.QBitmap(arg__1)
PySide2.QtGui.QBitmap(arg__1)
PySide2.QtGui.QBitmap(fileName[, format=None])
PySide2.QtGui.QBitmap(w, h)
- param w:
int
- param h:
int
- param format:
str
- param arg__1:
- param other:
- param fileName:
str
Constructs a null bitmap.
See also
Constructs a bitmap with the given
widthandheight. The pixels inside are uninitialized.See also
- PySide2.QtGui.QBitmap.clear()¶
Clears the bitmap, setting all its bits to
color0.
- static PySide2.QtGui.QBitmap.fromData(size, bits[, monoFormat=QImage.Format_MonoLSB])¶
- Parameters:
size –
PySide2.QtCore.QSizebits – str
monoFormat –
Format
- Return type:
Constructs a bitmap with the given
size, and sets the contents to thebitssupplied.The bitmap data has to be byte aligned and provided in in the bit order specified by
monoFormat. The mono format must be eitherFormat_MonoorFormat_MonoLSB. UseFormat_Monoto specify data on the XBM format.See also
fromImage()
- PySide2.QtGui.QBitmap.swap(other)¶
- Parameters:
other –
PySide2.QtGui.QBitmap
Swaps bitmap
otherwith this bitmap. This operation is very fast and never fails.
- PySide2.QtGui.QBitmap.transformed(arg__1)¶
- Parameters:
arg__1 –
PySide2.QtGui.QMatrix- Return type:
Note
This function is deprecated.
- PySide2.QtGui.QBitmap.transformed(matrix)
- Parameters:
matrix –
PySide2.QtGui.QTransform- Return type:
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.