内容表

上一话题

QBackingStore

下一话题

QBrush

QBitmap

QBitmap class provides monochrome (1-bit depth) pixmaps. 更多

Inheritance diagram of PySide2.QtGui.QBitmap

概要

函数

静态函数

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

详细描述

QBitmap class is a monochrome off-screen paint device used mainly for creating custom QCursor and QBrush 对象,构造 QRegion 对象,及为像素图和 Widget 设置遮罩。

QBitmap QPixmap 子类确保 1 深度,除 0 深度的 null 对象外。若将深度大于 1 的像素图赋值给位图,位图会自动抖动。

使用 QColor 对象 color0 and color1 when drawing on a QBitmap object (or a QPixmap 对象采用 1 深度)。

描绘采用 color0 将位图位设为 0,和描绘采用 color1 将位图位设为 1。对于位图而言,0 位指示背景 (或透明像素),而 1 位指示前景 (或不透明像素)。使用 clear() function to set all the bits to color0 。注意,使用 black and white 颜色没有意义,因为 QColor::pixel() 值并不一定是黑色为 0,而白色为 1。

QBitmap class provides the transformed() function returning a transformed copy of the bitmap; use the QTransform argument to translate, scale, shear, and rotate the bitmap. In addition, QBitmap provides the static fromData() function which returns a bitmap constructed from the given uchar 数据,而静态 fromImage() function returning a converted copy of a QImage 对象。

就像 QPixmap class, QBitmap is optimized by the use of implicit data sharing. For more information, see the 隐式数据共享 文档编制。

class QBitmap

QBitmap(other)

QBitmap(arg__1)

QBitmap(arg__1)

QBitmap(fileName[, format=None])

QBitmap(w, h)

param w

int

param h

int

param format

str

param arg__1

QPixmap

param other

QBitmap

param fileName

unicode

构造 null 位图。

另请参阅

isNull()

构造位图,采用给定 width and height 。内部的像素未被初始化。

另请参阅

clear()

PySide2.QtGui.QBitmap. clear ( )

清零位图,将其所有位设为 color0 .

static PySide2.QtGui.QBitmap. fromData ( size , bits [ , monoFormat=QImage.Format_MonoLSB ] )
参数
  • size QSize

  • bits uchar

  • monoFormat 格式

返回类型

QBitmap

构造位图,采用给定 size , and sets the contents to the bits 供给。

位图数据必须按字节对齐,并按指定位次序提供通过 monoFormat 。单色格式必须是 Format_Mono or Format_MonoLSB 。使用 Format_Mono 指定 XBM 格式数据。

另请参阅

fromImage()

PySide2.QtGui.QBitmap. swap ( other )
参数

other QBitmap

交换位图 other 与此位图。此操作非常快且从不失败。

PySide2.QtGui.QBitmap. transformed ( arg__1 )
参数

arg__1 QMatrix

返回类型

QBitmap

注意

此函数被弃用。

PySide2.QtGui.QBitmap. transformed ( matrix )
参数

matrix QTransform

返回类型

QBitmap