diff options
Diffstat (limited to 'libpgm.html')
-rw-r--r-- | libpgm.html | 414 |
1 files changed, 207 insertions, 207 deletions
diff --git a/libpgm.html b/libpgm.html index 7ab50524..47bf2335 100644 --- a/libpgm.html +++ b/libpgm.html @@ -1,206 +1,206 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<HTML> -<HEAD> -<TITLE>User manual for old pgm functions</TITLE> -<META NAME="manual_section" CONTENT="3"> -</HEAD> -<BODY> -<H1>pgm Functions</H1> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN"> +<html> +<head> +<title>User manual for old pgm functions</title> +<meta name="manual_section" content="3"> +</head> +<body> +<h1>pgm Functions</h1> Updated: 8 September 2007 -<BR> -<A HREF="#index">Table Of Contents</A> -<H2>NAME</H2> +<br> +<a href="#index">Table Of Contents</a> +<h2>NAME</h2> libpgm - libnetpbm functions to read and write PGM image files -<H2 id="synopsis">SYNOPSIS</H2> - -<B>#include <netpbm/pgm.h></B> - -<P> -<B>void pgm_init( </B> -<B>int *</B><I>argcP</I><B>,</B> -<B>char *</B><I>argv</I><B>[]</B> -<B>);</B> - -<P> -<B>gray ** pgm_allocarray(</B> -<B>int </B><I>cols</I><B>,</B> -<B>int </B><I>rows</I><B> );</B> - -<P> -<B>gray * pgm_allocrow(</B> -<B>int</B><I>cols</I><B> );</B> - -<P> -<B>void pgm_freearray(</B> -<B>gray **</B><I>grays</I><B>,</B> -<B>int</B><I>rows</I><B> );</B> - -<P> -<B>void pgm_freerow(</B> -<B>gray *</B><I>grayrow</I><B>);</B> - -<P> -<B>void pgm_readpgminit( </B> -<B>FILE *</B><I>fp</I><B>,</B> -<B>int *</B><I>colsP</I><B>,</B> -<B>int *</B><I>rowsP</I><B>,</B> -<B>gray *</B><I>maxvalP</I><B>,</B> -<B>int *</B><I>formatP</I><B> );</B> - -<P> -<B>void pgm_readpgmrow( </B> -<B>FILE *</B><I>fp</I><B>,</B> -<B>gray *</B><I>grayrow</I><B>,</B> -<B>int </B><I>cols</I><B>,</B> -<B>gray </B><I>maxval</I><B>,</B> -<B>int </B><I>format</I><B> );</B> - -<P> -<B>gray ** pgm_readpgm( </B> -<B>FILE *</B><I>fp</I><B>,</B> -<B>int *</B><I>colsP</I><B>,</B> -<B>int *</B><I>rowsP</I><B>,</B> -<B>gray *</B><I>maxvalP</I><B> );</B> - -<P> -<B>void pgm_writepgminit( </B> -<B>FILE * fp , </B> -<B>int </B><I>cols</I><B>,</B> -<B>int </B><I>rows</I><B>,</B> -<B>gray </B><I>maxval</I><B>,</B> -<B>int </B><I>forceplain</I><B> );</B> - -<P> -<B>void pgm_writepgmrow( </B> -<B>FILE *</B><I>fp</I><B>,</B> -<B>gray *</B><I>grayrow</I><B>,</B> -<B>int cols</B><I>,</I> -<B>gray </B><I>maxval</I><B>,</B> -<B>int </B><I>forceplain</I><B> );</B> - -<P> -<B>void pgm_writepgm( </B> -<B>FILE *</B><I>fp</I><B>,</B> -<B>gray ** </B><I>grays</I><B>,</B> -<B>int </B><I>cols</I><B>,</B> -<B>int </B><I>rows</I><B>,</B> -<B>gray </B><I>maxval</I><B>,</B> -<B>int </B><I>forceplain</I><B> );</B> - -<P> -<B>void pgm_writepgm( </B> -<B>FILE *</B><I>fp</I><B>,</B> -<B>gray **</B><I>grays</I><B>,</B> -<B>int </B><I>cols</I><B>,</B> -<B>int </B><I>rows</I><B>,</B> -<B>gray </B><I>maxval</I><B>,</B> -<B>int </B><I>forceplain</I><B> );</B> - -<P> -<B>void pgm_nextimage(</B> -<B>FILE *</B><I>file</I><B>,</B> -<B>int * const </B><I>eofP</I><B>);</B> - -<P> -<B>void pgm_check(</B> -<B>FILE * </B><I>file</I><B>,</B> -<B>const enum pm_check_type </B><I>check_type</I><B>,</B> -<B>const int </B><I>format</I><B>,</B> -<B>const int </B><I>cols</I><B>,</B> -<B>const int </B><I>rows</I><B>,</B> -<B>const int </B><I>maxval</I><B>,</B> -<B>enum pm_check_code * const </B><I>retval</I><B>);</B> - -<P> -<B>typedef ... gray;</B> - -<P> -<B>#define PGM_MAXMAXVAL ...</B> - -<P> -<B>#define PGM_OVERALLMAXVAL ...</B> - -<P> -<B>#define PGM_FORMAT ...</B> - -<P> -<B>#define RPGM_FORMAT ...</B> - -<P> -<B>#define PGM_TYPE PGM_FORMAT</B> - -<P> -<B>#define </B> - -<B>PGM_FORMAT_TYPE(</B><I>format</I><B>)</B> -<B>...</B> - -<H2 id="description">DESCRIPTION</H2> +<h2 id="synopsis">SYNOPSIS</h2> + +<b>#include <netpbm/pgm.h></b> + +<p> +<b>void pgm_init( </b> +<b>int *</b><i>argcP</i><b>,</b> +<b>char *</b><i>argv</i><b>[]</b> +<b>);</b> + +<p> +<b>gray ** pgm_allocarray(</b> +<b>int </b><i>cols</i><b>,</b> +<b>int </b><i>rows</i><b> );</b> + +<p> +<b>gray * pgm_allocrow(</b> +<b>int</b><i>cols</i><b> );</b> + +<p> +<b>void pgm_freearray(</b> +<b>gray **</b><i>grays</i><b>,</b> +<b>int</b><i>rows</i><b> );</b> + +<p> +<b>void pgm_freerow(</b> +<b>gray *</b><i>grayrow</i><b>);</b> + +<p> +<b>void pgm_readpgminit( </b> +<b>FILE *</b><i>fp</i><b>,</b> +<b>int *</b><i>colsP</i><b>,</b> +<b>int *</b><i>rowsP</i><b>,</b> +<b>gray *</b><i>maxvalP</i><b>,</b> +<b>int *</b><i>formatP</i><b> );</b> + +<p> +<b>void pgm_readpgmrow( </b> +<b>FILE *</b><i>fp</i><b>,</b> +<b>gray *</b><i>grayrow</i><b>,</b> +<b>int </b><i>cols</i><b>,</b> +<b>gray </b><i>maxval</i><b>,</b> +<b>int </b><i>format</i><b> );</b> + +<p> +<b>gray ** pgm_readpgm( </b> +<b>FILE *</b><i>fp</i><b>,</b> +<b>int *</b><i>colsP</i><b>,</b> +<b>int *</b><i>rowsP</i><b>,</b> +<b>gray *</b><i>maxvalP</i><b> );</b> + +<p> +<b>void pgm_writepgminit( </b> +<b>FILE * fp , </b> +<b>int </b><i>cols</i><b>,</b> +<b>int </b><i>rows</i><b>,</b> +<b>gray </b><i>maxval</i><b>,</b> +<b>int </b><i>forceplain</i><b> );</b> + +<p> +<b>void pgm_writepgmrow( </b> +<b>FILE *</b><i>fp</i><b>,</b> +<b>gray *</b><i>grayrow</i><b>,</b> +<b>int cols</b><i>,</i> +<b>gray </b><i>maxval</i><b>,</b> +<b>int </b><i>forceplain</i><b> );</b> + +<p> +<b>void pgm_writepgm( </b> +<b>FILE *</b><i>fp</i><b>,</b> +<b>gray ** </b><i>grays</i><b>,</b> +<b>int </b><i>cols</i><b>,</b> +<b>int </b><i>rows</i><b>,</b> +<b>gray </b><i>maxval</i><b>,</b> +<b>int </b><i>forceplain</i><b> );</b> + +<p> +<b>void pgm_writepgm( </b> +<b>FILE *</b><i>fp</i><b>,</b> +<b>gray **</b><i>grays</i><b>,</b> +<b>int </b><i>cols</i><b>,</b> +<b>int </b><i>rows</i><b>,</b> +<b>gray </b><i>maxval</i><b>,</b> +<b>int </b><i>forceplain</i><b> );</b> + +<p> +<b>void pgm_nextimage(</b> +<b>FILE *</b><i>file</i><b>,</b> +<b>int * const </b><i>eofP</i><b>);</b> + +<p> +<b>void pgm_check(</b> +<b>FILE * </b><i>file</i><b>,</b> +<b>const enum pm_check_type </b><i>check_type</i><b>,</b> +<b>const int </b><i>format</i><b>,</b> +<b>const int </b><i>cols</i><b>,</b> +<b>const int </b><i>rows</i><b>,</b> +<b>const int </b><i>maxval</i><b>,</b> +<b>enum pm_check_code * const </b><i>retval</i><b>);</b> + +<p> +<b>typedef ... gray;</b> + +<p> +<b>#define PGM_MAXMAXVAL ...</b> + +<p> +<b>#define PGM_OVERALLMAXVAL ...</b> + +<p> +<b>#define PGM_FORMAT ...</b> + +<p> +<b>#define RPGM_FORMAT ...</b> + +<p> +<b>#define PGM_TYPE PGM_FORMAT</b> + +<p> +<b>#define </b> + +<b>PGM_FORMAT_TYPE(</b><i>format</i><b>)</b> +<b>...</b> + +<h2 id="description">DESCRIPTION</h2> <p>These library functions are part of <a href="index.html">Netpbm</a>. -<H3 id="types">TYPES AND CONSTANTS</H3> +<h3 id="types">TYPES AND CONSTANTS</h3> -<P>Each <B>gray</B> should contain only the values between <B>0</B> -and <B>PGM_OVERALLMAXVAL</B>. +<p>Each <b>gray</b> should contain only the values between <b>0</b> +and <b>PGM_OVERALLMAXVAL</b>. -<P><B>PGM_OVERALLMAXVAL</B> is the maximum value of a maxval in a PGM -file. <B>PGM_MAXMAXVAL</B> is the maximum value of a maxval in a PGM +<p><b>PGM_OVERALLMAXVAL</b> is the maximum value of a maxval in a PGM +file. <b>PGM_MAXMAXVAL</b> is the maximum value of a maxval in a PGM file that is compatible with the PGM format as it existed before April 2000. It is also the maximum value of a maxval that results in the minimum possible raster size for a particular image. I.e an image -with a maxval higher than <B>PGM_MAXMAXVAL</B> cannot be read or +with a maxval higher than <b>PGM_MAXMAXVAL</b> cannot be read or generated by old PGM processing programs and requires more file space. -<P><B>PGM_FORMAT </B> is the format code for a Plain PGM format image -file. <B>RPGM_FORMAT</B> is the format code for a Raw PGM format -image file. <B>PGM_TYPE </B> is the format type code for the PGM -formats. <B>PGM_FORMAT_TYPE</B> is a macro that generates code to +<p><b>PGM_FORMAT </b> is the format code for a Plain PGM format image +file. <b>RPGM_FORMAT</b> is the format code for a Raw PGM format +image file. <b>PGM_TYPE </b> is the format type code for the PGM +formats. <b>PGM_FORMAT_TYPE</b> is a macro that generates code to compute the format type code of a PBM or PGM format from the format code which is its argument. -<H3 id="initialization">INITIALIZATION</H3> +<h3 id="initialization">INITIALIZATION</h3> <p><b>pgm_init()</b> is obsolete (at least since Netpbm 9.25 (March 2002)). Use <a href="libpm.html#initialization"><b>pm_proginit()</b></a> instead. -<P><b>pgm_init()</b> is identical to <b>pm_proginit</b>. +<p><b>pgm_init()</b> is identical to <b>pm_proginit</b>. -<H3 id="memorymanagement">MEMORY MANAGEMENT</H3> +<h3 id="memorymanagement">MEMORY MANAGEMENT</h3> -<B>pgm_allocarray()</B> allocates an array of grays. +<b>pgm_allocarray()</b> allocates an array of grays. -<P><B>pgm_allocrow()</B> allocates a row of the given number of grays. +<p><b>pgm_allocrow()</b> allocates a row of the given number of grays. -<P><B>pgm_freearray()</B> frees the array allocated with -<B>pgm_allocarray()</B> containing the given number of rows. +<p><b>pgm_freearray()</b> frees the array allocated with +<b>pgm_allocarray()</b> containing the given number of rows. -<P><B>pgm_freerow()</B> frees a row of grays allocated with -<B>pgm_allocrow()</B>. +<p><b>pgm_freerow()</b> frees a row of grays allocated with +<b>pgm_allocrow()</b>. -<H3 id="reading">READING FILES</H3> +<h3 id="reading">READING FILES</h3> -<P>If a function in this section is called on a PBM format file, it +<p>If a function in this section is called on a PBM format file, it translates the PBM file into a PGM file on the fly and functions as if -it were called on the equivalent PGM file. The <I>format</I> value -returned by <B>pgm_readpgminit()</B> is, however, not translated. It +it were called on the equivalent PGM file. The <i>format</i> value +returned by <b>pgm_readpgminit()</b> is, however, not translated. It represents the actual format of the PBM file. -<P><B>pgm_readpgminit()</B> reads the header of a PGM file, returning +<p><b>pgm_readpgminit()</b> reads the header of a PGM file, returning all the information from the header and leaving the file positioned just after the header. -<P><B>pgm_readpgmrow()</B> reads a row of grays into the <I>grayrow -</I> array. <I>format</I>, <I>cols</I>, and <I>maxval </I> are the -values returned by <B>pgm_readpgminit()</B>. +<p><b>pgm_readpgmrow()</b> reads a row of grays into the <i>grayrow +</i> array. <i>format</i>, <i>cols</i>, and <i>maxval </i> are the +values returned by <b>pgm_readpgminit()</b>. -<P><B>pgm_readpgm()</B> reads an entire PGM image into memory, +<p><b>pgm_readpgm()</b> reads an entire PGM image into memory, returning the allocated array as its return value and returning the -information from the header as <I>rows</I>, <I>cols</I>, and -<I>maxval</I>. This function combines <B>pgm_readpgminit()</B>, -<B>pgm_allocarray()</B>, and <B>pgm_readpgmrow()</B>. +information from the header as <i>rows</i>, <i>cols</i>, and +<i>maxval</i>. This function combines <b>pgm_readpgminit()</b>, +<b>pgm_allocarray()</b>, and <b>pgm_readpgmrow()</b>. <p><b>pgm_readpgminit()</b> and <b>pgm_readpgm</b> abort the program with a message to Standard Error if the PGM image header is not syntactically @@ -209,59 +209,59 @@ the system's normal data structures (to wit, a number that won't fit in a C 'int'). -<H3 id="writing">WRITING FILES</H3> +<h3 id="writing">WRITING FILES</h3> -<B>pgm_writepgminit()</B> writes the header for a PGM file and leaves +<b>pgm_writepgminit()</b> writes the header for a PGM file and leaves it positioned just after the header. -<P><I>forceplain</I> is a logical value that tells -<B>pgm_writepgminit() </B> to write a header for a plain PGM format +<p><i>forceplain</i> is a logical value that tells +<b>pgm_writepgminit() </b> to write a header for a plain PGM format file, as opposed to a raw PGM format file. -<P><B>pgm_writepgmrow()</B> writes the row <I>grayrow</I> to a PGM -file. For meaningful results, <I>cols</I>, <I>maxval</I>, and -<I>forceplain</I> must be the same as was used with -<B>pgm_writepgminit()</B>. +<p><b>pgm_writepgmrow()</b> writes the row <i>grayrow</i> to a PGM +file. For meaningful results, <i>cols</i>, <i>maxval</i>, and +<i>forceplain</i> must be the same as was used with +<b>pgm_writepgminit()</b>. -<P><B>pgm_writepgm()</B> write the header and all data for a PGM -image. This function combines <B>pgm_writepgminit()</B> and -<B>pgm_writepgmrow()</B>. +<p><b>pgm_writepgm()</b> write the header and all data for a PGM +image. This function combines <b>pgm_writepgminit()</b> and +<b>pgm_writepgmrow()</b>. -<H3 id="miscellaneous">MISCELLANEOUS</H3> +<h3 id="miscellaneous">MISCELLANEOUS</h3> -<P><B>pgm_nextimage()</B> positions a PGM input file to the next image -in it (so that a subsequent <B>pgm_readpgminit()</B> reads its +<p><b>pgm_nextimage()</b> positions a PGM input file to the next image +in it (so that a subsequent <b>pgm_readpgminit()</b> reads its header). -<P><B>pgm_nextimage()</B> is analogous to <B>pbm_nextimage()</B>, but +<p><b>pgm_nextimage()</b> is analogous to <b>pbm_nextimage()</b>, but works on PGM and PBM files. -<P><B>pgm_check() </B> checks for the common file integrity error +<p><b>pgm_check() </b> checks for the common file integrity error where the file is the wrong size to contain all the image data. -<P><B>pgm_check() </B> is analogous to <B>pbm_check()</B>, but works +<p><b>pgm_check() </b> is analogous to <b>pbm_check()</b>, but works on PGM and PBM files. -<H2 id="seealso">SEE ALSO</H2> - -<B><A HREF="libpbm.html">libpbm</A></B>, -<B><A HREF="libppm.html">libppm</A></B>, -<B><A HREF="libpnm.html">libpnm</A></B> - -<HR> -<H2 id="index">Table Of Contents</H2> -<UL> -<LI><A HREF="#synopsis">SYNOPSIS</A> -<LI><A HREF="#description">DESCRIPTION</A> - <UL> - <LI><A HREF="#types">TYPES AND CONSTANTS</A> - <LI><A HREF="#initialization">INITIALIZATION</A> - <LI><A HREF="#memorymanagement">MEMORY MANAGEMENT</A> - <LI><A HREF="#reading">READING FILES</A> - <LI><A HREF="#writing">WRITING FILES</A> - <LI><A HREF="#miscellaneous">MISCELLANEOUS</A> - </UL> -<LI><A HREF="#seealso">SEE ALSO</A> -</UL> -</BODY> -</HTML> +<h2 id="seealso">SEE ALSO</h2> + +<b><a href="libpbm.html">libpbm</a></b>, +<b><a href="libppm.html">libppm</a></b>, +<b><a href="libpnm.html">libpnm</a></b> + +<hr> +<h2 id="index">Table Of Contents</h2> +<ul> +<li><a href="#synopsis">SYNOPSIS</a> +<li><a href="#description">DESCRIPTION</a> + <ul> + <li><a href="#types">TYPES AND CONSTANTS</a> + <li><a href="#initialization">INITIALIZATION</a> + <li><a href="#memorymanagement">MEMORY MANAGEMENT</a> + <li><a href="#reading">READING FILES</a> + <li><a href="#writing">WRITING FILES</a> + <li><a href="#miscellaneous">MISCELLANEOUS</a> + </ul> +<li><a href="#seealso">SEE ALSO</a> +</ul> +</body> +</html> |