|  | 
                  
                  
                    
                    
                    
                    
    
            Doxygen Source Code DocumentationMain Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search
 
 libpnmrw.h File Reference
Go to the source code of this file. 
|  |  | 
 Data Structures |  | struct | colorhist_item |  | struct | colorhist_list_item |  | struct | pixel |  | 
 Defines |  | #define | ARGS(alist)   () |  | #define | const |  | #define | PBM_WHITE   0 |  | #define | PBM_BLACK   1 |  | #define | PBM_FORMAT_TYPE(f)   ((f) == PBM_FORMAT || (f) == RPBM_FORMAT ? PBM_TYPE : -1) |  | #define | PGM_MAXMAXVAL   255 |  | #define | PGM_FORMAT_TYPE(f)   ((f) == PGM_FORMAT || (f) == RPGM_FORMAT ? PGM_TYPE : PBM_FORMAT_TYPE(f)) |  | #define | PPM_MAXMAXVAL   PGM_MAXMAXVAL |  | #define | PPM_GETR(p)   ((p).r) |  | #define | PPM_GETG(p)   ((p).g) |  | #define | PPM_GETB(p)   ((p).b) |  | #define | PPM_ASSIGN(p, red, grn, blu)   do { (p).r = (red); (p).g = (grn); (p).b = (blu); } while ( 0 ) |  | #define | PPM_EQUAL(p, q)   ( (p).r == (q).r && (p).g == (q).g && (p).b == (q).b ) |  | #define | PPM_FORMAT_TYPE(f)   ((f) == PPM_FORMAT || (f) == RPPM_FORMAT ? PPM_TYPE : PGM_FORMAT_TYPE(f)) |  | #define | PNM_MAXMAXVAL   PPM_MAXMAXVAL |  | #define | PNM_GET1(x)   PPM_GETB(x) |  | #define | PNM_ASSIGN1(x, v)   PPM_ASSIGN(x,0,0,v) |  | #define | PNM_EQUAL(x, y)   PPM_EQUAL(x,y) |  | #define | PNM_FORMAT_TYPE(f)   PPM_FORMAT_TYPE(f) |  | #define | PBM_MAGIC1   'P' |  | #define | PBM_MAGIC2   '1' |  | #define | RPBM_MAGIC2   '4' |  | #define | PBM_FORMAT   (PBM_MAGIC1 * 256 + PBM_MAGIC2) |  | #define | RPBM_FORMAT   (PBM_MAGIC1 * 256 + RPBM_MAGIC2) |  | #define | PBM_TYPE   PBM_FORMAT |  | #define | PGM_MAGIC1   'P' |  | #define | PGM_MAGIC2   '2' |  | #define | RPGM_MAGIC2   '5' |  | #define | PGM_FORMAT   (PGM_MAGIC1 * 256 + PGM_MAGIC2) |  | #define | RPGM_FORMAT   (PGM_MAGIC1 * 256 + RPGM_MAGIC2) |  | #define | PGM_TYPE   PGM_FORMAT |  | #define | PPM_MAGIC1   'P' |  | #define | PPM_MAGIC2   '3' |  | #define | RPPM_MAGIC2   '6' |  | #define | PPM_FORMAT   (PPM_MAGIC1 * 256 + PPM_MAGIC2) |  | #define | RPPM_FORMAT   (PPM_MAGIC1 * 256 + RPPM_MAGIC2) |  | #define | PPM_TYPE   PPM_FORMAT |  | #define | PPM_DEPTH(newp, p, oldmaxval, newmaxval) |  | #define | PPM_LUMIN(p)   ( 0.299 * PPM_GETR(p) + 0.587 * PPM_GETG(p) + 0.114 * PPM_GETB(p) ) |  | #define | pnm_allocarray(cols, rows)   ((xel**) pm_allocarray( cols, rows, sizeof(xel) )) |  | #define | pnm_allocrow(cols)   ((xel*) pm_allocrow( cols, sizeof(xel) )) |  | #define | pnm_freearray(xels, rows)   pm_freearray( (char**) xels, rows ) |  | #define | pnm_freerow(xelrow)   pm_freerow( (char*) xelrow ) |  | 
 Typedefs |  | typedef unsigned char | bit |  | typedef unsigned char | gray |  | typedef gray | pixval |  | typedef pixel | xel |  | typedef pixval | xelval |  | typedef colorhist_item * | colorhist_vector |  | typedef colorhist_list_item * | colorhist_list |  | typedef colorhist_list * | colorhash_table |  | 
 Functions |  | void * | malloc () |  | void pnm_init2 | ARGS ((char *pn)) |  | char **pm_allocarray | ARGS ((int cols, int rows, int size)) |  | char *pm_allocrow | ARGS ((int cols, int size)) |  | void pm_freearray | ARGS ((char **its, int rows)) |  | void pm_freerow | ARGS ((char *itrow)) |  | xel **pnm_readpnm | ARGS ((FILE *file, int *colsP, int *rowsP, xelval *maxvalP, int *formatP)) |  | int pnm_readpnmrow | ARGS ((FILE *file, xel *xelrow, int cols, xelval maxval, int format)) |  | int pnm_writepnm | ARGS ((FILE *file, xel **xels, int cols, int rows, xelval maxval, int format, int forceplain)) |  | int pnm_writepnminit | ARGS ((FILE *file, int cols, int rows, xelval maxval, int format, int forceplain)) |  | int pnm_writepnmrow | ARGS ((FILE *file, xel *xelrow, int cols, xelval maxval, int format, int forceplain)) |  | FILE *pm_openr | ARGS ((char *name)) |  | int pm_closer | ARGS ((FILE *f)) |  | colorhist_vector ppm_computecolorhist | ARGS ((pixel **pixels, int cols, int rows, int maxcolors, int *colorsP)) |  | void ppm_addtocolorhist | ARGS ((colorhist_vector chv, int *colorsP, int maxcolors, pixel *colorP, int value, int position)) |  | void ppm_freecolorhist | ARGS ((colorhist_vector chv)) |  | int ppm_lookupcolor | ARGS ((colorhash_table cht, pixel *colorP)) |  | colorhist_vector ppm_colorhashtocolorhist | ARGS ((colorhash_table cht, int maxcolors)) |  | colorhash_table ppm_colorhisttocolorhash | ARGS ((colorhist_vector chv, int colors)) |  | int ppm_addtocolorhash | ARGS ((colorhash_table cht, pixel *colorP, int value)) |  | colorhash_table ppm_alloccolorhash | ARGS ((void)) |  | void ppm_freecolorhash | ARGS ((colorhash_table cht)) |  | void pnm_promoteformat | ARGS ((xel **xels, int cols, int rows, xelval maxval, int format, xelval newmaxval, int newformat)) |  | void pnm_promoteformatrow | ARGS ((xel *xelrow, int cols, xelval maxval, int format, xelval newmaxval, int newformat)) |  | xel pnm_backgroundxel | ARGS ((xel **xels, int cols, int rows, xelval maxval, int format)) |  | xel pnm_backgroundxelrow | ARGS ((xel *xelrow, int cols, xelval maxval, int format)) |  | xel pnm_whitexel | ARGS ((xelval maxval, int format)) |  | void pnm_invertxel | ARGS ((xel *xP, xelval maxval, int format)) |  | 
 Variables |  | xelval | pnm_pbmmaxval |  
 Define Documentation
 
  
    | 
        
          | #define ARGS | ( | alist |  | ) | () |  |  
 
 
 
  
    | 
        
          | #define PBM_FORMAT   (PBM_MAGIC1 * 256 + PBM_MAGIC2) |  |  
 
  
    | 
        
          | #define PBM_FORMAT_TYPE | ( | f |  | ) | ((f) == PBM_FORMAT || (f) == RPBM_FORMAT ? PBM_TYPE : -1) |  |  
 
 
 
  
    | 
        
          | #define PBM_TYPE   PBM_FORMAT |  |  
 
 
  
    | 
        
          | #define PGM_FORMAT   (PGM_MAGIC1 * 256 + PGM_MAGIC2) |  |  
 
  
    | 
        
          | #define PGM_FORMAT_TYPE | ( | f |  | ) | ((f) == PGM_FORMAT || (f) == RPGM_FORMAT ? PGM_TYPE : PBM_FORMAT_TYPE(f)) |  |  
 
 
 
  
    | 
        
          | #define PGM_MAXMAXVAL   255 |  |  
 
  
    | 
        
          | #define PGM_TYPE   PGM_FORMAT |  |  
 
 
  
    | 
        
          | #define pnm_allocrow | ( | cols |  | ) | ((xel*) pm_allocrow( cols, sizeof(xel) )) |  |  
 
  
    | 
        
          | #define PNM_ASSIGN1 | ( | x, |  
          |  |  | v |  | ) | PPM_ASSIGN(x,0,0,v) |  |  
 
  
    | 
        
          | #define PNM_EQUAL | ( | x, |  
          |  |  | y |  | ) | PPM_EQUAL(x,y) |  |  
 
  
    | 
        
          | #define PNM_FORMAT_TYPE | ( | f |  | ) | PPM_FORMAT_TYPE(f) |  |  
 
 
 
  
    | 
        
          | #define PNM_GET1 | ( | x |  | ) | PPM_GETB(x) |  |  
 
  
    | 
        
          | #define PNM_MAXMAXVAL   PPM_MAXMAXVAL |  |  
 
  
    | 
        
          | #define PPM_ASSIGN | ( | p, |  
          |  |  | red, |  
          |  |  | grn, |  
          |  |  | blu |  | ) | do { (p).r = (red); (p).g = (grn); (p).b = (blu); } while ( 0 ) |  |  
 
  
    | 
        
          | #define PPM_DEPTH | ( | newp, |  
          |  |  | p, |  
          |  |  | oldmaxval, |  
          |  |  | newmaxval |  | ) |  |  |  
 
  
    | 
        
          | #define PPM_EQUAL | ( | p, |  
          |  |  | q |  | ) | ( (p).r == (q).r && (p).g == (q).g && (p).b == (q).b ) |  |  
 
  
    | 
        
          | #define PPM_FORMAT   (PPM_MAGIC1 * 256 + PPM_MAGIC2) |  |  
 
  
    | 
        
          | #define PPM_FORMAT_TYPE | ( | f |  | ) | ((f) == PPM_FORMAT || (f) == RPPM_FORMAT ? PPM_TYPE : PGM_FORMAT_TYPE(f)) |  |  
 
  
    | 
        
          | #define PPM_GETB | ( | p |  | ) | ((p).b) |  |  
 
  
    | 
        
          | #define PPM_GETG | ( | p |  | ) | ((p).g) |  |  
 
  
    | 
        
          | #define PPM_GETR | ( | p |  | ) | ((p).r) |  |  
 
  
    | 
        
          | #define PPM_LUMIN | ( | p |  | ) | ( 0.299 * PPM_GETR(p) + 0.587 * PPM_GETG(p) + 0.114 * PPM_GETB(p) ) |  |  
 
 
 
  
    | 
        
          | #define PPM_MAXMAXVAL   PGM_MAXMAXVAL |  |  
 
  
    | 
        
          | #define PPM_TYPE   PPM_FORMAT |  |  
 
  
    | 
        
          | #define RPBM_FORMAT   (PBM_MAGIC1 * 256 + RPBM_MAGIC2) |  |  
 
 
  
    | 
        
          | #define RPGM_FORMAT   (PGM_MAGIC1 * 256 + RPGM_MAGIC2) |  |  
 
 
  
    | 
        
          | #define RPPM_FORMAT   (PPM_MAGIC1 * 256 + RPPM_MAGIC2) |  |  
 
 Typedef Documentation
 
  
    | 
        
          | typedef unsigned char bit |  |  
 
 
 
 
  
    | 
        
          | typedef unsigned char gray |  |  
 
 
 
 Function Documentation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
    | 
        
          | int pm_closew ARGS | ( | (FILE *f) |  | ) |  |  |  
 
  
    | 
        
          | FILE *pm_openw ARGS | ( | (char *name) |  | ) |  |  |  
 
 
 
 
 
 
  
    | 
        
          | void pm_freerow ARGS | ( | (char *itrow) |  | ) |  |  |  
 
  
    | 
        
          | void pm_freearray ARGS | ( | (char **its, int rows) |  | ) |  |  |  
 
  
    | 
        
          | char* pm_allocrow ARGS | ( | (int cols, int size) |  | ) |  |  |  
 
  
    | 
        
          | char** pm_allocarray ARGS | ( | (int cols, int rows, int size) |  | ) |  |  |  
 
  
    | 
        
          | void pnm_init2 ARGS | ( | (char *pn) |  | ) |  |  |  
 
 Variable Documentation
 |