Changeset 0c42eb7 in thomson
- Timestamp:
- Feb 13, 2013, 9:28:41 PM (11 years ago)
- Branches:
- main
- Children:
- b9b1bde
- Parents:
- 2557cd0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gfx2mo5/libraw2mo5.c
r2557cd0 r0c42eb7 1 1 /* GFX2mo5 - libraw2mo5.c 2 2 * CloudStrife - 20080921 3 * PulkoMandy - 20101221 3 * PulkoMandy - 20101221, 20130213 4 4 * Diffusé sous licence libre CeCILL v2 5 * Voir eLICENCE5 * Voir LICENCE 6 6 */ 7 7 8 #include <stdbool.h> 8 9 #include <stdio.h> 9 10 #include <stdlib.h> … … 14 15 unsigned char *tmpBuffer; 15 16 int x,y; 17 int previous = 0; 16 18 17 19 tmpBuffer = (unsigned char*)calloc(0x4000,1); … … 23 25 #define width 320 24 26 27 bool lfo = false; 25 28 for (y = 0; y < 200; y++) 26 29 for (x = 0; x < 320; x+=8) { … … 28 31 int back = 255; 29 32 int pix; 33 bool oldlfo = lfo; 34 30 35 for(pix = 0; pix < 8; pix++) { 31 36 int nc = input[y*width+x+pix]; … … 33 38 if (back == nc) { 34 39 // Pixel is in backcolor, set FORME to 0 40 lfo = false; 35 41 } else if (fore == nc) { 36 42 // Pixel is in forecolor, set FORME to 1 37 43 tmpBuffer[(y*320+x)/8] |= 0x80>>pix; 44 lfo = true; 38 45 } else if (back==255) { 39 46 // Pixel is in unknown color, back is free : allocate backcolor 40 47 back = nc; 48 lfo = false; 41 49 } else if (fore == 255) { 42 50 // Pixel is unknown color, back is allocated : allocate front and set FORME 43 51 fore = nc; 44 52 tmpBuffer[(y*320+x)/8] |= 0x80>>pix; 53 lfo = true; 45 54 } else { 46 55 printf("Color clash at %d %d : %d %d %d\n",x+pix,y,fore, back, … … 48 57 } 49 58 } 50 if (fore == 255) fore = 0;51 if (back == 255) back = 0;52 59 53 tmpBuffer[0x2000+(y*320+x)/8] = (fore << 4) | back; 60 if (fore != 255) { 61 previous &= 0xF; 62 previous |= fore << 4; 63 } 64 if (back != 255) { 65 previous &= 0xF0; 66 previous |= back; 67 } 68 69 // Make sure the last pixel of this GPL and the first of the next GPL 70 // are both FORME or both FOND, else we get an ugly glitch on the 71 // EFGJ033 Gate Array MO5! 72 if(oldlfo == !(tmpBuffer[(y*320+x)/8] & 0x80)) 73 { 74 previous = (previous >> 4) | (previous << 4); 75 tmpBuffer[(y*320+x)/8] ^= 0xFF; 76 77 lfo = !lfo; 78 } 79 80 tmpBuffer[0x2000+(y*320+x)/8] = previous; 54 81 } 55 82
Note:
See TracChangeset
for help on using the changeset viewer.