1 /* Handle PNM-files  Dez98 JS
2  * 0,0 = left up
3  * PAM-formats
4  * PAM any  P7
5  * PNM-formats
6  * PGM gray ASCII=P2 RAW=P5 dx dy col gray
7  * PPM RGB  ASCII=P3 RAW=P6 dx dy col RGB
8  * PBM B/W  ASCII=P1 RAW=P4 dx dy     bitmap
9  */
10 
11 #ifndef GOCR_PNM_H
12 #define GOCR_PNM_H 1
13 
14 #include "config.h"
15 
16 struct pixmap {
17    unsigned char *p;	/* pointer of image buffer (pixmap) */
18    int x;		/* xsize */
19    int y;		/* ysize */
20    int bpp;		/* bytes per pixel:  1=gray 3=rgb */
21  };
22 typedef struct pixmap pix;
23 
24 /* return 1 on multiple images (holding file open), 0 else */
25 int readpgm(char *name, pix *p, int vvv);
26 
27 /* write pgm-map to pnm-file */
28 int writepgm(char *nam, pix *p);
29 int writepbm(char *nam, pix *p);
30 int writeppm(char *nam, pix *p, int opt); /* use lowest 3 bits for farbcoding */
31 
32 /* ----- count colors ------ create histogram ------- */
33 void makehisto(pix p, unsigned col[256], int vvv);
34 
35 #endif
36