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 / PPM / libppm.3 < prev    next >
Text File  |  1996-11-18  |  5KB  |  165 lines

  1. .TH libppm 3
  2. .SH NAME
  3. libppm - functions to support portable pixmap 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 <ppm.h>
  17. cc ... libppm.a libpgm.a libpbm.a
  18. .Se
  19. .SH DESCRIPTION
  20. .SS TYPES AND CONSTANTS
  21. .Ss
  22. typedef ... pixel;
  23. typedef ... pixval;
  24. #define PPM_MAXMAXVAL ...
  25. extern pixval ppm_pbmmaxval;
  26. .Se
  27. Each
  28. .BR pixel
  29. contains three
  30. .BR pixval s,
  31. each of which should contain only the values between
  32. .BR 0
  33. and
  34. .BR PPM_MAXMAXVAL .
  35. .BR ppm_pbmmaxval
  36. is the maxval used when a PPM program reads a PBM file.
  37. Normally it is 1; however, for some programs, a larger value gives better
  38. results.
  39. .Ss
  40. #define PPM_FORMAT ...
  41. #define RPPM_FORMAT ...
  42. #define PPM_TYPE PPM_FORMAT
  43. int PPM_FORMAT_TYPE( int format )
  44. .Se
  45. For distinguishing different file formats and types.
  46. .Ss
  47. pixval PPM_GETR( pixel p )
  48. pixval PPM_GETG( pixel p )
  49. pixval PPM_GETB( pixel p )
  50. .Se
  51. These three macros retrieve the red, green or blue value from the given
  52. pixel.
  53. .Ss
  54. void PPM_ASSIGN( pixel p, pixval red, pixval grn, pixval blu )
  55. .Se
  56. This macro assigns the given red, green and blue values to the pixel.
  57. .Ss
  58. int PPM_EQUAL( pixel p, pixel q )
  59. .Se
  60. This macro checks two pixels for equality.
  61. .Ss
  62. void PPM_DEPTH( pixel newp, pixel p, pixval oldmaxval, pixval newmaxval )
  63. .Se
  64. This macro scales the colors of pixel
  65. .BR p
  66. according the old and new maximum values and assigns the new values to
  67. .BR newp .
  68. It is intended to make writing ppmtowhatever easier.
  69. .Ss
  70. float PPM_LUMIN( pixel p )
  71. .Se
  72. This macro determines the luminance of the pixel
  73. .BR p .
  74. .SS MEMORY MANAGEMENT
  75. .Ss
  76. pixel** ppm_allocarray( int cols, int rows )
  77. .Se
  78. Allocate an array of pixels.
  79. .Ss
  80. pixel* ppm_allocrow( int cols )
  81. .Se
  82. Allocate a row of the given number of pixels.
  83. .Ss
  84. void ppm_freearray( pixel** pixels, int rows )
  85. .Se
  86. Free the array allocated with
  87. .BR ppm_allocarray()
  88. containing the given number
  89. of rows.
  90. .Ss
  91. void pbm_freerow( pixel* pixelrow )
  92. .Se
  93. Free a row of pixels.
  94. .SS READING PBM FILES
  95. .Ss
  96. void ppm_readppminit( FILE* fp, int* colsP, int* rowsP, pixval* maxvalP, int* formatP )
  97. .Se
  98. Read the header from a PPM file, filling in the rows, cols, maxval and format
  99. variables.
  100. .Ss
  101. void ppm_readppmrow( FILE* fp, pixel* pixelrow, int cols, pixval maxval, int format )
  102. .Se
  103. Read a row of pixels into the pixelrow array.
  104. Format, cols, and maxval were filled in by
  105. .BR ppm_readppminit() .
  106. .Ss
  107. pixel** ppm_readppm( FILE* fp, int* colsP, int* rowsP, pixval* maxvalP )
  108. .Se
  109. Read an entire pixmap file into memory, returning the allocated array and
  110. filling in the rows, cols and maxval variables.
  111. This function combines
  112. .BR ppm_readppminit() ,
  113. .BR ppm_allocarray()
  114. and
  115. .BR ppm_readppmrow() .
  116. .SS WRITING FILES
  117. .Ss
  118. void ppm_writeppminit( FILE* fp, int cols, int rows, pixval maxval, int forceplain )
  119. .Se
  120. Write the header for a portable pixmap file.
  121. The forceplain flag forces a plain-format file to be written, as opposed
  122. to a raw-format one.
  123. .Ss
  124. void ppm_writeppmrow( FILE* fp, pixel* pixelrow, int cols, pixval maxval, int forceplain )
  125. .Se
  126. Write a row from a portable pixmap.
  127. .Ss
  128. void ppm_writeppm( FILE* fp, pixel** pixels, int cols, int rows, pixval maxval, int forceplain )
  129. .Se
  130. Write the header and all data for a portable pixmap.
  131. This function combines
  132. .BR ppm_writeppminit()
  133. and
  134. .BR ppm_writeppmrow() .
  135. .SS COLOR NAMES
  136. .Ss
  137. pixel ppm_parsecolor( char* colorname, pixval maxval )
  138. .Se
  139. Parses an ASCII color name into a pixel.
  140. The color can be specified in three ways.  One, as a name, assuming
  141. that a pointer to an X11-style color names file was compiled in.  Two,
  142. as an X11-style hexadecimal number: #rgb, #rrggbb, #rrrgggbbb, or
  143. #rrrrggggbbbb.  Three, as a triplet of decimal floating point numbers
  144. separated by commas: r.r,g.g,b.b.
  145. .Ss
  146. char* ppm_colorname( pixel* colorP, pixval maxval, int hexok )
  147. .Se
  148. Returns a pointer to a string describing the given color.
  149. If the X11 color names file is available and the color appears in
  150. it, that name is returned.
  151. Otherwise, if the hexok flag is true then a hexadecimal colorspec
  152. is returned; if hexok is false and the X11 color names file is
  153. available, then the closest matching color is returned;
  154. otherwise, it's an error.
  155. .SH "SEE ALSO"
  156. pbm(3), pgm(3)
  157. .SH AUTHOR
  158. Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  159. .\" Permission to use, copy, modify, and distribute this software and its
  160. .\" documentation for any purpose and without fee is hereby granted, provided
  161. .\" that the above copyright notice appear in all copies and that both that
  162. .\" copyright notice and this permission notice appear in supporting
  163. .\" documentation.  This software is provided "as is" without express or
  164. .\" implied warranty.
  165.