#include "amma/EntryPnt.hh" #include "amma/SquareIter.hh" #include "amma/Filename.hh" #include "amma/ByteImag.hh" #include "amma/DP/FileFormatIO.hh" #include "amma/HSet.hh" #include int Main(int argc, char* argv[]) { if (argc != 3) { cerr << "Usage: " << argv[0] << " " << endl; exit(-1); } ByteImageC image(512,512); IntT initialsize = atoi(argv[1]); HSetC visited; IntT size = initialsize; IntT sizestep = atoi(argv[2]); while ( size <= 511){ for (SquareIterC it(size, Index2dC(255,255)); it.IsElm(); it.Next()) { if (!visited.IsMember( it.Data() )) { image[ it.Data() ] = 128; visited.Insert( it.Data() ); } else image[ it.Data() ] = 255; } size += sizestep; } if (!StdIO::Save("square.pgm", image)) cerr << "Image saving failed" << endl; return 0; } AMMA_ENTRY_POINT(Main);