int main (int argc, char **argv){ //char file1[MAXLINE]; //char file2[MAXLINE]; //char file3[MAXLINE]; if(argc < 2){ printf ("Enter the name of the PGM files: (lighter first)\n"); //scanf("%s", file1); //scanf("%s", file2); //scanf("%s", file3); char *file1="a.ppm"; char *file2="b.ppm"; char *file3="c.ppm"; /*FILE* f1; FILE* f2; f1 = fopen("a.pgm", "rb"); f2 = fopen("b.pgm", "rb"); printf("step - before PlotComparagram\n"); PlotComparagram(f1, f2); printf("step - after PlotComparagram\n"); fclose(f1); fclose(f2);*/ FormatCheck((char*)file1, (char*)file2, (char*)file3); } return 0; }
/* ============= WalkString ============= Walks the passed string and either renders or changes some font state based on what it encounters. Makes sure that failed formatters don't break anything. */ void GLFont::WalkString(GLint xpos, GLint ypos, char *string) { GLint px = region ? regionDims[0] : xpos; GLint py = region ? regionDims[1] - (coord.up * size) : ypos; for (char *where = string; *where; where++) { if (region) { // ugly mess if ((coord.right > 0 && (px + size) > (regionDims[0] + regionDims[2])) || (coord.right < 0 && (px - size) < (regionDims[0] - regionDims[2]))) { py -= (size * coord.up); px = regionDims[0]; } if (coord.up < 0 && py > (regionDims[1] + regionDims[3]) || coord.up > 0 && py < (regionDims[1] - regionDims[3])) break; } if (*where == '\t') px += (size * fontTabSize); else if (*where == '\n') { py -= (coord.up * size); px = region ? regionDims[0] : xpos; } else if (*where == '\\') { GLubyte clr[4]; GLint format = FormatCheck(&where, clr); if (!format) { ProcessChar(px, py, *where); px += (coord.right * size); } else if (format == formatBoldOn) bold = 1; else if (format == formatBoldOff) bold = 0; else if (format == formatItalicOn) italic = 1; else if (format == formatItalicOff) italic = 0; else if (format == formatColor || format == formatColorA) ColorCopy(colorForGrnd, clr, 4); } else { ProcessChar(px, py, *where); px += (coord.right * size); } } }