Selaa lähdekoodia

Add TImage.Clear(r,g,b,a,frameIndex)

Ronny Otto 2 vuotta sitten
vanhempi
commit
ef47dbfd76
1 muutettua tiedostoa jossa 12 lisäystä ja 0 poistoa
  1. 12 0
      max2d.mod/image.bmx

+ 12 - 0
max2d.mod/image.bmx

@@ -28,6 +28,18 @@ Type TImage
 		Return frames[index]
 		Return frames[index]
 	End Method
 	End Method
 	
 	
+	Method Clear(r:UInt, g:UInt, b:UInt, a:Float = 1.0, frameIndex:Int = -1)
+		Local clearColor:Int = Int(int(255*a) * $1000000) + Int(r * $10000) + Int(g * $100) + b
+		If frameIndex < 0
+			For Local p:TPixmap = EachIn pixmaps
+				p.ClearPixels(clearColor)
+			Next
+		Else
+			Local p:TPixmap = Lock(frameIndex, True, True)
+			p.ClearPixels(clearColor)
+		EndIf
+	End Method
+	
 	Method Lock:TPixmap( index:Int,read:Int,write:Int )
 	Method Lock:TPixmap( index:Int,read:Int,write:Int )
 		Assert index < seqs.length And index < frames.length Else "Index out of bounds"
 		Assert index < seqs.length And index < frames.length Else "Index out of bounds"
 		If write
 		If write