1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2000, 2003
4 //
5 // Test STL morphImages function
6 //
7 
8 #include <Magick++.h>
9 #include <string>
10 #include <iostream>
11 #include <list>
12 #include <vector>
13 
14 using namespace std;
15 
16 using namespace Magick;
17 
main(int,char ** argv)18 int main( int /*argc*/, char **argv)
19 {
20 
21   // Initialize ImageMagick install location for Windows
22   InitializeMagick(*argv);
23 
24   int failures=0;
25 
26   try {
27 
28     string srcdir("");
29     if(getenv("SRCDIR") != 0)
30       srcdir = getenv("SRCDIR");
31 
32     //
33     // Test morphImages
34     //
35 
36     list<Image> imageList;
37     readImages( &imageList, srcdir + "test_image_anim.miff" );
38 
39     list<Image> morphed;
40     morphImages( &morphed, imageList.begin(), imageList.end(), 3 );
41 
42     if ( morphed.size() != 21 )
43       {
44 	++failures;
45 	cout << "Line: " << __LINE__
46 	     << "  Morph images failed, number of frames is "
47 	     << morphed.size()
48 	     << " rather than 21 as expected." << endl;
49       }
50   }
51 
52   catch( Exception &error_ )
53     {
54       cout << "Caught exception: " << error_.what() << endl;
55       return 1;
56     }
57   catch( exception &error_ )
58     {
59       cout << "Caught exception: " << error_.what() << endl;
60       return 1;
61     }
62 
63   if ( failures )
64     {
65       cout << failures << " failures" << endl;
66       return 1;
67     }
68 
69   return 0;
70 }
71 
72