home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / INCLUDE / COLMDECL.H < prev    next >
C/C++ Source or Header  |  1990-04-23  |  2KB  |  56 lines

  1. /*
  2.     colmdecl.h    10/19/88
  3.  
  4.     % driver functions and other things that need attending to
  5.  
  6.     By Ted.
  7.  
  8.     OWL 1.2
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.      1/95/89 jmd    added missing arg_ macros
  15.      5/09/89 ted    Changed Alloc/Free terms to Open/Close.
  16.  
  17.      3/28/90 jmd    ansi-fied
  18. */
  19.  
  20. /* -------------------------------------------------------------------------- */
  21. typedef unsigned opixval;    /* pixel value (index into a colormap) */
  22. typedef byte olevel;            /* rgb level */
  23.  
  24. typedef struct _orgb {
  25.     olevel     rgb[3];
  26. } orgb_struct;                    /* red, green, blue triplet */
  27.  
  28.  
  29. typedef enum _orgbi {ORED=0, OGREEN=1, OBLUE=2} orgbi;
  30.  
  31. #define ocolmap_struct(n)            \
  32.             struct {opixval firstpix; unsigned nentries; orgb_struct rgbs[n];}
  33.  
  34. typedef ocolmap_struct(1) *ocolmap_type;
  35. /* -------------------------------------------------------------------------- */
  36.  
  37. /* OCOLMAP.C */
  38. extern ocolmap_type ocolmap_Open(opixval firstpix, unsigned nentries);
  39. extern void        ocolmap_Close(ocolmap_type cmap);
  40. extern void        ocolmap_set(ocolmap_type dcmap, ocolmap_type scmap);
  41. extern orgb_struct *ocolmap_entry(ocolmap_type colmap, opixval opix);
  42. extern void        ocolmap_setpixrgb(ocolmap_type cmap, opixval ipix, olevel red, olevel green, olevel blue);
  43. extern boolean    ocolmap_samecolor(ocolmap_type scmap, opixval scolor, ocolmap_type dcmap, opixval dcolor);
  44. extern boolean    ocolmap_getcolor(ocolmap_type scmap, opixval scolor, ocolmap_type dcmap, opixval dcolor);
  45.  
  46. /* -------------------------------------------------------------------------- */
  47.  
  48. #define ocolmap_GetSize(nentries)                    \
  49.     (sizeof(ocolmap_struct(1)) + ((nentries)-1) * sizeof(orgb_struct))
  50.  
  51. #define ocolmap_pixred(cmap, ipix)        (ocolmap_entry(cmap, ipix)->rgb[ORED])
  52. #define ocolmap_pixgreen(cmap, ipix)    (ocolmap_entry(cmap, ipix)->rgb[OGREEN])
  53. #define ocolmap_pixblue(cmap, ipix)        (ocolmap_entry(cmap, ipix)->rgb[OBLUE])
  54. /* -------------------------------------------------------------------------- */
  55.  
  56.