home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / NETWORK / netpbm_src.lzh / NETPBM / PBM / libpbm.3 < prev    next >
Text File  |  1996-11-18  |  5KB  |  191 lines

  1. .TH libpbm 3
  2. .SH NAME
  3. libpbm - functions to support portable bitmap programs
  4. .SH SYNOPSIS
  5. .de Ss
  6. .sp
  7. .ft CW
  8. .nf
  9. ..
  10. .de Se
  11. .fi
  12. .ft P
  13. .sp
  14. ..
  15. .Ss
  16. #include <pbm.h>
  17. cc ... libpbm.a
  18. .Se
  19. .SH DESCRIPTION - PACKAGE-WIDE ROUTINES
  20. .SS KEYWORD MATCHING
  21. .Ss
  22. int pm_keymatch( char* str, char* keyword, int minchars )
  23. .Se
  24. Does a case-insensitive match of
  25. .BR str
  26. against
  27. .BR keyword .
  28. .BR str
  29. can be a leading sunstring of
  30. .BR keyword ,
  31. but at least
  32. .BR minchars
  33. must be present.
  34. .SS LOG BASE TWO
  35. .Ss
  36. int pm_maxvaltobits( int maxval )
  37. int pm_bitstomaxval( int bits )
  38. .Se
  39. Convert between a maxval and the minimum number of bits required
  40. to hold it.
  41. .SS MESSAGES AND ERRORS
  42. .Ss
  43. void pm_message( char* fmt, ... )
  44. .Se
  45. .BR printf()
  46. style routine to write an informational message.
  47. .Ss
  48. void pm_error( char* fmt, ... )
  49. .Se
  50. .BR printf()
  51. style routine to write an error message and abort.
  52. .Ss
  53. void pm_usage( char* usage )
  54. .Se
  55. Write a usage message.
  56. The string should indicate what arguments are to be provided to the program.
  57. .SS GENERIC FILE MANAGEMENT
  58. .Ss
  59. FILE* pm_openr( char* name )
  60. .Se
  61. Open the given file for reading, with appropriate error checking.
  62. A filename of "-" is taken as equivalent to stdin.
  63. .Ss
  64. FILE* pm_openw( char* name )
  65. .Se
  66. Open the given file for writing, with appropriate error checking.
  67. .Ss
  68. void pm_close( FILE* fp )
  69. .Se
  70. Close the file descriptor, with appropriate error checking.
  71. .SS ENDIAN I/O
  72. .Ss
  73. int pm_readbigshort( FILE* in, short* sP )
  74. int pm_writebigshort( FILE* out, short s )
  75. int pm_readbiglong( FILE* in, long* lP )
  76. int pm_writebiglong( FILE* out, long l )
  77. int pm_readlittleshort( FILE* in, short* sP )
  78. int pm_writelittleshort( FILE* out, short s )
  79. int pm_readlittlelong( FILE* in, long* lP )
  80. int pm_writelittlelong( FILE* out, long l )
  81. .Se
  82. Routines to read and write short and long ints in either big- or
  83. little-endian byte order.
  84. .SH DESCRIPTION - PBM-SPECIFIC ROUTINES
  85. .SS TYPES AND CONSTANTS
  86. .Ss
  87. typedef ... bit;
  88. #define PBM_WHITE ...
  89. #define PBM_BLACK ...
  90. .Se
  91. each
  92. .BR bit
  93. should contain only the values of
  94. .BR PBM_WHITE
  95. or
  96. .BR PBM_BLACK .
  97. .Ss
  98. #define PBM_FORMAT ...
  99. #define RPBM_FORMAT ...
  100. #define PBM_TYPE PBM_FORMAT
  101. #define PBM_FORMAT_TYPE(f) ...
  102. .Se
  103. For distinguishing different file formats and types.
  104. .SS INITIALIZATION
  105. .Ss
  106. void pbm_init( int* argcP, char* argv[] )
  107. .Se
  108. All PBM programs must call this routine.
  109. .SS MEMORY MANAGEMENT
  110. .Ss
  111. bit** pbm_allocarray( int cols, int rows )
  112. .Se
  113. Allocate an array of bits.
  114. .Ss
  115. bit* pbm_allocrow( int cols )
  116. .Se
  117. Allocate a row of the given number of bits.
  118. .Ss
  119. void pbm_freearray( bit** bits, int rows )
  120. .Se
  121. Free the array allocated with
  122. .BR pbm_allocarray()
  123. containing the given number
  124. of rows.
  125. .Ss
  126. void pbm_freerow( bit* bitrow )
  127. .Se
  128. Free a row of bits.
  129. .SS READING FILES
  130. .Ss
  131. void pbm_readpbminit( FILE* fp, int* colsP, int* rowsP, int* formatP )
  132. .Se
  133. Read the header from a PBM file, filling in the rows, cols and format
  134. variables.
  135. .Ss
  136. void pbm_readpbmrow( FILE* fp, bit* bitrow, int cols, int format )
  137. .Se
  138. Read a row of bits into the bitrow array.
  139. Format and cols were filled in by
  140. .BR pbm_readpbminit() .
  141. .Ss
  142. bit** pbm_readpbm( FILE* fp, int* colsP, int* rowsP )
  143. .Se
  144. Read an entire bitmap file into memory, returning the allocated array and
  145. filling in the rows and cols variables.
  146. This function combines
  147. .BR pbm_readpbminit() ,
  148. .BR pbm_allocarray()
  149. and
  150. .BR pbm_readpbmrow() .
  151. .Ss
  152. char* pm_read_unknown_size( FILE* fp, long* nread )
  153. .Se
  154. Read an entire file or input stream of unknown size to a buffer.
  155. Allocate memory more memory as needed. The calling routine has
  156. to free the allocated buffer with
  157. .BR free() .
  158. .BR pm_read_unknown_size()
  159. returns a pointer to the allocated buffer. The
  160. .BR nread
  161. argument returns the number of bytes read.
  162. .SS WRITING FILES
  163. .Ss
  164. void pbm_writepbminit( FILE* fp, int cols, int rows, int forceplain )
  165. .Se
  166. Write the header for a portable bitmap file.
  167. The forceplain flag forces a plain-format file to be written, as opposed
  168. to a raw-format one.
  169. .Ss
  170. void pbm_writepbmrow( FILE* fp, bit* bitrow, int cols, int forceplain )
  171. .Se
  172. Write a row from a portable bitmap.
  173. .Ss
  174. void pbm_writepbm( FILE* fp, bit** bits, int cols, int rows, int forceplain )
  175. .Se
  176. Write the header and all data for a portable bitmap.
  177. This function combines
  178. .BR pbm_writepbminit()
  179. and
  180. .BR pbm_writepbmrow() .
  181. .SH "SEE ALSO"
  182. libpgm(3), libppm(3), libpnm(3)
  183. .SH AUTHOR
  184. Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  185. .\" Permission to use, copy, modify, and distribute this software and its
  186. .\" documentation for any purpose and without fee is hereby granted, provided
  187. .\" that the above copyright notice appear in all copies and that both that
  188. .\" copyright notice and this permission notice appear in supporting
  189. .\" documentation.  This software is provided "as is" without express or
  190. .\" implied warranty.
  191.