示例#1
0
/*this fill function is currently a stub (function that compiles and operates
  in some expected manner but doesn't actually work).  It only fills in the top left 10x10 pixel
area with the fill colour passed in and its return value is always true
*/
bool fill(PixMap& image,const Pixel& fillColour,int x, int y){
	if (image.getPixel(x, y) == fillColour) {
		image.setPixel(fillColour, x, y);

		return true;
	}
	image.setPixel(fillColour, x, y);
	if(x < image.width()-1){
	fill(image, fillColour, x+1, y);
	}
	if(x > 0){
	fill(image, fillColour, x-1, y);
	}
	if(y < image.height()-1 ){
	fill(image, fillColour, x, y + 1);
	}
	if(y > 0){
	fill(image, fillColour, x, y - 1);
	}
	return true;

}