home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
399b.lha
/
PGM.LZH
/
pgm
/
libpgm.doc
next >
Wrap
Text File
|
1990-07-21
|
4KB
|
199 lines
pgm(3) PBM Plus pgm(3)
NAME
pgm - functions to support portable graymap programs
SYNOPSIS
#include <pgm.h>
cc ... libpgm.a libpbm.a
DESCRIPTION
TYPES AND CONSTANTS
typedef unsigned char gray;
#define PGM_MAXMAXVAL 255
extern gray pgm_pbmmaxval;
Each _g_r_a_y should contain only the values between _0 and
_P_G_M__M_A_X_M_A_X_V_A_L. _p_g_m__p_b_m_m_a_x_v_a_l is the maxval used when a PGM
program reads a PBM file. Normally it is 1; however, for
some programs, a larger value gives better results.
PGM MEMORY MANAGEMENT
gray **pgm_allocarray(int cols, int rows)
Allocate an array of grays.
gray *pgm_allocrow( int cols )
Allocate a row of the given number of grays.
void pgm_freearray( grayrow, rows )
Free the array allocated with _p_g_m__a_l_l_o_c_a_r_r_a_y() containing
the given number of rows.
pbm_freerow( grayrow )
Free a row of grays.
READING PBM FILES
void
pgm_readpgminit( file, colsP, rowsP, maxvalP, formatP )
FILE *file;
int *colsP, *rowsP, *formatP;
gray *maxvalP;
Read the header from a pgm file, filling in the rows, cols,
maxval and format variables.
void
pgm_readpgmrow( file, grayrow, cols, maxval, format )
Printed 5/25/90 1
pgm(3) PBM Plus pgm(3)
FILE *file;
gray *grayrow;
gray maxval;
int cols, format;
Read a row of grays into the grayrow array. Format and cols
were filled in by _p_g_m__r_e_a_d_p_g_m_i_n_i_t().
gray **
pgm_readpgm( file, colsP, rowsP, maxvalP )
FILE *file;
int *colsP, *rowsP;
gray *maxvalP;
Read an entire graymap file into memory, returning the allo-
cated array and filling in the rows, cols and maxval vari-
ables. This function combines _p_g_m__r_e_a_d_p_g_m_i_n_i_t(),
_p_g_m__a_l_l_o_c_a_r_r_a_y() and _p_g_m__r_e_a_d_p_g_m_r_o_w().
WRITING PGM FILES
void
pgm_writepgminit( file, cols, rows, maxval )
FILE *file;
int cols, rows;
gray maxval;
Write the header for a portable graymap file.
void
pgm_writepgmrow( file, grayrow, cols, maxval )
FILE *file;
gray *grayrow;
int cols;
gray maxval;
Write a row from a portable graymap.
void
pgm_writepgm( file, bits, cols, rows, maxval )
FILE *file;
gray **bits;
int cols, rows;
gray maxval;
Write the header and all data for a portable graymap. This
function combines _p_g_m__w_r_i_t_e_p_g_m_i_n_i_t() and _p_g_m__w_r_i_t_e_p_g_m_r_o_w().
SEE ALSO
pgm(3), ppm(3)
Printed 5/25/90 2
pgm(3) PBM Plus pgm(3)
AUTHOR
Manual by Tony Hansen.
Copyright (C) 1989 by Jef Poskanzer.
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting docu-
mentation. This software is provided "as is" without
express or implied warranty.
Printed 5/25/90 3