%ffp Category: "Neology Filter Pack" Title: "Image by Numbers" Copyright: "© 1999 by Werner D. Streidt" Version: "1.0" Filename: "C:\\n_imgnum.8bf" ctl[0]: "Color area", range=(1,50) ctl[1]: COMBOBOX, "point\ncm\ninch", val=1, Size=(40,40) ctl[3]: STATICTEXT, Size=(100,50) ForEveryTile: { int PS_FILE, INP_FILE; u = X*scaleFactor; v = Y*scaleFactor; switch(ctl(1)) { case 0: setCtlTextv(3, "The character color is composed by %d × %d pixels.\n" "The final output size is :\n%d × %d points", ctl(0), ctl(0), u*7/ctl(0)+30, v*10/ctl(0)+30); break; case 1: setCtlTextv(3, "The character color is composed by %d × %d pixels.\n" "The final output size is :\n%.1f cm × %.1f cm", ctl(0), ctl(0), (u*7.0/(ctl(0))+30.0)/28.3464567, (v*10.0/(ctl(0))+30.0)/28.3464567); break; case 2: setCtlTextv(3, "The character color is composed by %d × %d pixels.\n" "The final output size is :\n%.1f \" × %.1f \"", ctl(0), ctl(0), (u*7.0/(ctl(0))+30.0)/72.0, (v*10.0/(ctl(0))+30.0)/72.0); break; } if (!doingProxy) { if ((PS_FILE=fopen("d:\\number1.ps", "w")) && (INP_FILE=fopen("d:\\pi.txt", "r"))) { fprintf(PS_FILE, "%%Image by numbers\n\n/Helvetica findfont 12 scalefont setfont\n\n"); for (y=0; y<=Y; y+=ctl(0)) for (x=0; x<=X; x+=ctl(0)) fprintf(PS_FILE, "%0.2f %0.2f %0.2f setrgbcolor %d %d moveto (%c) show\n", src(x,y,0)/255.0, src(x,y,1)/255.0, src(x,y,2)/255.0, 10+x/ctl(0)*7, v*10/ctl(0)+10-y/ctl(0)*10, fgetc(INP_FILE)); fprintf(PS_FILE, "\nshowpage"); if (fclose(PS_FILE)) ErrorOk("Cannot close PostScript file."); if (fclose(INP_FILE)) ErrorOk("Cannot close text file."); } else ErrorOk("Cannot create PostScript file (1) or load text file (2).\n\n(1) Disk may be full or write-protected.\n(2) File C:\\PI.TXT not found or corrupted."); } return false; }