SetMaskColor and GrabImage

BlitzMax Forums/BlitzMax Beginners Area/SetMaskColor and GrabImage

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I have imported a bb game into bmax and am having trouble understanding all the SetBlend/SetMaskColor/CreateImage/GrabImage command settings required to get my code to work. In B3D, I loaded a bmp and then grabbed each tile, setting the mask color each time:
Function TilesLoad()
	Local Palette%
	Local TileW%
	Local k%
	
	Palette%=LoadImage("Palette.tmp")
	If Palette%<>0 Then
		CurrentBuffer%=GraphicsBuffer()
		SetBuffer ImageBuffer(Palette%)
		TileW%=TileSize%-1
		For k%=0 To MaxTiles%-1
			Tiles%(k%+1)=CreateImage(TileW%,TileW%)
			GrabImage Tiles%(k%+1),k%*TileW%,0
			MaskImage Tiles%(k%+1),192,192,255
		Next
		SetBuffer CurrentBuffer%
		FreeImage Palette%
	EndIf
End Function

In bmax, I tried the following:
Function TilesLoad()
	Local Palette:TImage
	Local TileW%
	Local k%
	
	SetMaskColor 1,1,1 ' I seem to need this or bmax alphablends any black areas when I DrawImage to the BackBuffer despite SOLIDBLEND...
	Palette=LoadImage("Palette.tmp")
	If Palette<>Null Then
		Cls
		SetColor 255,255,255
		SetBlend SOLIDBLEND
		DrawImage Palette,0,0
		SetBlend ALPHABLEND
		TileW%=TileSize%-1
		SetMaskColor 192,192,255
		For k%=0 To MaxTiles%-1
			Tiles:TImage[k%+1]=CreateImage(TileW%,TileW%,DYNAMICIMAGE|MASKEDIMAGE)
			GrabImage Tiles[k%+1],k%*TileW%,0
		Next
		Palette=Null
		GCCollect
	EndIf
End Function

but the mask color is ignored later when I DrawImage the grabbed Tiles[]. I am evidently making a very basic error - probably due to my lack of understanding as to how all these commands integrate with each other - so if anyone can tell me what I am going wrong I would be very grateful!!