copypixels.3gl 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. '\" e
  2. '\"! eqn | mmdoc
  3. '\"macro stdmacro
  4. .ds Vn Version 1.2
  5. .ds Dt 24 September 1999
  6. .ds Re Release 1.2.1
  7. .ds Dp Jan 14 18:30
  8. .ds Dm 01 copypixel
  9. .ds Xs 10756 11 copypixels.gl
  10. .TH GLCOPYPIXELS 3G
  11. .SH NAME
  12. .B "glCopyPixels
  13. \- copy pixels in the frame buffer
  14. .SH C SPECIFICATION
  15. void \f3glCopyPixels\fP(
  16. GLint \fIx\fP,
  17. .nf
  18. .ta \w'\f3void \fPglCopyPixels( 'u
  19. GLint \fIy\fP,
  20. GLsizei \fIwidth\fP,
  21. GLsizei \fIheight\fP,
  22. GLenum \fItype\fP )
  23. .fi
  24. .EQ
  25. delim $$
  26. .EN
  27. .SH PARAMETERS
  28. .TP \w'\f2x\fP\ \f2y\fP\ \ 'u
  29. \f2x\fP, \f2y\fP
  30. Specify the window coordinates of the lower left corner
  31. of the rectangular region of pixels to be copied.
  32. .TP
  33. \f2width\fP, \f2height\fP
  34. Specify the dimensions of the rectangular region of pixels to be copied.
  35. Both must be nonnegative.
  36. .TP
  37. \f2type\fP
  38. Specifies whether color values,
  39. depth values,
  40. or stencil values are to be copied.
  41. Symbolic constants
  42. \%\f3GL_COLOR\fP,
  43. \%\f3GL_DEPTH\fP,
  44. and \%\f3GL_STENCIL\fP are accepted.
  45. .SH DESCRIPTION
  46. \%\f3glCopyPixels\fP copies a screen-aligned rectangle of pixels
  47. from the specified frame buffer location to a region relative to the
  48. current raster position.
  49. Its operation is well defined only if the entire pixel source region
  50. is within the exposed portion of the window.
  51. Results of copies from outside the window,
  52. or from regions of the window that are not exposed,
  53. are hardware dependent and undefined.
  54. .P
  55. \f2x\fP and \f2y\fP specify the window coordinates of
  56. the lower left corner of the rectangular region to be copied.
  57. \f2width\fP and \f2height\fP specify the dimensions of the
  58. rectangular region to be copied.
  59. Both \f2width\fP and \f2height\fP must not be negative.
  60. .P
  61. Several parameters control the processing of the pixel data
  62. while it is being copied.
  63. These parameters are set with three commands:
  64. \%\f3glPixelTransfer\fP,
  65. \%\f3glPixelMap\fP, and
  66. \%\f3glPixelZoom\fP.
  67. This reference page describes the effects on \%\f3glCopyPixels\fP of most,
  68. but not all, of the parameters specified by these three commands.
  69. .P
  70. \%\f3glCopyPixels\fP copies values from each pixel with the lower left-hand corner at
  71. (\f2x\fP + $i$, \f2y\fP + $j$) for 0 \(<= $i$ < \f2width\fP
  72. and 0 \(<= $j$ < \f2height\fP.
  73. This pixel is said to be the $i$th pixel in the $j$th row.
  74. Pixels are copied in row order from the lowest to the highest row,
  75. left to right in each row.
  76. .P
  77. \f2type\fP specifies whether color, depth, or stencil data is to be copied.
  78. The details of the transfer for each data type are as follows:
  79. .TP 15
  80. \%\f3GL_COLOR\fP
  81. Indices or RGBA colors are read from the buffer currently specified as the
  82. read source buffer (see \%\f3glReadBuffer\fP).
  83. If the GL is in color index mode,
  84. each index that is read from this buffer is converted
  85. to a fixed-point with an unspecified
  86. number of bits to the right of the binary point.
  87. Each index is then shifted left by \%\f3GL_INDEX_SHIFT\fP bits,
  88. and added to \%\f3GL_INDEX_OFFSET\fP.
  89. If \%\f3GL_INDEX_SHIFT\fP is negative,
  90. the shift is to the right.
  91. In either case, zero bits fill otherwise unspecified bit locations in the
  92. result.
  93. If \%\f3GL_MAP_COLOR\fP is true,
  94. the index is replaced with the value that it references in lookup table
  95. \%\f3GL_PIXEL_MAP_I_TO_I\fP.
  96. Whether the lookup replacement of the index is done or not,
  97. the integer part of the index is then ANDed with $2 sup b -1$,
  98. where $b$ is the number of bits in a color index buffer.
  99. .IP
  100. If the GL is in RGBA mode,
  101. the red, green, blue, and alpha components of each pixel that is read
  102. are converted to an internal floating-point with unspecified
  103. precision.
  104. The conversion maps the largest representable component value to 1.0,
  105. and component value 0 to 0.0.
  106. The resulting floating-point color values are then multiplied
  107. by \%\f3GL_c_SCALE\fP and added to \%\f3GL_c_BIAS\fP,
  108. where \f2c\fP is RED, GREEN, BLUE, and ALPHA
  109. for the respective color components.
  110. The results are clamped to the range [0,1].
  111. If \%\f3GL_MAP_COLOR\fP is true,
  112. each color component is scaled by the size of lookup table
  113. \%\f3GL_PIXEL_MAP_c_TO_c\fP,
  114. then replaced by the value that it references in that table.
  115. \f2c\fP is R, G, B, or A.
  116. .IP
  117. If the \%\f3GL_ARB_imaging\fP extension is supported, the color values may
  118. be
  119. additionally processed by color-table lookups, color-matrix
  120. transformations, and convolution filters.
  121. .IP
  122. The GL then converts the resulting indices or RGBA colors to fragments
  123. by attaching the current raster position \f2z\fP coordinate and
  124. texture coordinates to each pixel,
  125. then assigning window coordinates
  126. ($x sub r ~+~ i , y sub r ~+~ j$),
  127. where ($x sub r , y sub r$) is the current raster position,
  128. and the pixel was the $i$th pixel in the $j$th row.
  129. These pixel fragments are then treated just like the fragments generated by
  130. rasterizing points, lines, or polygons.
  131. Texture mapping,
  132. fog,
  133. and all the fragment operations are applied before the fragments are written
  134. to the frame buffer.
  135. .TP
  136. \%\f3GL_DEPTH\fP
  137. Depth values are read from the depth buffer and
  138. converted directly to an internal floating-point
  139. with unspecified precision.
  140. The resulting floating-point depth value is then multiplied
  141. by \%\f3GL_DEPTH_SCALE\fP and added to \%\f3GL_DEPTH_BIAS\fP.
  142. The result is clamped to the range [0,1].
  143. .IP
  144. The GL then converts the resulting depth components to fragments
  145. by attaching the current raster position color or color index and
  146. texture coordinates to each pixel,
  147. then assigning window coordinates
  148. ($x sub r ~+~ i , y sub r ~+~ j$),
  149. where ($x sub r , y sub r$) is the current raster position,
  150. and the pixel was the $i$th pixel in the $j$th row.
  151. These pixel fragments are then treated just like the fragments generated by
  152. rasterizing points, lines, or polygons.
  153. Texture mapping,
  154. fog,
  155. and all the fragment operations are applied before the fragments are written
  156. to the frame buffer.
  157. .TP
  158. \%\f3GL_STENCIL\fP
  159. Stencil indices are read from the stencil buffer and
  160. converted to an internal fixed-point
  161. with an unspecified number of bits to the right of the binary point.
  162. Each fixed-point index is then shifted left by \%\f3GL_INDEX_SHIFT\fP bits,
  163. and added to \%\f3GL_INDEX_OFFSET\fP.
  164. If \%\f3GL_INDEX_SHIFT\fP is negative,
  165. the shift is to the right.
  166. In either case, zero bits fill otherwise unspecified bit locations in the
  167. result.
  168. If \%\f3GL_MAP_STENCIL\fP is true,
  169. the index is replaced with the value that it references in lookup table
  170. \%\f3GL_PIXEL_MAP_S_TO_S\fP.
  171. Whether the lookup replacement of the index is done or not,
  172. the integer part of the index is then ANDed with $2 sup b -1$,
  173. where $b$ is the number of bits in the stencil buffer.
  174. The resulting stencil indices are then written to the stencil buffer
  175. such that the index read from the $i$th location of the $j$th row
  176. is written to location
  177. ($x sub r ~+~ i , y sub r ~+~ j$),
  178. where ($x sub r , y sub r$) is the current raster position.
  179. Only the pixel ownership test,
  180. the scissor test,
  181. and the stencil writemask affect these write operations.
  182. .P
  183. The rasterization described thus far assumes pixel zoom factors of 1.0.
  184. If
  185. .br
  186. \%\f3glPixelZoom\fP is used to change the $x$ and $y$ pixel zoom factors,
  187. pixels are converted to fragments as follows.
  188. If ($x sub r$, $y sub r$) is the current raster position,
  189. and a given pixel is in the $i$th location in the $j$th row of the source
  190. pixel rectangle,
  191. then fragments are generated for pixels whose centers are in the rectangle
  192. with corners at
  193. .P
  194. .ce
  195. ($x sub r ~+~ zoom sub x^ i$, $y sub r ~+~ zoom sub y^j$)
  196. .sp .5
  197. .ce
  198. and
  199. .sp .5
  200. .ce
  201. ($x sub r ~+~ zoom sub x^ (i ~+~ 1)$, $y sub r ~+~ zoom sub y^ ( j ~+~ 1 )$)
  202. .P
  203. where $zoom sub x$ is the value of \%\f3GL_ZOOM_X\fP and
  204. $zoom sub y$ is the value of \%\f3GL_ZOOM_Y\fP.
  205. .SH EXAMPLES
  206. To copy the color pixel in the lower left corner of the window to the current raster position,
  207. use
  208. .Ex
  209. glCopyPixels(0, 0, 1, 1, \%\f3GL_COLOR\fP);
  210. .En
  211. .SH NOTES
  212. Modes specified by \%\f3glPixelStore\fP have no effect on the operation
  213. of \%\f3glCopyPixels\fP.
  214. .SH ERRORS
  215. \%\f3GL_INVALID_ENUM\fP is generated if \f2type\fP is not an accepted value.
  216. .P
  217. \%\f3GL_INVALID_VALUE\fP is generated if either \f2width\fP or \f2height\fP is negative.
  218. .P
  219. \%\f3GL_INVALID_OPERATION\fP is generated if \f2type\fP is \%\f3GL_DEPTH\fP
  220. and there is no depth buffer.
  221. .P
  222. \%\f3GL_INVALID_OPERATION\fP is generated if \f2type\fP is \%\f3GL_STENCIL\fP
  223. and there is no stencil buffer.
  224. .P
  225. \%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glCopyPixels\fP
  226. is executed between the execution of \%\f3glBegin\fP
  227. and the corresponding execution of \%\f3glEnd\fP.
  228. .SH ASSOCIATED GETS
  229. \%\f3glGet\fP with argument \%\f3GL_CURRENT_RASTER_POSITION\fP
  230. .br
  231. \%\f3glGet\fP with argument \%\f3GL_CURRENT_RASTER_POSITION_VALID\fP
  232. .SH SEE ALSO
  233. \%\f3glColorTable(3G)\fP,
  234. \%\f3glConvolutionFilter1D(3G)\fP,
  235. \%\f3glConvolutionFilter2D(3G)\fP,
  236. \%\f3glDepthFunc(3G)\fP,
  237. \%\f3glDrawBuffer(3G)\fP,
  238. \%\f3glDrawPixels(3G)\fP,
  239. \%\f3glMatrixMode(3G)\fP,
  240. \%\f3glPixelMap(3G)\fP,
  241. \%\f3glPixelTransfer(3G)\fP,
  242. \%\f3glPixelZoom(3G)\fP,
  243. \%\f3glRasterPos(3G)\fP,
  244. \%\f3glReadBuffer(3G)\fP,
  245. \%\f3glReadPixels(3G)\fP,
  246. \%\f3glSeparableFilter2D(3G)\fP,
  247. \%\f3glStencilFunc(3G)\fP