输入图像二维数组 直接操作
2 种子坐标
3 宽 高
返回 :
point类型 (可用for循环写入bitmap
Module seed4
Const FillValue As Integer = 9
Private backValue As Integer
Private foreValue As Integer
Private W As Integer
Private H As Integer
Private listCount As Integer
Private list() As Point
Public Function startfill(ByVal X As Integer, ByVal Y As Integer, ByVal array(,) As Integer, ByVal myW As Integer, ByVal myH As Integer) As Point()
If array(X, Y) = 0 Then
foreValue = 0
backValue = 1
Else
foreValue = 1
backValue = 0
End If
listCount = 0
W = myW
H = myH
ReDim list(listCount)
fill(X, Y, array)
Return list
End Function
Public Sub fill(ByVal X As Integer, ByVal Y As Integer, ByVal array(,) As Integer)
array(X, Y) = FillValue
listCount += 1
ReDim Preserve list(listCount)
list(listCount).X = X
list(listCount).Y = Y
If Y > 0 Then
If array(X, Y - 1) = foreValue Then
fill(X, Y - 1, array)
End If
End If
If X < W Then
If array(X + 1, Y) = foreValue Then
fill(X + 1, Y, array)
End If
End If
If Y < H Then
If array(X, Y + 1) = foreValue Then
fill(X, Y + 1, array)
End If
End If
If X > 0 Then
If array(X - 1, Y) = foreValue Then
fill(X - 1, Y, array)
End If
End If
End Sub
End Module
200字以内,仅用于支线交流,主线讨论请采用回复功能。