X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=tools%2Fifexport.cpp;h=245d34c24c931834791b9428ca98c671b68b28bc;hp=4b4c5043c1f4d6b2df71be8560386dd45b0b607b;hb=8a7697ce57b56cdc43698cd1241ad98d49f9b5ac;hpb=03df7888191e78f927537a2993d20e402d4d4997 diff --git a/tools/ifexport.cpp b/tools/ifexport.cpp index 4b4c504..245d34c 100644 --- a/tools/ifexport.cpp +++ b/tools/ifexport.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ifexport.cpp,v 1.1 2000/12/17 22:39:23 kevin Exp $ +** $Id$ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -48,7 +48,7 @@ static struct option my_options[] = {0, 0, 0, 0} }; -static const char* g_szIdStr = "$Id: ifexport.cpp,v 1.1 2000/12/17 22:39:23 kevin Exp $"; +static const char* g_szIdStr = "$Id$"; enum { O_AUTO_FULL, O_AUTO_STD0_1, O_AUTO_STD0_5, O_AUTO_STD1, O_AUTO_STD2, O_AUTO_STD3 }; static const char O_AUTO_FULL_STR[]="full"; @@ -63,13 +63,12 @@ static const char O_CENTER_MEAN_STR[]="mean"; static const char O_CENTER_MODE_STR[]="mode"; static const char O_CENTER_MEDIAN_STR[]="median"; -enum { O_FORMAT_GIF, O_FORMAT_PNG, O_FORMAT_PNG16, O_FORMAT_PGM, O_FORMAT_PGMASC, O_FORMAT_DISP }; -static const char O_FORMAT_GIF_STR[]="gif"; +enum { O_FORMAT_PNG, O_FORMAT_PNG16, O_FORMAT_PGM, O_FORMAT_PGMASC, O_FORMAT_RAW }; static const char O_FORMAT_PNG_STR[]="png" ; static const char O_FORMAT_PNG16_STR[]="png16" ; static const char O_FORMAT_PGM_STR[]="pgm"; static const char O_FORMAT_PGMASC_STR[]="pgmasc"; -static const char O_FORMAT_DISP_STR[]="disp"; +static const char O_FORMAT_RAW_STR[]="raw"; void ifexport_usage (const char *program) @@ -86,10 +85,6 @@ ifexport_usage (const char *program) std::cout << " png PNG (8-bit) format\n"; std::cout << " png16 PNG (16-bit) format\n"; #endif -#if HAVE_G2 - std::cout << " gif GIF format\n"; -#endif - std::cout << " disp Display on screen\n"; std::cout << " --center Center of window\n"; std::cout << " median Median is center of window (default)\n"; std::cout << " mode Mode is center of window\n"; @@ -218,13 +213,13 @@ ifexport_main (int argc, char *const argv[]) else if (strcmp(optarg, O_FORMAT_PNG16_STR) == 0) opt_format = O_FORMAT_PNG16; #endif + else if (strcmp(optarg, O_FORMAT_RAW_STR) == 0) + opt_format = O_FORMAT_RAW; #if HAVE_GIF else if (strcmp(optarg, O_FORMAT_GIF_STR) == 0) opt_format = O_FORMAT_GIF; #endif - else if (strcmp(optarg, O_FORMAT_DISP_STR) == 0) - opt_format = O_FORMAT_DISP; - else { + else { sys_error (ERR_SEVERE, "Invalid format mode %s", optarg); ifexport_usage(argv[0]); return (1); @@ -259,22 +254,13 @@ ifexport_main (int argc, char *const argv[]) } } -#if HAVE_SGP - if (optind + 1 == argc) - opt_format = O_FORMAT_DISP; // display image if no options -#endif - - if ((opt_format == O_FORMAT_DISP && optind + 1 != argc) - || (opt_format != O_FORMAT_DISP && optind + 2 != argc)) { + if (optind + 2 != argc) { ifexport_usage(argv[0]); return (1); } in_file = argv[optind]; - - if (opt_format != O_FORMAT_DISP) - out_file = argv[optind+1]; - else out_file = NULL; + out_file = argv[optind+1]; pim = new ImageFile (); ImageFile& im = *pim; @@ -364,13 +350,8 @@ ifexport_main (int argc, char *const argv[]) else if (opt_format == O_FORMAT_GIF) im.writeImageGIF (out_file, opt_scale, opt_scale, densmin, densmax); #endif - else if (opt_format == O_FORMAT_DISP) { -#if HAVE_SGP - im.displayScaling (opt_scale, densmin, densmax); - std::cout << "Press enter to continue\n"; - cio_kb_getc(); -#endif - } + else if (opt_format == O_FORMAT_RAW) + im.writeImageRaw (out_file, opt_scale, opt_scale); else { sys_error (ERR_SEVERE, "Internal Error: Invalid format mode %d", opt_format); @@ -389,9 +370,9 @@ main (int argc, char *const argv[]) try { retval = ifexport_main(argc, argv); } catch (exception e) { - cerr << "Exception: " << e.what() << std::endl; + std::cerr << "Exception: " << e.what() << std::endl; } catch (...) { - cerr << "Unknown exception\n"; + std::cerr << "Unknown exception\n"; } return (retval);