I've just read the thread below, but I still don't get it !!!! RAHHH !!!
The image that works as a mask is in black & white, where white will be replaced by the original background image, am I right ???
Ok this part is easy... but when I do the SrcInvert to the other image, the part that has to remain transparent changes color, sometimes brighter.
The images that I'm trying to merge with the background are ICOs or a BMPs with Magenta where the transparency will take place.
A little help please.... I´ve already read the section of BitBlt of Fox's but didn't find any clue... (Fox, your page is awesome, what happens here is that I've my mind stuck)
vbSrcPaint will subtract the colors from the target, and because black is like 0 it does not affect the picture (AnyColor - 0 = AnyColor), while the white part does (AnyColor - White = 0 'Probably less than 0 but we dont care!). What you get is the black mask on the target without any border.
Now adding the player is likely the same, we just overwrite the black "hole" we just made on the target (0 + AnyColor = AnyColor). The white border wont affect the target - because using vbSrcAnd and white wont do anything
Apart from this you dont really need to know how this BitBlt transparency works.. it just works and you can make any picture transparent, thats what you need isnt it
First Paint, then And. This is because My original picture has a white BG and the mask is white on black. But yours is the other way around (black bg) *g
Hmm? vbSrcPaint first and then vbSrcAnd? I use it in the other way and it works fine...vbSrcAnd paints black color but not white and vbSrcPaint paints all except black.
I just found out how fast BitBlt really is, I draw 400 graphics per frame (in my test program, each image 50x50 pixels) in full screen (800x600x16) and it's still 10 FPS. Faster than a graphics engine I did with DJGPP, lol
Well finally with the tips you all gave me I manage to do it... It took me 4 steps :
1. BitBlt Mask into Texture_BackGround with vbSrcAnd
2. Make Inverted Mask into a New Picture Box using vbNotSrcCopy
3. BitBlt Inverted Mask into Picture (Ico or BMP with magenta)
using vbSrcAnd
4. BitBlt the resulting image of step 3 into the resulting image of
step 1 using vbSrcPaint
This is working, don´t know if it's the best way of doing it... if one of you know any shortcut let me know... Thank you all again !!!!
Humm...Why don't ya just do the drawing directly to the destination picturebox? Then you need only two phases. I see no real point doing inverting, except if you have made white area to be visible and black transparent (in the mask).
I've tried to follow the instructions that you all gave me (the two phases) but didn't work... for what I saw, the problem is when I do the srcPaint of the picture into the background whith the black area (where it's supposed to copy the image that I want), if I did that whit the Icon image that I previously loaded into a temporaly picturebox, the transparent area of the icon (that has the color of the picturebox -- grey --) will make the background brighter. Then if I did that with the BMP with Magenta color as the transparent area, it will make an strange combination of magenta with the color of the background (that was orange with brown stripes).
Check out the attatchment, there you can see what happens... If you see anything wrong let me now