MP4
Stacks and Queues
filler::dfs Namespace Reference

dfs namespace: specifies a set of filler functions for doing fills on images employing a depth-first-search approach. More...

Functions

animation fillSolid (PNG &img, int x, int y, RGBAPixel fillColor, int tolerance, int frameFreq)
 Performs a flood fill on the given image using a solid color, employing a depth-first-search approach. More...
 
animation fillGrid (PNG &img, int x, int y, RGBAPixel gridColor, int gridSpacing, int tolerance, int frameFreq)
 Performs a flood fill on the given image using a grid, employing a depth-first-search approach. More...
 
animation fillGradient (PNG &img, int x, int y, RGBAPixel fadeColor1, RGBAPixel fadeColor2, int radius, int tolerance, int frameFreq)
 Performs a flood fill on the given image using a gradient, employing a depth-first-search approach. More...
 
animation fill (PNG &img, int x, int y, colorPicker &fillColor, int tolerance, int frameFreq)
 Performs a flood fill on the given image using the given color picker, employing a depth-first-search approach. More...
 

Detailed Description

dfs namespace: specifies a set of filler functions for doing fills on images employing a depth-first-search approach.

Note
All of the functions in this namespace should call the generic filler::dfs::fill function with the the correct color picker parameter (except for, of course, filler::dfs::fill itself).
Author
Chase Geigle
Date
Fall 2012

Function Documentation

animation filler::dfs::fillSolid ( PNG img,
int  x,
int  y,
RGBAPixel  fillColor,
int  tolerance,
int  frameFreq 
)

Performs a flood fill on the given image using a solid color, employing a depth-first-search approach.

Parameters
imgThe image to be filled.
xThe starting x coordinate for the fill.
yThe starting y coordinate for the fill.
fillColorThe color of the fill.
toleranceHow far away colors are allowed to be to still be included in the fill: this is given as squared euclidean distance in RGB space (i.e. \((c1.red - c2.red)^2 + (c1.green - c2.green)^2 + (c1.blue - c2.blue)^2)\).
frameFreqHow frequently to add a frame to the animation, in pixels. For instance, if frameFreq == 1, a frame is added when every pixel is filled. If frameFreq == 10, a frame is added after every 10 pixels is filled.
Returns
An animation that shows the fill progressing over the image.
Todo:
Your code here! You should replace the following line with a correct call to fill with the correct colorPicker parameter.
animation filler::dfs::fillGrid ( PNG img,
int  x,
int  y,
RGBAPixel  gridColor,
int  gridSpacing,
int  tolerance,
int  frameFreq 
)

Performs a flood fill on the given image using a grid, employing a depth-first-search approach.

Parameters
imgThe image to be filled.
xThe starting x coordinate for the fill.
yThe starting y coordinate for the fill.
gridColorThe color the lines of the grid should appear.
gridSpacingThe width and height of the cells of the grid.
toleranceHow far away colors are allowed to be to still be included in the fill: this is given as squared euclidean distance in RGB space (i.e. \((c1.red - c2.red)^2 + (c1.green - c2.green)^2 + (c1.blue - c2.blue)^2)\).
frameFreqHow frequently to add a frame to the animation, in pixels. For instance, if frameFreq == 1, a frame is added when every pixel is filled. If frameFreq == 10, a frame is added after every 10 pixels is filled.
Returns
An animation that shows the fill progressing over the image.
Todo:
Your code here! You should replace the following line with a correct call to fill with the correct colorPicker parameter.
animation filler::dfs::fillGradient ( PNG img,
int  x,
int  y,
RGBAPixel  fadeColor1,
RGBAPixel  fadeColor2,
int  radius,
int  tolerance,
int  frameFreq 
)

Performs a flood fill on the given image using a gradient, employing a depth-first-search approach.

Parameters
imgThe image to be filled.
xThe starting x coordinate for the fill.
yThe starting y coordinate for the fill.
fadeColor1The starting color of the gradient.
fadeColor2The ending color of the gradient.
radiusThe radius for the gradient.
toleranceHow far away colors are allowed to be to still be included in the fill: this is given as squared euclidean distance in RGB space (i.e. \((c1.red - c2.red)^2 + (c1.green - c2.green)^2 + (c1.blue - c2.blue)^2)\).
frameFreqHow frequently to add a frame to the animation, in pixels. For instance, if frameFreq == 1, a frame is added when every pixel is filled. If frameFreq == 10, a frame is added after every 10 pixels is filled.
Returns
An animation that shows the fill progressing over the image.
Todo:
Your code here! You should replace the following line with a correct call to fill with the correct colorPicker parameter.
animation filler::dfs::fill ( PNG img,
int  x,
int  y,
colorPicker fillColor,
int  tolerance,
int  frameFreq 
)

Performs a flood fill on the given image using the given color picker, employing a depth-first-search approach.

Parameters
imgImage to do the filling on.
xX coordinate to start the fill from.
yY coordinate to start the fill from.
fillColorThe colorPicker to be used for the fill.
toleranceHow far away colors are allowed to be to still be included in the fill: this is given as squared euclidean distance in RGB space (i.e. \((c1.red - c2.red)^2 + (c1.green - c2.green)^2 + (c1.blue - c2.blue)^2)\).
frameFreqHow frequently to add a frame to the animation, in pixels. For instance, if frameFreq == 1, a frame is added when every pixel is filled. If frameFreq == 10, a frame is added after every 10 pixels is filled.
Returns
An animation that shows the fill progressing over the image.
Todo:
Your code here! You should replace the following line with a correct call to filler::fill with the correct template parameter indicating the ordering structure to be used in the fill.