bigbaz34
bigbaz34

Reputation: 395

Using TransparentBlt

I am trying to get my head round using the TransparentBlt function in visual c++ MFC. What I am aiming to achieve is to put one bitmap over the top of the other. The first bitmap is just a standard Stretchblt. The second bitmap is to be placed over the top of the background of the first bitmap. I have made the background of the second bitmap icon pink and I do not want the pink to be visible. Basically I just want to use a function for displaying the icon without showing the pink, how do I do this?

#define TRANSPARENT_MASK RGB(250,84,248)

This is how I have done my the bottom layer bitmaps.

 argDC->StretchBlt(WindowRect.left,WindowRect.top,WindowRect.Width(),WindowRect.Height(),
                  &memDC,0,0,bits.bmWidth-1, bits.bmHeight-1, SRCCOPY);

Upvotes: 1

Views: 2374

Answers (1)

valdo
valdo

Reputation: 12951

The last argument of TransparentBlt is crTransparent - the color that should be "transparent". You should specify TRANSPARENT_MASK in your case

Upvotes: 2

Related Questions