Source:NetHack 3.4.3/include/load img.h

From NetHackWiki
Revision as of 14:36, 22 June 2006 by Jaytbot (talk | contribs) (Automated source code upload)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Below is the full text to include/load_img.h from NetHack 3.4.3. To link to a particular line, write [[load_img.h#line123]], for example.

1.    
2.    /* ------------------------------------------- */
3.    #define XIMG      0x58494D47
4.    
5.    /* Header of GEM Image Files   */
6.    typedef struct IMG_HEADER{
7.      short version;  /* Img file format version (1) */
8.      short length;   /* Header length in words  (8) */
9.      short planes;   /* Number of bit-planes    (1) */
10.     short pat_len;  /* length of Patterns      (2) */
11.     short pix_w;    /* Pixel width in 1/1000 mmm  (372)    */
12.     short pix_h;    /* Pixel height in 1/1000 mmm (372)    */
13.     short img_w;    /* Pixels per line (=(x+7)/8 Bytes)    */
14.     short img_h;    /* Total number of lines               */
15.     long  magic;    /* Contains "XIMG" if standard color   */
16.     short paltype;  /* palette type (0=RGB (short each)) */
17.     short *palette;	/* palette etc.                        */
18.     char *addr;     /* Address for the depacked bit-planes */
19.   } IMG_header;
20.   
21.   /* ------------------------------------------- */
22.   /* error codes */
23.   #define ERR_HEADER      1
24.   #define ERR_ALLOC       2
25.   #define ERR_FILE        3
26.   #define ERR_DEPACK      4
27.   #define ERR_COLOR       5
28.   
29.   /* saves the current colorpalette with col colors in palette */
30.   void get_colors(int handle, short *palette, int col);
31.   
32.   /* sets col colors from palette */
33.   void img_set_colors(int handle,short *palette, int col);
34.   
35.   /* converts MFDB  of size from standard to deviceformat (0 if succeded, else error). */
36.   int convert(MFDB *, long );
37.   
38.   /* transforms image in VDI-Device format */
39.   int transform_img(MFDB *);
40.   
41.   /* Loads & depacks IMG (0 if succeded, else error). */
42.   /* Bitplanes are one after another in address IMG_HEADER.addr. */
43.   int depack_img(char *, IMG_header *);
44.   
45.   /* Halves IMG in Device-format, dest memory has to be allocated*/
46.   int half_img(MFDB *,MFDB *);