How can I draw bitmap on screen making one color transparent

Iam using function -
StretchDIBits() to display DIB to the screen.
I want to make one color transparent(e.g background color)
Can any one tell Which raster operation I will use to display it.

I tried with Transparentblt() also but it is not supportting my version windows.It require win98 more than version 4.

So Plz anyone tell me the solution...

Help me out
[401 byte] By [umeshSharma_ait] at [2007-11-18 2:08:40]
# 1 Re: How can I draw bitmap on screen making one color transparent
If you can't use TransparentBlt, then you probably can't use AlphaBlend either. I think the only thing left to do is write your own function. Just loop through each pixel in the source, and if it's not equal to the transparent color, copy it to the destination. Let me know if you need some help with this.

Kelly
Runt888 at 2007-11-10 8:56:11 >
# 2 Re: How can I draw bitmap on screen making one color transparent
Quote:

I tried with Transparentblt() also but it is not supportting my version windows.It require win98 more than version 4.

You did not specify, which windows version you are using. I faced similar problems where I was trying to use certain functions which were protected by version guards.
If you are using Win98, Include the following in your stdafx.h

# define _WIN32_WINNT 0x0410

in case of Win 2000 use 0x0500 and 0x0501 in case of XP.
chmanish at 2007-11-10 8:57:09 >
# 3 Re: How can I draw bitmap on screen making one color transparent
Hi Runt888,
I tried with Alphablend() But with that is the same case. Also if I will do for with each pixel it will be very slow.
I need any raster operation which give better respose.
If u have anyother soution plz let me know.

-Umesh
umeshSharma_ait at 2007-11-10 8:58:08 >
# 4 Re: How can I draw bitmap on screen making one color transparent
You have several options. 1. you can create a mask of the transparent portions (black for transparent and white for the bitmap) and then combine the source, mask, and dest using the AND & OR ROPs (sorry, forget the exact sequence). 2. create an offscreen image and combine the souce and dest as described before - this is essentially exactly what Transperant blt does.
bytz at 2007-11-10 8:59:12 >
# 5 Re: How can I draw bitmap on screen making one color transparent
As bytz said, if you can't use TransparentBlt or AlphaBlend, and you can't make a mask, you'll need to implement it yourself. I have done this before, it's not much slower than TransparentBlt. You also might want to look into OpenGL or DirectX (although DirectX doesn't support alpha blending for bitmaps, so you'd have to use textures or sprites).

Kelly
Runt888 at 2007-11-10 9:00:11 >