home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_11
/
1011106a
< prev
next >
Wrap
Text File
|
1992-09-02
|
7KB
|
157 lines
case 11: /* perform image addition and subtraction */
printf("\nCIPS> Image Addition:"
"\n output = first + second"
"\n Image Subtractions:"
"\n output = first - second");
printf("\nCIPS> Enter first image name\n");
get_image_name(name);
printf("\nCIPS> Enter second image name\n");
get_image_name(name2);
printf("\nCIPS> Enter output image name\n");
get_image_name(name3);
printf("\nCIPS> Enter parameters for first image");
get_parameters(&il, &ie, &ll, &le);
printf("\nCIPS> Enter parameters for second image");
get_parameters(&il2, &ie2, &ll2, &le2);
printf("\nCIPS> Enter parameters for output image");
get_parameters(&il3, &ie3, &ll3, &le3);
printf("\n\nCIPS> Enter a=addition s=subtraction\n");
printf("\nCIPS> _\b");
read_string(low_high);
if(low_high[0] == 'a' || low_high[0] == 'A')
add_image_array(name, name2, name3,
the_image, out_image,
il, ie, ll, le,
il2, ie2, ll2, le2,
il3, ie3, ll3, le3);
if(low_high[0] == 's' || low_high[0] == 'S')
subtract_image_array(name, name2, name3,
the_image, out_image,
il, ie, ll, le,
il2, ie2, ll2, le2,
il3, ie3, ll3, le3);
break;
case 12: /* image cutting and pasting */
printf("\n\nCIPS> Cut from source image and paste to"
" destination image");
printf("\nCIPS> Enter source image name");
get_image_name(name);
get_parameters(&il, &ie, &ll, &le);
check_cut_and_paste_limits(&il, &ie, &ll, &le);
cut_image_piece(name, the_image,
il, ie, ll, le);
printf("\nCIPS> Enter destination image name");
get_image_name(name2);
printf("\nCIPS> Enter destination image parameters");
get_parameters(&il, &ie, &ll, &le);
check_cut_and_paste_limits(&il, &ie, &ll, &le);
paste_image_piece(name2, name, the_image,
out_image, il, ie, ll, le);
break;
case 13: /* image rotation and flipping */
printf("\nCIPS> Enter source image name");
get_image_name(name);
get_parameters(&il, &ie, &ll, &le);
printf("\nCIPS> Enter destination image name");
printf("\nCIPS> (source can equal destination)");
get_image_name(name2);
printf("\nCIPS> Enter destination image parameters");
get_parameters(&il2, &ie2, &ll2, &le2);
printf("\nCIPS> Enter number of Rotations (1, 2, 3)");
printf("\nCIPS> or type of Flip (4=horizontal 5=vertical)");
printf("\nCIPS> __\b");
get_integer(&rotation_type);
rotate_flip_image_array(name, name2, the_image,
out_image, il, ie, ll, le,
il2, ie2, ll2, le2,
rotation_type);
break;
case 14: /* image scaling */
printf("\nCIPS> Enter input image name");
get_image_name(name);
get_parameters(&il, &ie, &ll, &le);
printf("\nCIPS> Enter output image name");
get_image_name(name2);
get_scaling_options(zoom_shrink, &scale, method);
if(zoom_shrink[0] == 'z' || zoom_shrink[0] == 'Z')
zoom_image_array(name, name2, the_image, out_image,
il, ie, ll, le, scale, method);
if(zoom_shrink[0] == 's' || zoom_shrink[0] == 'S'){
printf("\nCIPS> Enter output image parameters");
get_parameters(&il2, &ie2, &ll2, &le2);
shrink_image_array(name, name2, the_image, out_image,
il, ie, ll, le, il2, ie2, ll2, le2,
scale, method);
}
break;
case 15: /* create image */
printf("\nCIPS> Enter input name of image to create");
get_image_name(name);
printf("\nCIPS> Enter number of %d blocks wide",COLS);
printf("\n ___\b\b");
get_integer(&width);
printf("\nCIPS> Enter number of %d blocks tall",ROWS);
printf("\n ___\b\b");
get_integer(&length);
image_header.lsb = 1;
image_header.bits_per_pixel = 8;
image_header.image_length = length*COLS;
image_header.image_width = width*ROWS;
image_header.strip_offset = 1000;
for(i=0; i<ROWS; i++)
for(j=0; j<COLS; j++)
the_image[i][j] = 0;
create_allocate_tiff_file(name,&image_header,the_image);
break;
case 20: /* exit system */
not_finished = 0;
break;
default:
printf("\nCould not understand response, try again");
break;
/*--------------------------------------------------------------
--------------------------------------------------------------*/
/******************************************************
*
* show_menu(..
*
* This function displays the CIPS main menu.
*
*******************************************************/
show_menu()
{
printf("\n\nWelcome to CIPS");
printf("\nThe C Image Processing System");
printf("\nThese are you choices:");
printf("\n\t1. Display image header");
printf("\n\t2. Show image numbers");
printf("\n\t3. Print image numbers");
printf("\n\t4. Display image (VGA & EGA only)");
printf("\n\t5. Display or print image using halftoning");
printf("\n\t6. Print graphics image using dithering");
printf("\n\t7. Print or display histogram numbers");
printf("\n\t8. Perform edge detection");
printf("\n\t9. Perform edge enhancement");
printf("\n\t10. Perform image filtering");
printf("\n\t11. Perform image addition and subtraction");
printf("\n\t12. Perform image cutting and pasting");
printf("\n\t13. Perform image rotation and flipping");
printf("\n\t14. Perform image scaling");
printf("\n\t15. Create a blank image");
printf("\n\t20. Exit system");
printf("\n\nEnter choice _\b");
} /* ends show_menu */