www.pudn.com > CG2Programs.rar > boundaryFill.c


/* boundaryFill, Chapter 4, p. 128 */

#include "device.h"

/* EXAMPLE STARTS HERE */
void boundaryFill4 (int x, int y, int fill, int boundary)
{
  int current;

  current = getPixel (x, y);
  if ((current != boundary) && (current != fill)) {
    setColor (fill);
    setPixel (x, y);
    boundaryFill4 (x+1, y, fill, boundary);
    boundaryFill4 (x-1, y, fill, boundary);
    boundaryFill4 (x, y+1, fill, boundary);
    boundaryFill4 (x, y-1, fill, boundary);
  }
}
/* EXAMPLE ENDS HERE */