maskpixmap : Something wrong?

BlitzMax Forums/BlitzMax Programming/maskpixmap : Something wrong?

tonyg(Posted 2006) [#1]
Maskimage1.png is 128*128 containing 2 rects both 64*128 colours 0,0,0 and 255,0,255
Press space and the expected switch of mask colour occurs. So, instead of the pink rect, the black rect appears.
However, press space again and single 128*128 black rect is displayed.
Second, change the maskimage function call to colour 0,0,0 and watch the pink rect gradually increase in size each time space is hit.
Have I done something silly?
Graphics 640,480,0
Local image:TImage=LoadImage("maskimage1.png")
SetClsColor 0,255,0
While Not KeyHit(key_escape)
	Cls
	If KeyHit(KEY_SPACE) image:TImage=maskimage(image,255,0,255)
	DrawImage image,0,0
	Flip
Wend
Function maskimage:TImage(myimage:Timage,r,g,b)
		mypixmap:TPixmap=LockImage(myimage)
		mypixmap:TPixmap=MaskPixmap(mypixmap,r,g,b)
		UnlockImage(myimage)
		myimage:TImage=LoadImage(mypixmap)
		Return myimage
End Function