home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libcnv / ppmcmap.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  1.8 KB  |  57 lines

  1. /* ppm.h -
  2. **
  3. ** Header File
  4. **
  5. ** Copyright (C) 1989, 1991 by Jef Poskanzer.
  6. **
  7. ** Permission to use, copy, modify, and distribute this software and its
  8. ** documentation for any purpose and without fee is hereby granted, provided
  9. ** that the above copyright notice appear in all copies and that both that
  10. ** copyright notice and this permission notice appear in supporting
  11. ** documentation.  This software is provided "as is" without express or
  12. ** implied warranty.
  13. */
  14.  
  15. /* Color histogram stuff. */
  16.  
  17. typedef struct colorhist_item* colorhist_vector;
  18. struct colorhist_item
  19.     {
  20.     pixel color;
  21.     int16 value;
  22.     };
  23.  
  24. typedef struct colorhist_list_item* colorhist_list;
  25. struct colorhist_list_item
  26.     {
  27.     struct colorhist_item ch;
  28.     colorhist_list next;
  29.     };
  30.  
  31. colorhist_vector ppm_computecolorhist ARGS(( pixel** pixels, int16 cols, int16 rows, int16 maxcolors, int16* colorsP ));
  32. /* Returns a colorhist *colorsP int32 (with space allocated for maxcolors. */
  33.  
  34. void ppm_addtocolorhist ARGS(( colorhist_vector chv, int16* colorsP, int16 maxcolors, pixel* colorP, int16 value, int16 position ));
  35.  
  36. void ppm_freecolorhist ARGS(( colorhist_vector chv ));
  37.  
  38.  
  39. /* Color hash table stuff. */
  40.  
  41. typedef colorhist_list* colorhash_table;
  42.  
  43. colorhash_table ppm_computecolorhash ARGS(( pixel** pixels, int16 cols, int16 rows, int16 maxcolors, int16* colorsP ));
  44.  
  45. int16
  46. ppm_lookupcolor ARGS(( colorhash_table cht, pixel* colorP ));
  47.  
  48. colorhist_vector ppm_colorhashtocolorhist ARGS(( colorhash_table cht, int16 maxcolors ));
  49. colorhash_table ppm_colorhisttocolorhash ARGS(( colorhist_vector chv, int16 colors ));
  50.  
  51. int16 ppm_addtocolorhash ARGS(( colorhash_table cht, pixel* colorP, int16 value ));
  52. /* Returns -1 on failure. */
  53.  
  54. colorhash_table ppm_alloccolorhash ARGS(( void ));
  55.  
  56. void ppm_freecolorhash ARGS(( colorhash_table cht ));
  57.