Sub Globals
Dim bm As Bitmap
Dim col As Int
Dim new_color As Int
Dim old_color As Int
End Sub
Sub Panel1_Touch (Action As Int, X As Float, Y As Float)
Case "fill"
new_color = pencolor
old_color = Paper.Bitmap.GetPixel(X, Y)
If old_color <> new_color Then
fill(X,Y)
Activity.Invalidate
End If
End Select
End If
End Sub
Public Sub fill(x As Int, y As Int)
'Dim old_color As Color = bm.GetPixel(x, y)
Paper.DrawLine(x, y, x, y, new_color, 1dip)
col = Paper.bitmap.GetPixel(x - 1, y)
If col = old_color Then
fill(x-1, y)
End If
col = Paper.bitmap.GetPixel(x + 1, y)
If col = old_color Then
fill(x+1, y)
End If
col = Paper.bitmap.GetPixel(x, y - 1)
If col = old_color Then
fill(x, y-1)
End If
col = Paper.bitmap.GetPixel(x, y + 1)
If col = old_color Then
fill(x, y+1)
End If
End Sub