1 /* when using gfxrip and an uncompressed amiga save state,
2 * we find at offset 401408 the map background tiles, followed
3 * by other map sprites in 16x16, ST mode, 4bitplanes.
4 * the first 16 tiles are background data.
5 * to recreate the 64x64 bg tile, 4 lines of each bg sprite
6 * are put horizontally into the output tile. */
8 #include "leptonica/allheaders.h"
14 #define sprites_per_pic 8
18 const struct palpic
* f
= & sprite
.header
;
20 PIX
* o
= pixCreate(64, 32*bgs
, 32);
21 prgb
* bufptr
= (prgb
*) o
->data
;
23 for(seq
= 0; seq
< bgs
* sprites_per_pic
; seq
+= sprites_per_pic
) {
24 prgb
* palette
= palpic_getpalette(f
);
27 for(i
= seq
; i
< seq
+ sprites_per_pic
; i
++) {
29 const uint8_t *source
= palpic_getspritedata(f
, i
);
30 for(y
= 0; y
< palpic_getspriteheight(f
); y
++) {
31 for(x
= 0; x
< palpic_getspritewidth(f
); x
++) {
32 *bufptr
++ = palette
[*source
++];
37 pixWritePng("test.png", o
, 0.0);