No description
What algorithm is used ? Are there other ones ? Description of the used method.
I think adding this info makes this project more desireable.
It uses some sort of flood fill algorithm. It's nothing too special, but I'll explain how it works:
First it grabs the indexes of all the transparent pixels that are next to a non-transparent one ("border" pixels, one could say). With that it builds an initial "pending" list for processing. In that initial pass it also stores which pixels are transparent and which aren't (for the entire image). Note that whenever I say "transparent" I mean alpha=0.
The processing loop basically goes through that pending list of transparent pixels and computes a color for it based on the average of non-transparent neighbour pixels. The processed pixel will be considered transparent during one given pass but not during subsequent ones. That is, during one pass the computed color of a pixel will never affect the average color for other processed pixels, but it will affect the color for whatever other transparent pixels could be there on subsequent passes (this is basically to avoid the result from depending on the order in which pixels are iterated). Every time a pixel is processed, its transparent neighbours are added to a new "pending" list for the next iteration. This repeats until there are no more pending pixels.
In any case, anyone using this to avoid the typical filtering issues and border artifacts in games and the sort should consider switching to premultiplied alpha blending, which is by far a better solution to that (check this for more info: https://blogs.msdn.microsoft.com/shawnhar/2009/11/06/premultiplied-alpha/). Perhaps I should mention this somewhere...