标题:【提问】QPixmap的setMask()和selfMask()是干么用的???
作者:ok2005
日期:2005-11-18 15:36
内容:
QPixmap的setMask()和selfMask()是干么用的?
看了自带的说明,没弄明白//。。。。。
再就是clip是什么意思?看到好多次了,一直都晕着//。。。
原文:
void QPixmap::setMask ( const QBitmap & newmask )
Sets a mask bitmap.
The newmask bitmap defines the clip mask for this pixmap. Every pixel in newmask corresponds to a pixel in this pixmap. Pixel value 1 means opaque and pixel value 0 means transparent. The mask must have the same size as this pixmap.
Warning: Setting the mask on a pixmap will cause any alpha channel data to be cleared. For example:
QPixmap alpha( "image-with-alpha.png" );
QPixmap alphacopy = alpha;
alphacopy.setMask( *alphacopy.mask() );
bool QPixmap::selfMask () const
Returns TRUE if the pixmap's mask is identical to the pixmap itself; otherwise returns FALSE.
#1 [tdrhsb 11-22 23:19]
自己翻译啊,还要问吗?
#2 [ok2005 11-23 16:45]
..........没看明白才问。。。。。
#3 [yzh_yzh_2000 02-22 06:29]
好象是用这样的代码会清掉原来图像中的Ahpha信息吧,我也是今天刚看到,我是这么理解的.MASK应该是用来去掉图像中的某个颜色透明显示
#4 [haulm 02-22 08:20]
setMask()是遮罩,可以用来做不规则窗体,可惜我做出来的只能用指令行执行,双击却是无标题的方块,怪诞的很。selfMask应该是用自身对图片进行遮罩处理,还有一个autoMask。