/* ppmcmapx.h - colormap routines */ /* Last edited on 2004-11-07 00:34:39 by stolfi */ #ifndef ppmcmapx_H #define ppmcmapx_H #include /* RGB COLOR HISTOGRAMS */ typedef struct ppm_cmapx_hist_item* ppm_cmapx_hist_vector; struct ppm_cmapx_hist_item { pixel color; int value; }; typedef struct ppm_cmapx_list_item* ppm_cmapx_list; struct ppm_cmapx_list_item { struct ppm_cmapx_hist_item ch; ppm_cmapx_list next; }; ppm_cmapx_hist_vector ppm_cmapx_hist_build ARGS(( pixel** pixels, int cols, int rows, int maxcolors, int* colorsP )); /* Returns a colorhist *colorsP long (with space allocated for maxcolors. */ void ppm_cmapx_hist_add ARGS(( ppm_cmapx_hist_vector chv, int* colorsP, int maxcolors, pixel* colorP, int value, int position )); void ppm_cmapx_hist_free ARGS(( ppm_cmapx_hist_vector chv )); /* HASH TABLE FOR RGB COLORS */ typedef ppm_cmapx_list* ppm_cmapx_table; ppm_cmapx_table ppm_cmapx_table_build ARGS(( pixel** pixels, int cols, int rows, int maxcolors, int* colorsP )); int ppm_cmapx_table_lookup ARGS(( ppm_cmapx_table cht, pixel* colorP )); ppm_cmapx_hist_vector ppm_cmapx_table_to_hist ARGS(( ppm_cmapx_table cht, int maxcolors )); ppm_cmapx_table ppm_cmapx_hist_to_table ARGS(( ppm_cmapx_hist_vector chv, int colors )); int ppm_cmapx_table_add ARGS(( ppm_cmapx_table cht, pixel* colorP, int value )); /* Returns -1 on failure. */ ppm_cmapx_table ppm_cmapx_table_alloc ARGS(( void )); void ppm_cmapx_table_free ARGS(( ppm_cmapx_table cht )); #endif