Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ libpgm(3) — BSD/386 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

libpbm(3)

libppm(3)

libpnm(3)



libpgm(3)                                               libpgm(3)


NAME
       libpgm - functions to support portable graymap programs

SYNOPSIS
       #include <pgm.h>
       cc ... libpgm.a libpbm.a


DESCRIPTION
   TYPES AND CONSTANTS
       typedef ... gray;
       #define PGMMAXMAXVAL ...
       extern gray pgmpbmmaxval;

       Each  gray  should  contain  only the values between 0 and
       PGMMAXMAXVAL.  pgmpbmmaxval 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.

       #define PGMFORMAT ...
       #define RPGMFORMAT ...
       #define PGMTYPE PGMFORMAT
       int PGMFORMATTYPE( int format )

       For distinguishing different file formats and types.

   INITIALIZATION
       void pgminit( int* argcP, char* argv[] )

       All PGM programs must call this routine.

   MEMORY MANAGEMENT
       gray** pgmallocarray( int cols, int rows )

       Allocate an array of grays.

       gray* pgmallocrow( int cols )

       Allocate a row of the given number of grays.

       void pgmfreearray( gray** grays, int rows )

       Free the array allocated with pgmallocarray()  containing
       the given number of rows.

       void pgmfreerow( gray* grayrow )

       Free a row of grays.

   READING FILES
       void pgmreadpgminit( FILE* fp, int* colsP, int* rowsP, gray* maxvalP, int* formatP )

       Read  the  header  from  a  PGM file, filling in the rows,
       cols, maxval and format variables.



                                                                1




libpgm(3)                                               libpgm(3)


       void pgmreadpgmrow( FILE* fp, gray* grayrow, int cols, gray maxval, int format )

       Read a row of grays into the grayrow array.  Format, cols,
       and maxval were filled in by pgmreadpgminit().

       gray** pgmreadpgm( FILE* fp, int* colsP, int* rowsP, gray* maxvalP )

       Read  an  entire  graymap  file into memory, returning the
       allocated array and filling in the rows, cols  and  maxval
       variables.    This  function  combines  pgmreadpgminit(),
       pgmallocarray() and pgmreadpgmrow().

   WRITING FILES
       void pgmwritepgminit( FILE* fp, int cols, int rows, gray maxval, int forceplain )

       Write the header for a portable graymap file.  The  force-
       plain  flag  forces  a plain-format file to be written, as
       opposed to a raw-format one.

       void pgmwritepgmrow( FILE* fp, gray* grayrow, int cols, gray maxval, int forceplain )

       Write a row from a portable graymap.

       void pgmwritepgm( FILE* fp, gray** grays, int cols, int rows, gray maxval, int forceplain )

       Write the header and all  data  for  a  portable  graymap.
       This     function    combines    pgmwritepgminit()    and
       pgmwritepgmrow().

SEE ALSO
       libpbm(3), libppm(3), libpnm(3)

AUTHOR
       Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.























                                                                2


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026