Changeset 068b1fa in thomson for tools/gfx2mo5/png2mo5.c
- Timestamp:
- Mar 17, 2014, 10:51:11 AM (10 years ago)
- Branches:
- main
- Children:
- 05f2b4a
- Parents:
- 87bafa6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gfx2mo5/png2mo5.c
r87bafa6 r068b1fa 1 1 /* GFX2mo5 - png2mo5.c 2 2 * CloudStrife - 20080921 3 * PulkoMandy - 2012-2014 3 4 * Diffusé sous licence libre CeCILL v2 4 5 * Voir LICENCE 5 6 */ 6 7 8 #include <getopt.h> 7 9 #include <stdio.h> 8 10 #include <stdlib.h> … … 33 35 34 36 png_bytep * ptrRow; 37 int pxsize; 38 39 char opt; 40 int fixup = -1; 41 bool to = false; 42 35 43 unsigned char thomheader[] = { 36 44 // Block 1 : address A7C0, 1 byte, select FORME … … 46 54 if(argc < 3) 47 55 { 48 printf("Utilisation : %s input_filename output_filename options\n",argv[0]);56 printf("Utilisation : %s [options] input_filename output_filename\n",argv[0]); 49 57 exit(0); 50 58 } 51 59 52 inFile = fopen(argv[1],"rb"); 60 while((opt = getopt(argc, argv, "tf:")) != -1) { 61 switch(opt) { 62 case 't': 63 to = true; 64 thomheader[3] = 0xE7; 65 thomheader[4] = 0xC3; 66 thomheader[5] = 0x65; 67 thomheader[9] = 0x40; 68 break; 69 case 'f': 70 fixup = atoi(optarg); 71 break; 72 } 73 } 74 75 inFile = fopen(argv[optind++],"rb"); 53 76 54 77 if (inFile == NULL) … … 127 150 png_read_image(png_ptr, ptrRow); 128 151 129 outBuffer = raw2mo5(inBuffer, height, argc > 3 ? atoi(argv[3]):-1);152 outBuffer = raw2mo5(inBuffer, height, fixup, to); 130 153 131 intpxsize = width * height / 8;154 pxsize = width * height / 8; 132 155 thomheader[7] = pxsize >> 8; 133 156 thomheader[8] = pxsize; 134 157 135 outFile = fopen(argv[ 2], "wb");158 outFile = fopen(argv[optind++], "wb"); 136 159 fwrite(thomheader, 1, sizeof(thomheader), outFile); 137 160 //write forme data 138 161 fwrite(outBuffer, 1, pxsize, outFile); 139 thomheader[5] = 0x50;162 --thomheader[5]; 140 163 fwrite(thomheader, 1, sizeof(thomheader), outFile); 141 164 // write color data
Note:
See TracChangeset
for help on using the changeset viewer.