Realtime pixmap writing

BlitzMax Forums/BlitzMax Beginners Area/Realtime pixmap writing

Graphics 555,555

Local pixmap:TPixmap
Local image:timage =CreateImage(111,111)
Repeat
	

	
	a:+2
	x=50+Cos(a)*40
	y=50+Sin(a)*40
	
	pixmap=LockImage(image)
		ClearPixels(pixmap)
		For f=1 To 10
			WritePixel pixmap,x+f,y+f,$FF0000FF
		Next
		For f=1 To 10
			WritePixel pixmap,x+Cos(a)*f,y+Sin(a)*f,$FFFF0000
		Next
	UnlockImage image
	
	SetColor 255,255,255
	DrawImage image,22,22
	DrawPixmap pixmap,222,222
	
	Flip
	Cls
	 
	If KeyHit(key_escape) Then End
Forever


Use ClearPixels, I presume that when you're re-creating the image, it's sometimes using memory that was previously used, and since you're not overwriting all of it, you get ghost images.