Source:NetHack 3.4.3/include/load img.h

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