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 * language , const QString & text )
(obsolete) QString text (const char * key , const char * language = 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 * language , const QString & text )

将图像文本设为给定 text 并将其关联到给定 key . The text is recorded in the specified language , or in a default language if language 为 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 * language = Q_NULLPTR) const

Returns the text recorded for the given key 以给定 language , or in a default language if language 为 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 ().