home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / grafik / sega / pvquant / quant / quant.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-21  |  2.5 KB  |  82 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  *                  Copyright (c) 1991, Frank van der Hulst             *
  4.  *                          All Rights Reserved                         *
  5.  *                                                                      *
  6.  * Authors:                                                             *
  7.  *          FvdH - Frank van der Hulst (Wellington, NZ)                     *
  8.  *                                                                      *
  9.  * Versions:                                                            *
  10.  *      V1.1 910626 FvdH - QUANT released for DBW_RENDER                *
  11.  *      V1.2 911021 FvdH - QUANT released for PoV Ray                   *
  12.  *                                                                      *
  13.  ************************************************************************/
  14. /* quant.h -- definitions global to quant package */
  15.  
  16. #include <stdio.h>
  17. #ifdef __TURBOC__
  18. #include <stdlib.h>
  19. #include <alloc.h>
  20. #include <vga.h>
  21.  
  22. #define HUGE_PTR huge*
  23. #else
  24.  
  25. #define HUGE_PTR *
  26. #endif
  27.  
  28. #define TRUE        1
  29. #define FALSE        0
  30.  
  31. /* Readability constants. */
  32. #define RED            0
  33. #define GREEN        1
  34. #define BLUE        2
  35.  
  36. /* Maximum number of colormap entries.  To make larger than 2^8, the rgbmap
  37.     type will have to be changed from unsigned chars to something larger. */
  38.  
  39. #define MAXCOLORS        256
  40.  
  41. #ifdef HECKBERT
  42. #define INPUT_BITS 5
  43. #else
  44. #define INPUT_BITS 8
  45. #endif
  46.  
  47. #ifdef __TURBOC__
  48. #define CHECK_ALLOC( ptr, type, number, msg) {\
  49.     if ((ptr = (type *) farmalloc((long)sizeof(type) * (unsigned long)(number))) == NULL) {\
  50.         printf("\nCreating %s: MALLOC - out of memory\n", msg);\
  51.         exit(1);\
  52.      } \
  53.   }
  54. #else
  55. #define CHECK_ALLOC(ptr, type, number, msg) { \
  56.     if ((ptr = (type *) malloc(sizeof(type) * number)) == NULL) { \
  57.         printf("\nCreating %s: malloc - out of memory\n, msg"); \
  58.         exit(1); \
  59.     } \
  60. }
  61. #endif
  62.  
  63. #define putw(word, file) {\
  64.     putc((word) & 0xff, file);\
  65.     putc((word) >> 8, file);\
  66.     }
  67.  
  68. typedef unsigned char UCHAR;            /* 8 bits */
  69. typedef unsigned short int UINT;    /* 16 bits */
  70. typedef unsigned long int ULONG;        /* 32 bits */
  71.  
  72. extern UCHAR palette[MAXCOLORS][3];
  73. extern char                disp_image;        /* Display image flag */
  74.  
  75. void open_file(char *fname);
  76. int get_pixel(UCHAR *p);
  77. void write_file(int num_files, char *input_file[], int Xres, int Yres,
  78.                      int colors, int output_type);
  79. void close_file(void);
  80.  
  81. int    pal_index(UCHAR *pixel);
  82.