mp_traversals
Terrible Traversals
|
This class is used to do flood fill on an image. More...
#include <FloodFilledImage.h>
Public Member Functions | |
FloodFilledImage (const PNG &png) | |
Constructs a new instance of a FloodFilledImage with a image png . More... | |
void | addFloodFill (ImageTraversal &traversal, ColorPicker &colorPicker) |
Adds a FloodFill operation to the FloodFillImage. More... | |
Animation | animate (unsigned frameInterval) const |
Creates an Animation of frames from the FloodFill operations added to this object. More... | |
This class is used to do flood fill on an image.
One or more FloodFill operations will be added and executed in the order they are added in. Each operation should flood-fill the entire image. Each operation should have its own traversal method and color picker.
FloodFilledImage::FloodFilledImage | ( | const PNG & | png | ) |
Constructs a new instance of a FloodFilledImage with a image png
.
png | The starting image of a FloodFilledImage |
void FloodFilledImage::addFloodFill | ( | ImageTraversal & | traversal, |
ColorPicker & | colorPicker | ||
) |
Adds a FloodFill operation to the FloodFillImage.
This function must store the operation, which will be used by animate
.
traversal | ImageTraversal used for this FloodFill operation. |
colorPicker | ColorPicker used for this FloodFill operation. |
Animation FloodFilledImage::animate | ( | unsigned | frameInterval | ) | const |
Creates an Animation of frames from the FloodFill operations added to this object.
Each FloodFill operation added by addFloodFill
is executed based on the order the operation was added. This is done by:
While applying the FloodFill to the image, an Animation is created by saving the image after every frameInterval
pixels are filled. To ensure a smooth Animation, the first frame is always the starting image and the final frame is always the finished image.
(For example, if frameInterval
is 4
the frames are: