I13 Answer


/* Make the pixels of an image gradually increase by rows */
void wedgeImage( image img, int min, int max )
{
  int r, c;
  unsigned char rowLevel;
  
  for ( r = 0; r<img.nrows; r++ )
  {
    rowLevel = min + ((max-min)*r)/img.nrows;
    for ( c = 0; c<img.ncols; c++ )
      setPixel( img, r, c, rowLevel );
  }
}

Comments: The complete program is nearly the same as for puzzle I12, but uses the above function.

back