The QBitmap 類提供單色 (1 位深度) 像素圖。 更多...
| 頭: | #include <QBitmap> |
| qmake: | QT += gui |
| 繼承: | QPixmap |
| QBitmap () | |
| QBitmap (const QPixmap & pixmap ) | |
| QBitmap (int width , int height ) | |
| QBitmap (const QSize & size ) | |
| QBitmap (const QString & fileName , const char * format = Q_NULLPTR) | |
| QBitmap (const QBitmap & other ) | |
| ~QBitmap () | |
| void | clear () |
| void | swap (QBitmap & other ) |
| QBitmap | transformed (const QTransform & matrix ) const |
| operator QVariant () const | |
| QBitmap & | operator= (const QBitmap & other ) |
| QBitmap & | operator= (QBitmap && other ) |
| QBitmap & | operator= (const QPixmap & pixmap ) |
| QBitmap | fromData (const QSize & size , const uchar * bits , QImage::Format monoFormat = QImage::Format_MonoLSB) |
| QBitmap | fromImage (const QImage & image , Qt::ImageConversionFlags flags = Qt::AutoColor) |
The QBitmap 類提供單色 (1 位深度) 像素圖。
The 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 對象 Qt::color0 and Qt::color1 當繪製在 QBitmap 對象 (或 QPixmap 對象采用 1 深度)。
描繪采用 Qt::color0 將位圖位設為 0,和描繪采用 Qt::color1 將位圖位設為 1。對於位圖而言,0 位指示背景 (或透明像素),而 1 位指示前景 (或不透明像素)。使用 clear () 函數以將所有位設為 Qt::color0 。注意,使用 Qt::black and Qt::white 顔色沒有意義,因為 QColor::pixel() 值並不一定是黑色為 0,而白色為 1。
The
QBitmap
類提供
transformed
() 函數返迴位圖的變換拷貝;使用
QTransform
argument to translate, scale, shear, and rotate the bitmap. In addition,
QBitmap
provides the static
fromData
() 函數,返迴構造位圖從給定
uchar
數據,而靜態
fromImage
() 函數返迴轉換拷貝為
QImage
對象。
就像 QPixmap class, QBitmap is optimized by the use of implicit data sharing. For more information, see the 隱式數據共享 文檔編製。
另請參閱 QPixmap , QImage , QImageReader ,和 QImageWriter .
構造 null 位圖。
另請參閱 QPixmap::isNull ().
構造位圖拷貝為給定 pixmap .
若像素圖深度大於 1,則結果位圖會自動抖動。
另請參閱 QPixmap::depth (), fromImage (),和 fromData ().
構造位圖采用給定 width and height 。內部的像素未被初始化。
另請參閱 clear ().
構造位圖采用給定 size 。位圖中的像素未被初始化。
另請參閱 clear ().
構造位圖從指定文件通過給定 fileName 。若文件不存在或格式未知,則位圖變為 null 位圖。
The fileName and format 參數被傳遞給 QPixmap::load () 函數。若文件格式使用 1 位以上每像素,則結果位圖會自動抖動。
另請參閱 QPixmap::isNull () 和 QImageReader::imageFormat ().
Copy constructor.
銷毀位圖。
清零位圖,將其所有位設為 Qt::color0 .
[static]
QBitmap
QBitmap::
fromData
(const
QSize
&
size
, const
uchar
*
bits
,
QImage::Format
monoFormat
= QImage::Format_MonoLSB)
構造位圖采用給定 size ,並將內容設為 bits 供給。
位圖數據必須按字節對齊,並按指定位次序提供通過 monoFormat 。單色格式必須是 QImage::Format_Mono or QImage::Format_MonoLSB 。使用 QImage::Format_Mono 指定 XBM 格式數據。
另請參閱 fromImage ().
[static]
QBitmap
QBitmap::
fromImage
(const
QImage
&
image
,
Qt::ImageConversionFlags
flags
= Qt::AutoColor)
返迴副本為給定 image 轉換為位圖,使用指定圖像轉換 flags .
另請參閱 fromData ().
交換位圖 other 與此位圖。此操作很快且從不失敗。
該函數在 Qt 4.8 引入。
返迴此位圖的拷貝,變換根據給定 matrix .
另請參閱 QPixmap::transformed ().
將位圖返迴為 QVariant .
拷貝賦值運算符。
移動賦值運算符。
這是重載函數。
賦值給定 pixmap 到此位圖並返迴此位圖的引用。
若像素圖深度大於 1,則結果位圖會自動抖動。
另請參閱 QPixmap::depth ().