/* Double Images */
void doubleImage( image full, image *twice )
{
int r, c, p ;
/* construct an image structure of the appropriate size */
if ( !newImage( twice, full.nrows*2, full.ncols*2 ) )
{
printf("doubleImages(): newImage() failed\n" );
exit( EXIT_FAILURE );
}
for ( r=0; r<full.nrows; r++ )
for ( c=0; c<full.ncols; c++ )
{
p = getPixel( full, r, c ) ;
setPixel( *twice, r*2, c*2, (unsigned char)p );
setPixel( *twice, r*2, c*2+1, (unsigned char)p );
setPixel( *twice, r*2+1, c*2, (unsigned char)p );
setPixel( *twice, r*2+1, c*2+1, (unsigned char)p );
}
}
Comments: