TextureFloodFill

Description
Two extension methods for Texture2D which allows you to perform a floodfill operation on the texture.

FloodFillArea will fill the area around the reference point as long as the color stays the same. The reference coler is taken from the start-point-pixel.

FloodFillBorder will fill the area around the reference point until it reaches the given border color.

Both functions only perform a 4-direction method (north,east,south,west). This equals the behaviour of usual filling methods like in MS Paint.

Usage
Place this script somewhere in your project or in "Assets/Standard Assets/" if you want to use the functions from a foreign language (not C#).

To use it you can simply call the desired function like this from any language:

where "texture" is a Texture2D variable with a texture that is "writable".

TextureExtension.cs
Author: Bunny83