rename LICENSE to COPYING and add a more complete LICENSE file.
[rofl0r-openDOW.git] / utils / unscramble.c
blobdd24b56977a6a67bc72c8578a763c1aaeb4b413f
1 #include "../palpic.h"
2 #include "leptonica/allheaders.h"
3 #include <string.h>
4 //RcB: LINK "-llept"
6 #include "../temp.c"
7 #define sprite temp
8 #define scramble_factor 2
10 int main() {
11 const struct palpic* f = & sprite .header;
12 PIX* o = pixCreate(f->width*scramble_factor, palpic_getspritecount(f) * palpic_getspriteheight(f)/scramble_factor, 32);
13 prgb* palette = palpic_getpalette(f);
14 prgb* bufptr = (prgb*) o->data;
15 size_t i;
16 for(i = 0; i < f->spritecount; i++) {
17 int x, y;
18 const uint8_t *source = palpic_getspritedata(f, i);
19 for(y = 0; y < palpic_getspriteheight(f); y++) {
20 for(x = 0; x < palpic_getspritewidth(f); x++) {
21 *bufptr++ = palette[*source++];
25 pixWritePng("test.png", o, 0.0);
26 return 0;