When I try to runt the attached code, no errors appear in the program, yet the app stops working and the code stops running, nothing comes up as an error, or a suggestion to fix the issue, I'm not sure what the error is, as the code seems like it should work fine.
Any suggestions would be more than welcome, as this is for my A2 Computing coursework, and the deadline is next week!
Thanks
Any suggestions would be more than welcome, as this is for my A2 Computing coursework, and the deadline is next week!
Thanks
B4X:
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