Version 5.2.0: Add text ifexport option
[ctsim.git] / tools / ifexport.cpp
index 9c1c920e2160410be245228e4811b10ceb9d1c48..f40a34dea99ad90d0e11eeb2350e4b615b0c971c 100644 (file)
@@ -7,7 +7,7 @@
 **   Date Started:  April 2000
 **
 **  This is part of the CTSim program
-**  Copyright (C) 1983-2009 Kevin Rosenberg
+**  Copyright (C) 1983-2010 Kevin Rosenberg
 **
 **  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
@@ -61,11 +61,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_PNG, O_FORMAT_PNG16, O_FORMAT_PGM, O_FORMAT_PGMASC, O_FORMAT_RAW };
+enum { O_FORMAT_PNG, O_FORMAT_PNG16, O_FORMAT_PGM, O_FORMAT_PGMASC, O_FORMAT_RAW, O_FORMAT_TEXT };
 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_TEXT_STR[]="text";
 static const char O_FORMAT_RAW_STR[]="raw";
 
 void
@@ -79,6 +80,8 @@ ifexport_usage (const char *program)
   std::cout << "     --format   Output format\n";
   std::cout << "         pgm    PGM (portable graymap) format (default)\n";
   std::cout << "         pgmasc PGM (portable graymap) ASCII format\n";
+  std::cout << "         text   Text format\n";
+  std::cout << "         raw    Raw format\n";
 #ifdef HAVE_PNG
   std::cout << "         png    PNG (8-bit) format\n";
   std::cout << "         png16  PNG (16-bit) format\n";
@@ -211,6 +214,8 @@ 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_TEXT_STR) == 0)
+                opt_format = O_FORMAT_TEXT;
           else if (strcmp(optarg, O_FORMAT_RAW_STR) == 0)
                 opt_format = O_FORMAT_RAW;
 #if HAVE_GIF
@@ -348,6 +353,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_TEXT)
+        im.writeImageText (out_file);
   else if (opt_format == O_FORMAT_RAW)
         im.writeImageRaw (out_file, opt_scale, opt_scale);
   else