The original heightmap (without black lines) is attached in the first message of the thread...
Here is the code I'm using:
actualX and actualY are the starting point coordinates. W is the width and h is the height or the image. Sealevel is... well... guess what!
Code:
actual = (GetPixel(picMap.hdc, actualX, actualY) And &HFF)
Do
used = False
modX = 0
modY = 0
dif = 255
min = 255
For i = -1 To 1
For j = -1 To 1
used = ((GetPixel(picMap.hdc, actualX + i, actualY + j) And &HFF) = 0)
If actualX + i > 0 And actualY + j > 0 And actualX + i < w And actualY + j < h And Not used Then
testValue = (GetPixel(picMap.hdc, actualX + i, actualY + j) And &HFF)
dif = actual - testValue
If dif >= 0 And dif <= min Then
If i = 0 And j = 0 Then
Else
min = dif
modX = i
modY = j
End If
End If
End If
Next
Next
actualX = actualX + modX
actualY = actualY + modY
actual = (GetPixel(picMap.hdc, actualX, actualY) And &HFF)
Call SetPixel(picMap.hdc, actualX, actualY, 0)
picMap.Refresh
Loop Until (modX = 0 And modY = 0) Or (actual < seaLevel) Or actualX < 0 Or actualY < 0 Or actualX > w Or actualY > h