I'm trying to implement flood fill method for raster image. For center pixels it's easy and works correct, but the problem is to fill pixels near border, which have different color.
For example, if draw Black figure on White background, some border pixels will have kind of gray color instead of black (for smoothing).
Image editors (like paint.net) during floodfill fixes it changing these pixels to some middle color between old and new one. Here I filled figure in red color, and gray pixels became in red gradient

I need to know method or algorithm how gray pixels became in kind of color to fill (here it's red, but can be any) using RGB pixel manipulation.
Thanks for any help.
ci, start pixel colorc0and filling colorc1for example like this:ci = c1*|ci|/|c0|unless you are dealing with black colors.Do not forget to handle saturations (normalize). You can also use difference:|ci-c0|/maxdifwheremaxdifis threshold for filling .... - Spektre