Trouble with Pixmaps

BlitzMax Forums/BlitzMax Beginners Area/Trouble with Pixmaps

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 dont understand how I would handle the output of ReadPixel, or construct input for Write pixel either

Strict
Graphics 800,600,0
Local Image:Timage = LoadImage ("Cursor.bmp")
DrawImage(Image, 0,0)
ColourSub(Image,0,0,128, 200,140,0)
DrawImage(Image, 64, 0)
Flip
Delay 5000

Function ColourSub(Image:TImage,OldR,OldG,OldB,NewR,NewG,NewB)
	Local Pix:TPixmap = LockImage(Image)
	Local x:Int, y:Int
	Local OldColour:Int = (255 Shl 24)|(OldR Shl 16)|(OldG Shl 8)|OldB 
	Local NewColour:Int = (255 Shl 24)|(NewR Shl 16)|(NewG Shl 8)|NewB 
	For x=0 Until PixmapWidth(Pix)
		For y=0 Until PixmapHeight(Pix)
			If ReadPixel(Pix,x,y) = OldColour
				WritePixel(Pix,x,y,NewColour)
			EndIf
		Next
	Next
	UnlockImage(Image)
End Function