Source:NetHack 3.6.0/include/load img.h

From NetHackWiki
(Redirected from Source:Load img.h)
Jump to: navigation, search

Below is the full text to load_img.h from the source code of NetHack 3.6.0. To link to a particular line, write [[Source:NetHack 3.6.0/include/load_img.h#line123]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

  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
  36.   * error). */
  37.  int convert(MFDB *, long);
  38.  
  39.  /* transforms image in VDI-Device format */
  40.  int transform_img(MFDB *);
  41.  
  42.  /* Loads & depacks IMG (0 if succeded, else error). */
  43.  /* Bitplanes are one after another in address IMG_HEADER.addr. */
  44.  int depack_img(char *, IMG_header *);
  45.  
  46.  /* Halves IMG in Device-format, dest memory has to be allocated*/
  47.  int half_img(MFDB *, MFDB *);