masking images

Blitz3D Forums/Blitz3D Beginners Area/masking images

how does this all work i tryed to mask an image and it did nothing. <sob>. does the back background have to be set as transparant.

Black gets masked out during Drawimage() by default. You can alter this to whatever colour you like with MaskImage() though.

Graphics 800,600,0,2
SetBuffer BackBuffer()
HidePointer

Color 255,255,255
Text 10,10,"Plotting is slow..."
Flip : Cls

Text 10,10,"Gordon's alive?!"
textBuffer=CreateImage(130,20)
GrabImage textBuffer,10,10

textBuffer2=CreateImage(130,20)
GrabImage textBuffer2,10,10
MaskImage textBuffer2,255,255,255

For x=0 To 799
For y=0 To 599
	Color Rand(100,200),Rand(100,200),Rand(100,200)
	Plot x,y
Next
Next
bgBuffer=CreateImage(800,600)
GrabImage bgBuffer,0,0

While Not KeyHit(1)
DrawBlock bgBuffer,0,0
DrawImage textBuffer,MouseX(),MouseY()
DrawImage textBuffer2,MouseX(),MouseY()+30

Flip
Cls
Wend


So that's two identical images... one version with black masked and the second version with white masked. Alpha info is ignored by the 2D command set.