palpic2png.c: improve, make usable with ppic binary files
[rofl0r-openDOW.git] / utils / joinhalves.c
blobdaeb01ce65968e0ea5b5ad62f7baf2fa0bd060b1
1 #include "../palpic.h"
2 #include "leptonica/allheaders.h"
3 #include <string.h>
4 #pragma RcB2 LINK "-llept"
6 #include "../temp.c"
7 #define sprite temp
8 #define parts 2
10 int main() {
11 const struct palpic* f = & sprite .header;
12 struct vo_desc video;
13 video.height = palpic_getspritecount(f) * palpic_getspriteheight(f)/parts;
14 video.width = f->width*parts;
15 PIX* o = pixCreate(video.width, video.height, 32);
16 video.mem = o->data;
17 video.pitch = video.width * 4;
18 prgb* bufptr = (prgb*) o->data;
19 size_t i;
20 for(i = 0; i < f->spritecount; i++) {
21 int odd = i%parts;
22 int x = f->width * odd, y = palpic_getspriteheight(f)*(i/parts);
23 blit_sprite(x, y, &video, 1, f, i, 0);
25 pixWritePng("test.png", o, 0.0);
26 return 0;