2 #include "leptonica/allheaders.h"
8 #define scramble_factor 2
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
;
16 for(i
= 0; i
< f
->spritecount
; i
++) {
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);