Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wickdchromosome/flood_fill_png

Essentially the bucket fill tool from MS paint (recursive flood fill algorithm implementation)
https://github.com/wickdchromosome/flood_fill_png

c educational examples floodfill

Last synced: 26 days ago
JSON representation

Essentially the bucket fill tool from MS paint (recursive flood fill algorithm implementation)

Awesome Lists containing this project

README

        

# Simple recursive flood fill algorithm implementation

## What the algorithm looks like in action



## Introduction
This was made based on the wikipedia page on the flood fill algorithm: https://en.wikipedia.org/wiki/Flood_fill

## Compilation
If you have gcc and libpng-dev installed, you can compile the code by doing:
```
./compile.sh
```
If you are on Debian, you can install libpng by doing:
```
sudo apt install libpng-dev
```

## Example
This is an implementation of the recursive version of the flood fill algorithm, so
it is only feasible for usage with smaller images. __test_img.png__ is a test file you can use.

For example, using the test image, you can do:
```
./flood_fill_png test_img.png 60 70 255 255 255 255 0 255 255 150 example_out.png
```
Which turns the test image from:



To:



## General usage
```
flood_fill_png
```
Where:
- *png_in* : Input png image
- *x_root* : X coordinate to start filling from
- *y_root* : Y coordinate to start filling from
- *R* : Red value of target color to replace
- *G* : Green value of target color to replace
- *B* : Blue value of target color to replace
- *A* : Transparency value of target color to replace
- *R_target* : Red value to replace target color with
- *G_target* : Green value to replace target color with
- *B_target* : Blue value to replace target color with
- *A_target* : Transparency value to replace target color with
- *png_out* : Output file name