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 / PGM / libpgm.3 < prev    next >
Text File  |  1996-11-18  |  3KB  |  119 lines

  1. .TH libpgm 3
  2. .SH NAME
  3. libpgm - functions to support portable graymap 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 <pgm.h>
  17. cc ... libpgm.a libpbm.a
  18. .Se
  19. .SH DESCRIPTION
  20. .SS TYPES AND CONSTANTS
  21. .Ss
  22. typedef ... gray;
  23. #define PGM_MAXMAXVAL ...
  24. extern gray pgm_pbmmaxval;
  25. .Se
  26. Each
  27. .BR gray
  28. should contain only the values between
  29. .BR 0
  30. and
  31. .BR PGM_MAXMAXVAL .
  32. .BR pgm_pbmmaxval
  33. is the maxval used when a PGM program reads a PBM file.
  34. Normally it is 1; however, for some programs, a larger value gives better
  35. results.
  36. .Ss
  37. #define PGM_FORMAT ...
  38. #define RPGM_FORMAT ...
  39. #define PGM_TYPE PGM_FORMAT
  40. int PGM_FORMAT_TYPE( int format )
  41. .Se
  42. For distinguishing different file formats and types.
  43. .SS INITIALIZATION
  44. .Ss
  45. void pgm_init( int* argcP, char* argv[] )
  46. .Se
  47. All PGM programs must call this routine.
  48. .SS MEMORY MANAGEMENT
  49. .Ss
  50. gray** pgm_allocarray( int cols, int rows )
  51. .Se
  52. Allocate an array of grays.
  53. .Ss
  54. gray* pgm_allocrow( int cols )
  55. .Se
  56. Allocate a row of the given number of grays.
  57. .Ss
  58. void pgm_freearray( gray** grays, int rows )
  59. .Se
  60. Free the array allocated with
  61. .BR pgm_allocarray()
  62. containing the given number
  63. of rows.
  64. .Ss
  65. void pgm_freerow( gray* grayrow )
  66. .Se
  67. Free a row of grays.
  68. .SS READING FILES
  69. .Ss
  70. void pgm_readpgminit( FILE* fp, int* colsP, int* rowsP, gray* maxvalP, int* formatP )
  71. .Se
  72. Read the header from a PGM file, filling in the rows, cols, maxval and format
  73. variables.
  74. .Ss
  75. void pgm_readpgmrow( FILE* fp, gray* grayrow, int cols, gray maxval, int format )
  76. .Se
  77. Read a row of grays into the grayrow array.
  78. Format, cols, and maxval were filled in by
  79. .BR pgm_readpgminit() .
  80. .Ss
  81. gray** pgm_readpgm( FILE* fp, int* colsP, int* rowsP, gray* maxvalP )
  82. .Se
  83. Read an entire graymap file into memory, returning the allocated array and
  84. filling in the rows, cols and maxval variables.
  85. This function combines
  86. .BR pgm_readpgminit() ,
  87. .BR pgm_allocarray()
  88. and
  89. .BR pgm_readpgmrow() .
  90. .SS WRITING FILES
  91. .Ss
  92. void pgm_writepgminit( FILE* fp, int cols, int rows, gray maxval, int forceplain )
  93. .Se
  94. Write the header for a portable graymap file.
  95. The forceplain flag forces a plain-format file to be written, as opposed
  96. to a raw-format one.
  97. .Ss
  98. void pgm_writepgmrow( FILE* fp, gray* grayrow, int cols, gray maxval, int forceplain )
  99. .Se
  100. Write a row from a portable graymap.
  101. .Ss
  102. void pgm_writepgm( FILE* fp, gray** grays, int cols, int rows, gray maxval, int forceplain )
  103. .Se
  104. Write the header and all data for a portable graymap.
  105. This function combines
  106. .BR pgm_writepgminit()
  107. and
  108. .BR pgm_writepgmrow() .
  109. .SH "SEE ALSO"
  110. libpbm(3), libppm(3), libpnm(3)
  111. .SH AUTHOR
  112. Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  113. .\" Permission to use, copy, modify, and distribute this software and its
  114. .\" documentation for any purpose and without fee is hereby granted, provided
  115. .\" that the above copyright notice appear in all copies and that both that
  116. .\" copyright notice and this permission notice appear in supporting
  117. .\" documentation.  This software is provided "as is" without express or
  118. .\" implied warranty.
  119.