Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

33 rindas
559 B

  1. #include <stdio.h>
  2. main(int argc,char **argv)
  3. {
  4. FILE *fin,*fout;
  5. int x,y;
  6. int width,height;
  7. int r,v,g;
  8. fin=fopen(argv[1],"r");
  9. fout=fopen(argv[2],"w");
  10. fscanf(fin,"P3\n");
  11. fscanf(fin,"%d %d\n",&width,&height);
  12. fscanf(fin,"255\n");
  13. fprintf(fout,"png_color cmap[%d][%d]={\n",width,height);
  14. for(y=0;y<height;y++) {
  15. fprintf(fout,"{");
  16. for(x=0;x<width;x++) {
  17. fscanf(fin,"%d\n%d\n%d\n",&r,&v,&g);
  18. fprintf(fout,"{ %d,%d,%d},",r,v,g);
  19. if(x%8==0) fprintf(fout,"\n");
  20. }
  21. fprintf(fout,"},\n");
  22. }
  23. fprintf(fout,"};\n");
  24. fclose(fin);
  25. fclose(fout);
  26. }