コード例 #1
0
void main() {
	int height = 10;
	int width = 10;

	char* linePic = malloc(height * width * sizeof(char));
	for(int row = 0; row < height; row++) {
		for(int col = 0; col < width; col ++) {
			linePic[row*width + col] = picture[row*width + col];
		}
	}

	// allocate memory for new island pic
	char* islandPic = malloc(height * width * sizeof(char));

	// initialize array of 0's for new island pic
	for(int i = 0; i < height; i++) {
		for(int j = 0; j < width; j++) {
			islandPic[i*width + j] = 0;
		}
	}

	printf("Old picture\n");
	printPicture(linePic, height, width);
	linePic = lineThinning(linePic, height, width, 0);
	printf("New picture\n");
	printPicture(linePic, height, width);

	islandPic = islandFinder(linePic, islandPic, height, width);
	printPicture(islandPic, height, width);

	free(islandPic);
	free(linePic);
}
コード例 #2
0
int main(int argc, char* argv[]) {
   checkOptions(options, argc, argv);

   Array<PixelRow> picturedata;
   Array<PixelRow> background;
   HumdrumFile infile;

   int numinputs = options.getArgCount();
   if (numinputs > 0) {
      const char* filenameIn  = options.getArg(1).data();
      infile.read(filenameIn);
   } else {
      infile.read(cin);
   }

   if (infile.getFilename().size() == 0) {
      infile.setFilename(optionfilename);
   }

   if (jsonQ) {
      createJsonProll(infile);
   } else {
      int rfactor = generatePicture(infile, picturedata, style);
      generateBackground(infile, rfactor, picturedata, background);
      printPicture(picturedata, background, rfactor, cfactor, 
            gminpitch, gmaxpitch, infile);
   }

   return 0;
}