/[projet1]/public/pc/tools/osdk/main/pictconv/sources/pictconv.cpp
Defence Force logotype

Diff of /public/pc/tools/osdk/main/pictconv/sources/pictconv.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1074 by dbug, Sun Nov 24 13:29:03 2013 UTC revision 1075 by dbug, Sun Jan 12 20:13:41 2014 UTC
# Line 100  int __cdecl main(int argc,char *argv[]) Line 100  int __cdecl main(int argc,char *argv[])
100      " -nn   Defines the number of entries per line.\r\n"      " -nn   Defines the number of entries per line.\r\n"
101      "       -n16 => Output 16 values each line\r\n"      "       -n16 => Output 16 values each line\r\n"
102      "       -n40 => Output 40 values each line\r\n"      "       -n40 => Output 40 values each line\r\n"
103        "\r\n"
104        " -un   Update check.\r\n"
105        "       -u0 => Do not check if files are up to date [default]\r\n"
106        "       -u1 => Perform a date check on the files and only update if needed\r\n"
107        "\r\n"
108        " -vn   Verbosity.\r\n"
109        "       -v0 => Silent [default]\r\n"
110        "       -v1 => Shows information about what PictConv is doing\r\n"
111      );      );
112    
113  #ifdef _DEBUG  #ifdef _DEBUG
# Line 111  int __cdecl main(int argc,char *argv[]) Line 119  int __cdecl main(int argc,char *argv[])
119  #endif  #endif
120    
121    DEVICE_FORMAT output_format=DEVICE_FORMAT_BASIC_TAPE;    DEVICE_FORMAT output_format=DEVICE_FORMAT_BASIC_TAPE;
122    //bool                        flag_basic_loader=true;    //bool flag_basic_loader=true;
123    bool                  flag_testing=false;    bool  flag_testing   = false;
124      bool  flagUpdateTest = false;
125      bool  flagVerbosity  = false;
126    
127    TextFileGenerator textFileGenerator;    TextFileGenerator textFileGenerator;
128    textFileGenerator.SetLabel("_LabelPicture");    textFileGenerator.SetLabel("_LabelPicture");
# Line 268  int __cdecl main(int argc,char *argv[]) Line 278  int __cdecl main(int argc,char *argv[])
278        //        1 => enabled        //        1 => enabled
279        flag_testing=argumentParser.GetBooleanValue(true);        flag_testing=argumentParser.GetBooleanValue(true);
280      }      }
281        else
282        if (argumentParser.IsSwitch("-u"))
283        {
284          //testing: [-u]
285          //        0 => no update check
286          //        1 => do update check
287          flagUpdateTest=argumentParser.GetBooleanValue(true);
288        }
289        else
290        if (argumentParser.IsSwitch("-v"))
291        {
292          //testing: [-v]
293          //        0 => silent
294          //        1 => verbose
295          flagVerbosity=argumentParser.GetBooleanValue(true);
296        }
297    }    }
298      
299    if (argumentParser.GetParameterCount()!=NB_ARG)    if (argumentParser.GetParameterCount()!=NB_ARG)
300    {    {
301      ShowError(0);      ShowError(0);
# Line 306  int __cdecl main(int argc,char *argv[]) Line 332  int __cdecl main(int argc,char *argv[])
332    std::string source_name=argumentParser.GetParameter(0);    std::string source_name=argumentParser.GetParameter(0);
333    std::string dest_name=argumentParser.GetParameter(1);    std::string dest_name=argumentParser.GetParameter(1);
334    
   
   //  
   // Initialize free image  
   //  
   FreeImage_Initialise();  
   
335    //    //
336    // Try to load the source picture    // Eventual time stamp check
337    //    //
338    ImageContainer sourceImage;    if ( (!flagUpdateTest) || (flagUpdateTest && IsUpToDate(source_name,dest_name)) )
   if (!sourceImage.LoadPicture(source_name))  
339    {    {
340      ShowError("Could not load the source picture");      //
341    }      // Initialize free image
342        //
343        FreeImage_Initialise();
344    
345        //
346        // Try to load the source picture
347        //
348        ImageContainer sourceImage;
349        if (!sourceImage.LoadPicture(source_name))
350        {
351          ShowError("Could not load the source picture");
352        }
353    
354    //      //
355    // Display informations about the picture      // Display informations about the picture
356    //      //
357    printf("\r\n Name of the source picture: '%s'",source_name.c_str());      if (flagVerbosity)
358    printf("\r\n Size: %dx%d",sourceImage.GetWidth(),sourceImage.GetHeight());      {
359    printf("\r\n BPP: %d",sourceImage.GetDpp());        printf("\r\n Name of the source picture: '%s'",source_name.c_str());
360          printf("\r\n Size: %dx%d",sourceImage.GetWidth(),sourceImage.GetHeight());
361          printf("\r\n BPP: %d",sourceImage.GetDpp());
362    
363    int color_count=sourceImage.GetPaletteSize();        int color_count=sourceImage.GetPaletteSize();
364    if (color_count)        if (color_count)
365    {        {
366      // palletized          // palletized
367      printf("\r\n Color count: %d",color_count);          printf("\r\n Color count: %d",color_count);
368    }        }
369    else        else
370    {        {
371      // true color          // true color
372      printf("\r\n True color picture");          printf("\r\n True color picture");
373    }        }
374    printf("\r\n");        printf("\r\n");
375        }
376    
377    //      //
378    // Convert to destination format      // Convert to destination format
379    //      //
380    Hires.SetDebug(flag_testing);      Hires.SetDebug(flag_testing);
381    if (!Hires.Convert(sourceImage))      if (!Hires.Convert(sourceImage))
382    {      {
383      ShowError("Conversion failed");        ShowError("Conversion failed");
384    }      }
385    
386    if (!Hires.Save(output_format,dest_name,textFileGenerator))      if (!Hires.Save(output_format,dest_name,textFileGenerator))
387    {      {
388      ShowError("Saving failed");        ShowError("Saving failed");
389    }      }
390    
391    //      //
392    // Terminate free image      // Terminate free image
393    //      //
394    FreeImage_DeInitialise();      FreeImage_DeInitialise();
395      }
396    
397    //    getch();    //    getch();
398    

Legend:
Removed from v.1074  
changed lines
  Added in v.1075

  ViewVC Help
Powered by ViewVC 1.1.26