Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

使用单色遮罩绘制图片得到正确结果

From Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台: S60 3rd Edition, FP2
S60 3rd Edition FP2

文章
翻译:
hoolee
最后由 hamishwillee 在 06 Aug 2012 编辑


  • 详细描述

使用单色位图(每像素1bit)作为遮罩绘制透明图片,可能在S60第三版FP2手机上生成错误的结果。


  • 如何重演

如果使用和手机屏幕(screen display mode,典型为EColor16MU)相同的色深载入或生成位图(CFbsBitmap),配合同样大小单色遮罩图片(显示模式为EGray2)。

使用遮罩绘制图片:

void CMyContainerControl::Draw( const TRect& aRect ) const
{
CWindowGc& gc = SystemGc();
TRect rect( Rect() );
gc.BitBltMasked(rect.iTl, iBitmapEColor16MU, rect, iMaskEGray2, EFalse);
}

在某些手机上,如Nokia N85,单色遮罩可能无法正确工作,而显示垂直条纹。


  • 解决方案

当使用与父图片一致的色深时不会出现这个问题,但是和使用1-bpp单色图片比较这会显著耗费更多的RAM内存。

但反转单色遮罩图似乎能得到正确结果:

gc.BitBltMasked(rect.iTl, iBitmapEColor16MU, rect, iMaskEGray2, '''ETrue''');

作为单色位图的解决方案,每个遮罩都可以反转,只要绘制时将BitBltMasked()的第五个参数设置为ETrue.

This page was last modified on 6 August 2012, at 07:29.
74 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×