def
clear
()
def
swap
(other)
def
transformed
(arg__1)
def
transformed
(matrix)
QBitmapclass is a monochrome off-screen paint device used mainly for creating customQCursorandQBrush对象,构造QRegion对象,及为像素图和 Widget 设置遮罩。
QBitmap是QPixmap子类确保 1 深度,除 0 深度的 null 对象外。若将深度大于 1 的像素图赋值给位图,位图会自动抖动。使用
QColor对象color0andcolor1when drawing on aQBitmapobject (or aQPixmap对象采用 1 深度)。描绘采用
color0将位图位设为 0,和描绘采用color1将位图位设为 1。对于位图而言,0 位指示背景 (或透明像素),而 1 位指示前景 (或不透明像素)。使用clear()function to set all the bits tocolor0。注意,使用blackandwhite颜色没有意义,因为 QColor::pixel() 值并不一定是黑色为 0,而白色为 1。
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 givenuchar数据,而静态fromImage()function returning a converted copy of aQImage对象。就像
QPixmapclass,QBitmapis optimized by the use of implicit data sharing. For more information, see the 隐式数据共享 文档编制。
PySide2.QtGui.QBitmap.
clear
(
)
¶
清零位图,将其所有位设为
color0
.
PySide2.QtGui.QBitmap.
fromData
(
size
,
bits
[
,
monoFormat=QImage.Format_MonoLSB
]
)
¶
size
–
QSize
bits
–
uchar
monoFormat
–
格式
构造位图,采用给定
size
, and sets the contents to the
bits
供给。
位图数据必须按字节对齐,并按指定位次序提供通过
monoFormat
。单色格式必须是
Format_Mono
or
Format_MonoLSB
。使用
Format_Mono
指定 XBM 格式数据。
另请参阅
fromImage()
PySide2.QtGui.QBitmap.
transformed
(
matrix
)
¶
matrix
–
QTransform