I want to achieve a true overlay drawing method.
My SDI view has an image, i want to draw on a overlay surface on top of this
image, This drawing should be erased without corrupting the image (hence
overlay drawing).
Most example i find on the net shows drawing on OnPaint / OnDraw handlers
only..
I have few classes that is doing DC drawing on a memory DC. And once all
drawing is done i bitblt the mem DC drawing on to the screen. My problem is
the memDC bitmap is not transparent, so how to create/set a bitmap to
Transparent.. ?
i have tried the masking method but they result in my drawing colours being
corrupted if that portion of the background image is too bright...
~Blessed 2009~
Regards
Note that since (b) is a separate step, it doesn't change the image.
And indeed you want to do it in the OnPaint/OnDraw handlers.
Note that you can do it to a memory DC, because (a) and (b) above don't care if they are
drawing to the screen or a memory DC.
You would have to use alpha-blending, and therefore not BitBlt but use CDC::AlphaBlend.
Note the problem about "drawing colors being corrupted" deals with how colors combine, and
that is not going to magically fix itself, because it is a function of how the
transparency works. That is, if you take a piece of transparent red cellophane and place
it over a color image, blues look black, yellows look orange, etc., and you should expect
to see that phenomenon here as well.
Does this help?
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
> You would have to use alpha-blending, and therefore not BitBlt but use
> CDC::AlphaBlend.
>
> Note the problem about "drawing colors being corrupted" deals with how
> colors combine, and
> that is not going to magically fix itself, because it is a function of how
> the
> transparency works. That is, if you take a piece of transparent red
> cellophane and place
> it over a color image, blues look black, yellows look orange, etc., and
> you should expect
> to see that phenomenon here as well.
>
> Does this help?
> joe
>
Yes it does joe..
but unable to use AlphaBlend, AC_SRC_ALPHA is not defined in wingdi.h of
my system. plus AlphaBlend exist as a win32 SDK function not a member of MFC
CDC:: . I am still using VS6.0
then i tried TransparentBlt.... since my drawing already have a coloured
background... i just specified that background colour to be transparent
using TransparentBlt..
then it worked! ... thank you Joe..
Glad TransparentBlt works for you.
joe