Floodfill Application
Background
In this studio, you will be using a parallel and recursive method to create an app that fills in a space with color, much like the paint bucket in MS Paint.
Where to Start
In order to test this application, please refer to the visualization classes provided for you under floodfill.viz
. More specifically, check out the FloodFillVizApp.java
class. Otherwise, the only class you will need to modify is StudentFloodFiller.java
, which can be found under floodfill.assignment
. As usual, we recommend checking out all of the classes under the core directory to get your bearings on the project.
The Kernel
The class is composed of two methods: floodFill and floodFillKernel. As you will be implementing FloodFill recursively and in parallel, you have to carefully consider where to put the asyncs and finishes so that your application maximizes parallelization. To accomplish this, we will call the kernel in the floodFill method. This is so that the kernel can run recursively and asynchronously so the floodFill method can wrap the kernel in an all-inclusive finish.
The kernel should check if the given pixel is in bounds. If it is, it should check if the given pixel matches the targetColor (the color we wish to change). If it is, it should then replace the color with the replacementColor and asynchronously call the method again to repeat the process for the surrounding pixels. The purpose of the assignment is to understand recursion and how to make it work in parallel.