Obsolete Members for QImage

以下成員源於類 QImage 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

公共函數

(obsolete) QImage alphaChannel () const
(obsolete) int numBytes () const
(obsolete) int numColors () const
(obsolete) int serialNumber () const
(obsolete) void setAlphaChannel (const QImage & alphaChannel )
(obsolete) void setNumColors (int n )
(obsolete) void setText (const char * key , const char * 語言 , const QString & text )
(obsolete) QString text (const char * key , const char * 語言 = Q_NULLPTR) const
(obsolete) QString text (const QImageTextKeyLang & keywordAndLanguage ) const
(obsolete) QStringList textLanguages () const
(obsolete) QList<QImageTextKeyLang> textList () const

成員函數文檔編製

QImage QImage:: alphaChannel () const

Returns the alpha channel of the image as a new grayscale QImage in which each pixel's red, green, and blue values are given the alpha value of the original image. The color depth of the returned image is 8-bit.

You can see an example of use of this function in QPixmap 's alphaChannel() , which works in the same way as this function on QPixmaps.

Most usecases for this function can be replaced with QPainter and using composition modes.

Note this returns a color-indexed image if you want the alpha channel in the alpha8 format instead use convertToFormat ( Format_Alpha8 ) on the source image.

警告: This is an expensive function.

另請參閱 setAlphaChannel (), hasAlphaChannel (), convertToFormat (), Pixmap ,和 圖像變換 .

int QImage:: numBytes () const

返迴由圖像數據占據的字節數。

另請參閱 byteCount ().

int QImage:: numColors () const

返迴圖像的顔色錶大小。

另請參閱 setNumColors () 和 setColorCount ().

int QImage:: serialNumber () const

返迴內容標識數對於此 QImage 對象。截然不同的 QImage objects can only have the same serial number if they refer to the same contents (but they don't have to).

使用 cacheKey () 代替。

警告: The serial number doesn't necessarily change when the image is altered. This means that it may be dangerous to use it as a cache key.

另請參閱 operator== ().

void QImage:: setAlphaChannel (const QImage & alphaChannel )

將此圖像的 Alpha 通道設為給定 alphaChannel .

alphaChannel is an 8 bit grayscale image, the intensity values are written into this buffer directly. Otherwise, alphaChannel is converted to 32 bit and the intensity of the RGB pixel values is used.

Note that the image will be converted to the Format_ARGB32_Premultiplied format if the function succeeds.

Use one of the composition modes in QPainter::CompositionMode 代替。

警告: This function is expensive.

另請參閱 alphaChannel (), 圖像變換 ,和 圖像格式 .

void QImage:: setNumColors ( int n )

重置顔色錶大小以包含 n 條目。

另請參閱 numColors () 和 setColorCount ().

void QImage:: setText (const char * key , const char * 語言 , const QString & text )

將圖像文本設為給定 text 並將其關聯到給定 key . The text is recorded in the specified 語言 , or in a default language if 語言 為 0。

使用 setText () 代替。

The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.

QString QImage:: text (const char * key , const char * 語言 = Q_NULLPTR) const

Returns the text recorded for the given key 以給定 語言 , or in a default language if 語言 為 0。

使用 text () 代替。

The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.

QString QImage:: text (const QImageTextKeyLang & keywordAndLanguage ) const

這是重載函數。

Returns the text recorded for the given keywordAndLanguage .

使用 text () 代替。

The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.

QStringList QImage:: textLanguages () const

Returns the language identifiers for which some texts are recorded. Note that if you want to iterate over the list, you should iterate over a copy.

The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.

另請參閱 textKeys ().

QList < QImageTextKeyLang > QImage:: textList () const

Returns a list of QImageTextKeyLang objects that enumerate all the texts key/language pairs set for this image.

The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.

另請參閱 textKeys ().