strange pixmap/image issue?

BlitzMax Forums/BlitzMax Programming/strange pixmap/image issue?

hint check your alpha - try to understand how setblend works and how it relates to setmaskcolor. sorry no time to explain have to go. When I come back I'll explain:

try this:

SeedRnd MilliSecs()
Graphics 800,600
SetBlend maskblend 
SetMaskColor(255,0,255)

Global pm:TPixmap = CreatePixmap(200,200,PF_RGBA8888)

For Local j:Int =0 Until pm.height
	For Local i:Int =0 Until pm.width
		
		If Rand(0,10) Then
			WritePixel(pm,i,j, toARGB(255,0,255,255))
		Else
			WritePixel(pm,i,j, toARGB(125,255,0,255))
		EndIf
		
	Next
Next

img = LoadImage(pm)

Repeat
	Cls()

	DrawImage img, 100,100 

	paintHole(pm,20,20)
	img = LoadImage(pm)
	Flip()
	
	Delay(2500)
	
Until KeyHit(KEY_ESCAPE)


Function toARGB:Int(a:Int,r:Int,g:Int,b:Int)
	Return ((a Shl 24)|(r Shl 16)|(g Shl 8)|b)
End Function


Function paintHole(pm:TPixmap, x:Int, y:Int)
	' ...
	
	For Local j:Int =0 To 50
		For Local i:Int =0 To 50
			WritePixel(pm,x+i,y+j,toARGB(125,255,0,255))
		Next
	Next
		
End Function