Bitmap and Bitmap Mask

Login to reply to this topic.
Mon, 2007-10-15 09:47
Joined: 2007-09-19
Forum posts: 71

hi,
I have been trying to use bitmaps in my applications however for every image it requires a bitmap and its bitmap mask..
I have tried creating mask of images through some online site..
however i do not get a proper picture...
I would like to know how do i create the mask's of these bitmao images...
what is the requirement from Symbian ..for mask images..
how do i create the images which give me a view which is seen in normal bitmap images.
Thanks


Mon, 2007-10-15 10:09
Joined: 2004-11-29
Forum posts: 1155
Re: Bitmap and Bitmap Mask

The mask is simply a black and white, or grayscale, image, telling what pixels should be see-through and which should be visible.
You can use any imaging tool for this.
Its not something that can be done 100% automatically, since it is impossible for a computer program to guess your design.

with a black and white mask, you can only specify if the pixel is visible or not, and with a grayscale image, you can get make pixels semi-transparent (which makes it possible to have soft edges on any background)
Full white pixel means pixel is fully transparent, and Full black means pixel is fully opaque (visible)

Mon, 2007-10-15 10:16
Joined: 2007-09-19
Forum posts: 71
Re: Bitmap and Bitmap Mask

hi Alh thanks for your reply...

So if i have a bitmap image A and the mask image is fully black then i would be able to see the Bitmap image as it is..
i would use white or gryscale in my image only if i want transparent images to be drawn otherwise i can use a black image with any other bitmap image to show it as it is...

Thanks again..

Mon, 2007-10-15 10:24
Joined: 2004-11-29
Forum posts: 1155
Re: Bitmap and Bitmap Mask

Yes.

I'm not sure if it has to be the same size as the image though, or if it can be scaled.
Probably it has to be the same size if I trust my symbian intuition...

I don't know how you are trying to display your image, but you only need the mask if you are using BitBlitMasked or DrawBitmapMasked.
if you want to display a square image, you should use BitBlt() or DrawBitmap(), and not use the mask.

Mon, 2007-10-15 10:37
Joined: 2007-09-19
Forum posts: 71
Re: Bitmap and Bitmap Mask

hi
Actually i m using simple API

IMPORT_C CGulIcon *CreateIconL(const TDesC &aFileName, TInt aBitmapId, TInt aMaskId=-1);

which requires a mask id.

So was just confused as in how the mask is to be used because after drawing the icon i couldn get the exact color as of my bitmap image..

Thanks Alh..
Really appreciate your response...

Mon, 2007-10-15 10:55
Joined: 2004-11-29
Forum posts: 1155
Re: Bitmap and Bitmap Mask

If you look closer to the function declaration, it doesn't require a mask id.

If you don't give it, it will default to "-1" which should mean "don't load a mask".

Hopefully, the guy later using the CGulIcon is smart enough to choose a draw method that does not need a mask when drawing the icon.

About your color problem:
One easy-to-make mistake with masks, is if it isn't really 100% black, but just 99% black or something, then your whole image will be slightly semi-transparent, making colors look a bit off.
If the colors look way off (as in completly the wrong color on some pixels, not just a different shade) then the problem might be the mask having the wrong bitmap format. It must be EGray256 or EGray2, all other formats will produce weird results.

Mon, 2007-10-15 10:59
Joined: 2007-09-19
Forum posts: 71
Re: Bitmap and Bitmap Mask


Yeah actually the mask i had created earlier were not correct...

Hey it was great talking to you alh..

Thanks for the help..

  • Login to reply to this topic.