pbm(3) — C LIBRARY FUNCTIONS
NAME
pbm - functions to support portable bitmap programs
SYNOPSIS
#include <pbm.h>
cc ... libpbm.a
DESCRIPTION
TYPES AND CONSTANTS
typedef unsigned char bit;
#define PBM_WHITE 0
#define PBM_BLACK 1
Each bit should contain only the values of white or black.
PBM MEMORY MANAGEMENT
bit ∗∗pbm_allocarray(int cols, int rows)
Allocate an array of bits.
bit ∗pbm_allocrow( int cols )
Allocate a row of the given number of bits.
void pbm_freearray( bitrow, rows )
Free the array allocated with pbm_allocarray() containing the given number of rows.
pbm_freerow( bitrow )
Free a row of bits.
READING PBM FILES
void
pbm_readpbminit( file, colsP, rowsP, formatP )
FILE ∗file;
int ∗colsP, ∗rowsP, ∗formatP;
Read the header from a pbm file, filling in the rows, cols and format variables.
void
pbm_readpbmrow( file, bitrow, cols, format )
FILE ∗file;
bit ∗bitrow;
int cols, format;
Read a row of bits into the bitrow array. Format and cols were filled in by pbm_readpbminit().
bit ∗∗
pbm_readpbm( file, colsP, rowsP )
FILE ∗file;
int ∗colsP, ∗rowsP;
Read an entire bitmap file into memory, returning the allocated array and filling in the rows and cols variables. This function combines pbm_readpbminit(), pbm_allocarray() and pbm_readpbmrow().
WRITING PBM FILES
void
pbm_writepbminit( file, cols, rows )
FILE ∗file;
int cols, rows;
Write the header for a portable bitmap file.
void
pbm_writepbmrow( file, bitrow, cols )
FILE ∗file;
bit ∗bitrow;
int cols;
Write a row from a portable bitmap.
void
pbm_writepbm( file, bits, cols, rows )
FILE ∗file;
bit ∗∗bits;
int cols, rows;
Write the header and all data for a portable bitmap. This function combines pbm_writepbminit() and pbm_writepbmrow().
SEE ALSO
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 documentation. This software is provided "as is" without express or implied warranty.
Amiga Unix — Last change: