/* Make all pixels of an image the same value */ void clearImage( image img, const unsigned char val) { int r, c; for ( r = 0; r<img.nrows; r++ ) for ( c = 0; c<img.ncols; c++ ) setPixel( img, r, c, val ); }
Comments: This is nearly the same as the answer to I11. It should be easy to modify it so that it uses the above function.