Greetings to all.
Can anyone help me with regards to implementing a flood fill algorithm? My code thus far is below, I keep getting an invalid parameter used error as soon as the algorithm approaches the bottom boundary of the shape I wish to fill (i've stepped it through and discovered this).
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
If anyone has any idea what could be causing the problem, please let me know.
Thanks in advance,
- perps.
	
		
			
		
		
	
				
			Can anyone help me with regards to implementing a flood fill algorithm? My code thus far is below, I keep getting an invalid parameter used error as soon as the algorithm approaches the bottom boundary of the shape I wish to fill (i've stepped it through and discovered this).
			
				VB.NET:
			
		
		
		Dim xCord As Integer = e.X
            Dim yCord As Integer = e.Y
            Dim xCount As Integer
            Dim yCount As Integer
            Dim BottomEdge As Boolean = False
            ' for xCount at the x mouse co-ordinate to the right hand edge of the bmp
            ' compare the current pixel colour to the background colour by comparing toString.
            ' if current pixel is the same as the background colour, then change it's colour to the selected colour.
            For yCount = yCord To bmp.Height Step +1
                ' Handles all pixels to the right of the mouse co-ordinates.
                For xCount = xCord To bmp.Width Step +1
                    ' If got pixel and background pixel are the same, then make got pixel the selected colour.
                    If bmp.GetPixel(xCount, yCount).ToArgb = picMain.BackColor.ToArgb Then
                        bmp.SetPixel(xCount, yCount, pnlColour.BackColor)
                        ' If got pixel and background colour AREN'T the same, i.e outside the right edge of
                        ' the shape, then exit for loop.
                    Else 
                        Exit For
                    End If
                Next
                ' Handles all pixels to the left of the mouse co-ordinates.
                For xCount = xCord - 1 To 0 Step -1
                    If bmp.GetPixel(xCount, yCount).ToArgb = picMain.BackColor.ToArgb Then
                        bmp.SetPixel(xCount, yCount, pnlColour.BackColor)
                        ' Else case where pixel colour is not the same as the background (i.e already filled), then exit.
                    Else
                        Exit For
                    End If
                Next
            Next
        End If
	Thanks in advance,
- perps.