Table Of Contents

Previous topic

QImage

Next topic

QGraphicsLayoutItem

QBitmap

Inheritance diagram of QBitmap

Synopsis

Functions

Static functions

  • def fromData (size, bits[, monoFormat=QImage.Format_MonoLSB])

Detailed Description

The PySide.QtGui.QBitmap class provides monochrome (1-bit depth) pixmaps.

The PySide.QtGui.QBitmap class is a monochrome off-screen paint device used mainly for creating custom PySide.QtGui.QCursor and PySide.QtGui.QBrush objects, constructing PySide.QtGui.QRegion objects, and for setting masks for pixmaps and widgets.

PySide.QtGui.QBitmap is a PySide.QtGui.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 PySide.QtGui.QColor objects Qt.color0 and Qt.color1 when drawing on a PySide.QtGui.QBitmap object (or a PySide.QtGui.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 PySide.QtGui.QBitmap.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 PySide.QtGui.QBitmap class provides the PySide.QtGui.QBitmap.transformed() function returning a transformed copy of the bitmap; use the PySide.QtGui.QTransform argument to translate, scale, shear, and rotate the bitmap. In addition, PySide.QtGui.QBitmap provides the static PySide.QtGui.QBitmap.fromData() function which returns a bitmap constructed from the given uchar data, and the static PySide.QtGui.QBitmap.fromImage() function returning a converted copy of a PySide.QtGui.QImage object.

Just like the PySide.QtGui.QPixmap class, PySide.QtGui.QBitmap is optimized by the use of implicit data sharing. For more information, see the Implicit Data Sharing documentation.

class PySide.QtGui.QBitmap
class PySide.QtGui.QBitmap(arg__1)
class PySide.QtGui.QBitmap(arg__1)
class PySide.QtGui.QBitmap(fileName[, format=0])
class PySide.QtGui.QBitmap(w, h)
Parameters:
  • wPySide.QtCore.int
  • hPySide.QtCore.int
  • format – str
  • fileName – unicode
  • arg__1PySide.QtGui.QPixmap

Constructs a null bitmap.

See also

QPixmap.isNull()

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

QPixmap.depth() PySide.QtGui.QBitmap.fromImage() PySide.QtGui.QBitmap.fromData()

Constructs a bitmap with the given size . The pixels in the bitmap are uninitialized.

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 and format parameters are passed on to the QPixmap.load() function. If the file format uses more than 1 bit per pixel, the resulting bitmap will be dithered automatically.

Constructs a bitmap with the given width and height . The pixels inside are uninitialized.

PySide.QtGui.QBitmap.clear()

Clears the bitmap, setting all its bits to Qt.color0 .

static PySide.QtGui.QBitmap.fromData(size, bits[, monoFormat=QImage.Format_MonoLSB])
Parameters:
Return type:

PySide.QtGui.QBitmap

PySide.QtGui.QBitmap.transformed(matrix)
Parameters:matrixPySide.QtGui.QTransform
Return type:PySide.QtGui.QBitmap

Returns a copy of this bitmap, transformed according to the given matrix .

PySide.QtGui.QBitmap.transformed(arg__1)
Parameters:arg__1PySide.QtGui.QMatrix
Return type:PySide.QtGui.QBitmap

This is an overloaded function.

This convenience function converts the matrix to a PySide.QtGui.QTransform and calls the overloaded function.