00001
00002
00003
00004
00005
00006 #ifndef PPMCMAP_H
00007 #define PPMCMAP_H
00008
00009 #include "pandabase.h"
00010 #include "pnmimage_base.h"
00011
00012 typedef struct colorhist_item* colorhist_vector;
00013 struct colorhist_item
00014 {
00015 pixel color;
00016 int value;
00017 };
00018
00019 typedef struct colorhist_list_item* colorhist_list;
00020 struct colorhist_list_item
00021 {
00022 struct colorhist_item ch;
00023 colorhist_list next;
00024 };
00025
00026 EXPCL_PANDA colorhist_vector ppm_computecolorhist( pixel** pixels, int cols, int rows, int maxcolors, int* colorsP );
00027
00028
00029 void ppm_addtocolorhist ( colorhist_vector chv, int* colorsP, int maxcolors, pixel* colorP, int value, int position );
00030
00031 EXPCL_PANDA void ppm_freecolorhist( colorhist_vector chv );
00032
00033
00034
00035
00036 typedef colorhist_list* colorhash_table;
00037
00038 colorhash_table ppm_computecolorhash ( pixel** pixels, int cols, int rows, int maxcolors, int* colorsP );
00039
00040 EXPCL_PANDA int
00041 ppm_lookupcolor( colorhash_table cht, pixel* colorP );
00042
00043 colorhist_vector ppm_colorhashtocolorhist ( colorhash_table cht, int maxcolors );
00044 EXPCL_PANDA colorhash_table ppm_colorhisttocolorhash( colorhist_vector chv, int colors );
00045
00046 int ppm_addtocolorhash ( colorhash_table cht, pixel* colorP, int value );
00047
00048
00049 colorhash_table ppm_alloccolorhash ( void );
00050
00051 void ppm_freecolorhash( colorhash_table cht );
00052
00053 #endif