PySide.QtGui.QBitmap class provides monochrome (1-bit depth) pixmaps.
PySide.QtGui.QBitmap class is a monochrome off-screen paint device used mainly for creating custom PySide.QtGui.QCursor and PySide.QtGui.QBrush 对象,构造 PySide.QtGui.QRegion 对象,及为像素图和 Widget 设置遮罩。
PySide.QtGui.QBitmap 是 PySide.QtGui.QPixmap 子类确保 1 深度,除 0 深度的 null 对象外。若将深度大于 1 的像素图赋值给位图,位图会自动抖动。
使用 PySide.QtGui.QColor 对象 Qt.color0 and Qt.color1 when drawing on a PySide.QtGui.QBitmap object (or a PySide.QtGui.QPixmap 对象采用 1 深度)。
描绘采用 Qt.color0 将位图位设为 0,和描绘采用 Qt.color1 将位图位设为 1。对于位图而言,0 位指示背景 (或透明像素),而 1 位指示前景 (或不透明像素)。使用 PySide.QtGui.QBitmap.clear() function to set all the bits to Qt.color0 。注意,使用 Qt.black and Qt.white colors make no sense because the QColor.pixel() value is not necessarily 0 for black and 1 for white.
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 数据,而静态 PySide.QtGui.QBitmap.fromImage() function returning a converted copy of a PySide.QtGui.QImage 对象。
就像 PySide.QtGui.QPixmap class, PySide.QtGui.QBitmap is optimized by the use of implicit data sharing. For more information, see the 隐式数据共享 文档编制。
| 参数: |
|
|---|
构造 null 位图。
另请参阅
构造位图拷贝为给定 pixmap .
若像素图深度大于 1,则结果位图会自动抖动。
另请参阅
QPixmap.depth() PySide.QtGui.QBitmap.fromImage() PySide.QtGui.QBitmap.fromData()
构造位图,采用给定 size 。位图中的像素未被初始化。
构造位图从文件指定通过给定 fileName 。若文件不存在或格式未知,则位图变为 null 位图。
fileName and format 参数被传递给 QPixmap.load() function. If the file format uses more than 1 bit per pixel, the resulting bitmap will be dithered automatically.
构造位图,采用给定 width and height 。内部的像素未被初始化。
清零位图,将其所有位设为 Qt.color0 .
| 参数: |
|
|---|---|
| 返回类型: |
| 参数: | other – PySide.QtGui.QBitmap |
|---|
交换位图 other 与此位图。此操作非常快且从不失败。
| 参数: | matrix – PySide.QtGui.QTransform |
|---|---|
| 返回类型: | PySide.QtGui.QBitmap |
返回此位图的拷贝,变换根据给定 matrix .
| 参数: | arg__1 – PySide.QtGui.QMatrix |
|---|---|
| 返回类型: | PySide.QtGui.QBitmap |
这是重载函数。
This convenience function converts the matrix 到 PySide.QtGui.QTransform and calls the overloaded function.