Blending Pictures 
Author Message
 Blending Pictures

I have found two API to Alpha blend pictures together: the AlphaBlend API
and the GdiAlphaBlend. The problem is that my two pictures are bitmaps of
irregular shapes with a black background. When the red part of one shape
blends with the black background from the other picture I get dark red when
there should just be red. This is because it thinks the black part is part
of the shape when it actually should be transparent. Take a look at this
screen shot to see what I mean:

http://www.*-*-*.com/

Are there anyways to get around this? Or other ways to alpha bland images?

Thanks,

Alex



Mon, 05 Jul 2004 02:01:19 GMT  
 Blending Pictures
If the dark red region should be bright red, then by the same logic, the green portions should be yellow.  Are colors important?  If they aren't, would a BitBlt SRCPAINT or SRCINVERT operation achieve the desired result?

Howard Henry Schlunder

Quote:

> I have found two API to Alpha blend pictures together: the AlphaBlend API
> and the GdiAlphaBlend. The problem is that my two pictures are bitmaps of
> irregular shapes with a black background. When the red part of one shape
> blends with the black background from the other picture I get dark red when
> there should just be red. This is because it thinks the black part is part
> of the shape when it actually should be transparent. Take a look at this
> screen shot to see what I mean:

> http://homepage.ntlworld.com/alex.spurling/Screenshot.gif

> Are there anyways to get around this? Or other ways to alpha bland images?

> Thanks,

> Alex



Mon, 05 Jul 2004 04:57:28 GMT  
 Blending Pictures
all you've done is mixed colors. do-it-yourself method :

b_Pixel = (Pixel_2 And &HFF) * shade + (Pixel_1 And &HFF) * (1. - shade)
Or _
((Pixel_2 And &HFF00&) * shade + (Pixel_1 And &HFF00&) * (1. - shade))
And &HFF00& Or _
((Pixel_2 And &HFF0000) * (shade) + (Pixel_1 And &HFF0000) * ((1. -
shade))) And &HFF0000

'Pixel_1' and 'Pixel_2' are the pixel colors of the two source images at
the same destination x,y
'shade' is a blending factor (0.0 - 1.0)
image_2 is superimposed on image_1, the 'shade' factor controls the
translucency of image_2.
shade=0.0 -> 100% translucency (destination image = image_1)

pete

Quote:

> I have found two API to Alpha blend pictures together: the AlphaBlend API
> and the GdiAlphaBlend. The problem is that my two pictures are bitmaps of
> irregular shapes with a black background. When the red part of one shape
> blends with the black background from the other picture I get dark red when
> there should just be red. This is because it thinks the black part is part
> of the shape when it actually should be transparent. Take a look at this
> screen shot to see what I mean:

> http://homepage.ntlworld.com/alex.spurling/Screenshot.gif

> Are there anyways to get around this? Or other ways to alpha bland images?

> Thanks,

> Alex



Mon, 05 Jul 2004 23:19:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. fading of two pictures (blend one picture into the other)

2. per pixel alpha blending

3. per pixel alpha blending

4. Alpha Blending

5. Blend of Context Menu??

6. alpha blending puzzle

7. alpha blending w/o directx

8. How to do a Blend Transition

9. Alpha Blended Usercontrol For Translucent Effect

10. Blending BackColor of rectangles

11. Texture blending

12. Blending textures

 

 
Powered by phpBB® Forum Software