PDA

Click to See Complete Forum and Search --> : I need help with MaskBlt...


V(ery) Basic
Apr 23rd, 2000, 06:14 PM
Will someone PLEASE tell me how to use MaskBlt, because I
think it's what the game I'm planning to make is going to
use. I know the list of what you should put in, but the
return value is always 0 and nothing happens.

Should MaskBlt refer to the same picture for picture and mask?
What do I put in the hbmMask bit?

Will someone please help?

Well, I'll leave you to it.

Bye!

Fox
Apr 26th, 2000, 11:45 PM
What am I doing wrong? ;) I only need 2 blts to make transparent stuff :)

Stevie-O
Apr 26th, 2000, 11:50 PM
Well, it depends.
If the transparent area of your image is black (rgb 0 0 0), you only need two blits, the AND mask, then the XOR mask. However, if the transparent area of your image is any other color (which is often the case if you use an unused color to generate the mask), then you need three blits - the XOR mask, the AND mask, and the XOR mask again.

Fox
Apr 26th, 2000, 11:52 PM
I see.
Well, I took white as transparent...

Stevie-O
Apr 27th, 2000, 02:33 AM
Err, it might be black. The point is, if you pick a color like RGB(255,0,255) (bright pink/purple), two Blits will leave the transparent area a bit...colored.

V(ery) Basic
Apr 30th, 2000, 02:56 AM
Ah, well. Next time I need to set a value to zero I'll use MaskBlt ;)

Thanks for the advice ;)

I'm just going to add another question:

I made a function MyBitBlt, which basically makes a sprite
The function goes like this:


Function MyBitBlt(Dst As PictureBox, Src As PictureBox, Mask As PictureBox, ByVal X As Long, ByVal Y As Long)
Call BitBlt(Dst.hDC, X, Y, Mask.ScaleWidth, Mask.ScaleHeight, Mask.hDC, _
0, 0, vbSrcAnd)
Call BitBlt(Dst.hDC, X, Y, Mask.ScaleWidth, Mask.ScaleHeight, Src.hDC, _
0, 0, vbSrcInvert)
End Function


So why is is soooo f************ slow?

Any advice form you VB pros?