Archived:Drawing with monochrome masks may produce incorrect results on S60 3rd Edition FP2 (Known Issue)
hamishwillee
(Talk | contribs) m (Hamishwillee - Bot change of template (Template:KnowledgeBase) - now using Template:ArticleMetaData) |
|||
| Line 7: | Line 7: | ||
__NOEDITSECTION__ | __NOEDITSECTION__ | ||
{{KBKI}} | {{KBKI}} | ||
| − | {{ | + | {{ArticleMetaData |
|id=KIS001171 | |id=KIS001171 | ||
|platform=S60 3rd Edition, Feature Pack 2 | |platform=S60 3rd Edition, Feature Pack 2 | ||
| Line 15: | Line 15: | ||
|creationdate=November 11, 2008 | |creationdate=November 11, 2008 | ||
|keywords=BitBltMasked, EGray2 | |keywords=BitBltMasked, EGray2 | ||
| + | |||
| + | |sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) --> | ||
| + | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | ||
| + | |sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) --> | ||
| + | |devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) --> | ||
| + | |signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer --> | ||
| + | |capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) --> | ||
| + | |author=[[User:Technical writer 1]] | ||
}} | }} | ||
Revision as of 14:43, 24 June 2011
Article Metadata
Tested with
Compatibility
Article
Description
Drawing masked bitmaps using a monochrome (1 bit per pixel) bitmap as a mask may produce incorrect output on S60 3rd Edition, Feature Pack 2 devices.
How to reproduce
Create or load a bitmap (CFbsBitmap) with the same colour depth as the screen device (screen display mode, typically EColor16MU) and an accompanying monochrome bitmap (display mode EGray2) with the identical size.
Draw the bitmap using a masked blit as follows:
void CMyContainerControl::Draw( const TRect& aRect ) const
{
CWindowGc& gc = SystemGc();
TRect rect( Rect() );
gc.BitBltMasked(rect.iTl, iBitmapEColor16MU, rect, iMaskEGray2, EFalse);
}
On some devices, such as the Nokia N85, the monochrome mask does not work correctly but displays vertical stripes instead.
Solution
This problem does not occur when using masks with the colour depth identical to the parent bitmap. However, this consumes significantly more RAM memory compared to using 1-bpp monochrome bitmaps.
However, inverting the monochrome mask seems to produce correct results:
gc.BitBltMasked(rect.iTl, iBitmapEColor16MU, rect, iMaskEGray2, '''ETrue''');
As a workaround for monochrome bitmaps, each mask could be inverted and drawn with the 5th parameter of BitBltMasked() (aInvertMask) set to ETrue.

