QBitmap¶

Synopsis¶
Functions¶
def
clear
()def
swap
(other)def
transformed
(arg__1)def
transformed
(matrix)
Detailed Description¶
The
QBitmap
class is a monochrome off-screen paint device used mainly for creating customQCursor
andQBrush
objects, constructingQRegion
objects, and for setting masks for pixmaps and widgets.
QBitmap
is aQPixmap
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
objectscolor0
andcolor1
when drawing on aQBitmap
object (or aQPixmap
object with depth 1).Painting with
color0
sets the bitmap bits to 0, and painting withcolor1
sets 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 theblack
andwhite
colors make no sense because the QColor::pixel() value is not necessarily 0 for black and 1 for white.The
QBitmap
class provides thetransformed()
function returning a transformed copy of the bitmap; use theQTransform
argument to translate, scale, shear, and rotate the bitmap. In addition,QBitmap
provides the staticfromData()
function which returns a bitmap constructed from the givenuchar
data, and the staticfromImage()
function returning a converted copy of aQImage
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.See also
-
class
QBitmap
¶ Constructs a null bitmap.
See also
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
depth()
fromImage()
fromData()
Constructs a bitmap with the given
size
. The pixels in the bitmap are uninitialized.See also
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
andformat
parameters are passed on to theload()
function. If the file format uses more than 1 bit per pixel, the resulting bitmap will be dithered automatically.See also
Constructs a bitmap with the given
width
andheight
. 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 –
QSize
bits –
uchar
monoFormat –
Format
- Return type
Constructs a bitmap with the given
size
, and sets the contents to thebits
supplied.The bitmap data has to be byte aligned and provided in in the bit order specified by
monoFormat
. The mono format must be eitherFormat_Mono
orFormat_MonoLSB
. UseFormat_Mono
to specify data on the XBM format.See also
fromImage()
-
PySide2.QtGui.QBitmap.
swap
(other)¶ - Parameters
other –
QBitmap
Swaps bitmap
other
with this bitmap. This operation is very fast and never fails.
-
PySide2.QtGui.QBitmap.
transformed
(arg__1)¶ -
Note
This function is deprecated.
This is an overloaded function.
This convenience function converts the
matrix
to aQTransform
and calls the overloaded function.
-
PySide2.QtGui.QBitmap.
transformed
(matrix) - Parameters
matrix –
QTransform
- Return type
Returns a copy of this bitmap, transformed according to the given
matrix
.See also