Changes between Initial Version and Version 1 of PgmInputOutput


Ignore:
Timestamp:
Feb 10, 2007, 7:48:34 PM (18 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PgmInputOutput

    v1 v1  
     1{{{
     2/********************************************************************
     3            gmap: image structure, greyscale pixels.
     4The width field contains the width of the image,
     5- The height field contains the height of the image,
     6- The raster pointer points to a memory area containing
     7the image pixel, 8 bits per pixel, 0 is black, 255 is white.
     8The (0,0) coordinate is the upper left corner of the image, and
     9its address is raster. The (1,0) coordinate is at address raster + 1.
     10The (0,1) coordinate is at address raster + width.
     11**********************************************************************/
     12typedef struct gmap {
     13short                width;
     14short                height;
     15unsigned char  *raster;
     16} gmap;
     17
     18/*********************************************************************
     19         readpgm()
     20This function reads the pgmfile whose name is given as argument
     21and creates a gmap structure filled with the image.
     22This function allocate the memory requested to store the image.
     23If either the file cannot be opened or not enough memory
     24remains readpgm returns NULL
     25**********************************************************************/
     26extern gmap *readpgm(char *name);
     27
     28/*********************************************************************
     29         writepgm:
     30This function writes the gmap map into the file whose name is
     31given as argument.
     32If the file cannot be opened, writepgm returns NULL.
     33**********************************************************************/
     34extern int   writepgm(gmap *map, char *name);
     35}}}