; MaskImage Example ; ----------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; Spark animstrip - its background pixels are bright pink (255,0,255) spark=LoadAnimImage("media/spark.bmp",32,32,0,3) ; Images start with black (0,0,0) as the mask colour; use pink instead MaskImage spark,255,0,255 masked=1 frame=0 timer=MilliSecs() While Not KeyDown(1) Cls ; Space swaps between the pink mask and the default black mask If KeyHit(57) Then masked=1-masked If masked=1 Then MaskImage spark,255,0,255 Else MaskImage spark,0,0,0 End If End If ; Animate the sparks If MilliSecs()>timer+120 Then timer=MilliSecs() frame=(frame+1) Mod 3 End If ; A blue panel behind the sparks makes the transparency obvious Color 0,60,130 Rect 200,160,240,160,True For i=0 To 2 DrawImage spark,240+i*60,220,frame Next Text 0,0,"Space: toggle the mask colour Esc: exit" If masked=1 Then Text 0,20,"MaskImage spark,255,0,255 - pink is now transparent" Else Text 0,20,"MaskImage spark,0,0,0 - default black mask, pink shows as a box" End If Flip Wend End