Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

379 lines
18 KiB

  1. Name
  2. HP_image_transform
  3. Name Strings
  4. GL_HP_image_transform
  5. Version
  6. $Date: 1995/09/09 21:55:00 $ $Revision: 1.11 $
  7. Number
  8. 66
  9. Dependencies
  10. EXT_texture is required
  11. EXT_convolution affects the definition of this extension
  12. SGI_color_table is required
  13. Overview
  14. This extension provides support for scaling, rotation, and translation
  15. of two-dimensional pixel rectangles at a fixed location in the pixel
  16. transfer process. The 2D image transformation attributes are specified
  17. as individual values so that that implementations may easily detect
  18. scaling and rotation values that lend themselves to optimization. 2D
  19. image transformation occurs immediately after the post-convolution color
  20. table stage of the pixel pipeline. This extension also defines a color
  21. table that is applied immediately after the image transformation operation.
  22. New Procedures and Functions
  23. void ImageTransformParameteriHP(enum target,
  24. enum pname,
  25. const int param)
  26. void ImageTransformParameterfHP(enum target,
  27. enum pname,
  28. const float param)
  29. void ImageTransformParameterivHP(enum target,
  30. enum pname,
  31. const int* params)
  32. void ImageTransformParameterfvHP(enum target,
  33. enum pname,
  34. const float* params)
  35. These routines are used to set image transformation attributes.
  36. The only allowable value for <target> at this time is
  37. IMAGE_TRANSFORM_2D_HP. Allowable values for <pname> include:
  38. IMAGE_SCALE_X_HP, IMAGE_SCALE_Y_HP, IMAGE_ROTATE_ANGLE_HP,
  39. IMAGE_ROTATE_ORIGIN_X_HP, IMAGE_ROTATE_ORIGIN_Y_HP,
  40. IMAGE_TRANSLATE_X_HP, IMAGE_TRANSLATE_Y_HP, IMAGE_MAG_FILTER_HP,
  41. IMAGE_MIN_FILTER_HP, and IMAGE_CUBIC_WEIGHT_HP.
  42. void GetImageTransformParameterivHP(enum target,
  43. enum pname,
  44. const int* params)
  45. void GetImageTransformParameterfvHP(enum target,
  46. enum pname,
  47. const float* params)
  48. These routines are used to query image transformation attributes.
  49. The only allowable value for <target> at this time is
  50. IMAGE_TRANSFORM_2D_HP. Allowable values for <pname> include:
  51. IMAGE_SCALE_X_HP, IMAGE_SCALE_Y_HP, IMAGE_ROTATE_ANGLE_HP,
  52. IMAGE_ROTATE_ORIGIN_X_HP, IMAGE_ROTATE_ORIGIN_Y_HP,
  53. IMAGE_TRANSLATE_X_HP, IMAGE_TRANSLATE_Y_HP, IMAGE_MAG_FILTER_HP,
  54. IMAGE_MIN_FILTER_HP, and IMAGE_CUBIC_WEIGHT_HP.
  55. New Tokens
  56. Accepted by the <pname> parameter of ImageTransformParameteri,
  57. ImageTransformParameterf, ImageTransformParameteriv,
  58. ImageTransformParameterfv, GetImageTransformParameteriv and
  59. GetImageTransformParameterfv:
  60. IMAGE_SCALE_X_HP
  61. IMAGE_SCALE_Y_HP
  62. IMAGE_TRANSLATE_X_HP
  63. IMAGE_TRANSLATE_Y_HP
  64. IMAGE_ROTATE_ANGLE_HP
  65. IMAGE_ROTATE_ORIGIN_X_HP
  66. IMAGE_ROTATE_ORIGIN_Y_HP
  67. IMAGE_MAG_FILTER_HP
  68. IMAGE_MIN_FILTER_HP
  69. IMAGE_CUBIC_WEIGHT_HP
  70. Accepted by the <params> parameter of ImageTransformParameteriHP,
  71. ImageTransformParameterfHP, ImageTransformParameterivHP, and
  72. ImageTransformParameterfvHP when <pname> is IMAGE_MAG_FILTER_HP
  73. or IMAGE_MIN_FILTER_HP:
  74. CUBIC_HP
  75. Accepted by the <params> parameter of ImageTransformParameteriHP,
  76. ImageTransformParameterfHP, ImageTransformParameterivHP, and
  77. ImageTransformParameterfvHP when <pname> is IMAGE_MIN_FILTER_HP:
  78. AVERAGE_HP
  79. Accepted by the <cap> parameter of Enable, Disable, and IsEnabled,
  80. and by the <target> parameter of ImageTransformParameterivHP,
  81. ImageTransformParameterfvHP, GetImageTransformParameterivHP,
  82. and GetImageTransformParameterfvHP:
  83. IMAGE_TRANSFORM_2D_HP
  84. Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and
  85. by the <target> parameter of ColorTableSGI, ColorTableParameterivSGI,
  86. ColorTableParameterfvSGI, GetColorTableSGI, GetColorTableParameterivSGI,
  87. and GetColorTableParameterfvSGI:
  88. POST_IMAGE_TRANSFORM_COLOR_TABLE_HP
  89. Accepted by the <target> parameter of ColorTableSGI,
  90. GetColorTableParameterivSGI, and GetColorTableParameterfvSGI:
  91. PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP
  92. Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation)
  93. None
  94. Additions to Chapter 3 of the 1.0 Specification (Rasterization)
  95. The specification of two-dimensional image transformation operators
  96. is added to the GL specification in Section 3.6.2, "Pixel Transfer
  97. Modes." 2D image transformation operators are defined by calling
  98. ImageTransformParameteriHP, ImageTransformParameterfHP,
  99. ImageTransformParameterivHP, or ImageTransformParameterfvHP with
  100. <target> set to IMAGE_TRANSFORM_2D_HP. Parameter values
  101. IMAGE_SCALE_X_HP and IMAGE_SCALE_Y_HP establish the scaling factors.
  102. IMAGE_TRANSLATE_X_HP and IMAGE_TRANSLATE_Y_HP set the translation
  103. factors. IMAGE_ROTATE_ANGLE_HP sets the rotation angle to be
  104. used, and IMAGE_ROTATE_ORIGIN_X_HP and IMAGE_ROTATE_ORIGIN_Y_HP specify
  105. the point about which the image is to be scaled and rotated. If the
  106. specified angle is positive, the rotation will be counterclockwise
  107. about the specified rotation origin. If the specified angle is
  108. negative, the rotation will be clockwise about the origin. All
  109. of these parameters (scale, rotation, translation, rotation origin)
  110. are specified in terms of the input image's coordinates.
  111. IMAGE_MAG_FILTER_HP establishes the resampling technique that is to be
  112. used after the other image transformation operators have been applied
  113. if the image is deemed to have been magnified. IMAGE_MIN_FILTER_HP
  114. defines the resampling technique that is to be applied if the image
  115. is minified by the scaling factors. IMAGE_CUBIC_WEIGHT_HP defines
  116. the cubic weighting coefficient that is to be used whenever the
  117. resampling technique is set to CUBIC_HP.
  118. The operations defined by the image transformation operation are
  119. added to the GL specification in Section 3.6.3, "Rasterization of
  120. Pixel Rectangles," immediately following the operations described in
  121. the EXT_convolution extension and the post convolution color table
  122. operation that is described in the SGI_color_table extension. Image
  123. transformation is defined only for pixel rectangles that contain RGBA
  124. components or depth components at this stage of the pixel processing
  125. pipeline (color index values may have been converted to RGBA by a
  126. previous stage). Image transformation is not applied to color index
  127. or stencil index pixel data.
  128. When enabled, the image transformation operation uses the current set
  129. of image transformation parameters to compute a new window coordinate
  130. for each incoming pixel. Although image transformation parameters
  131. are specified separately, the scaling, rotation, and translation
  132. operations are all applied simultaneously (as if the transformation
  133. was encoded in a matrix and the resulting matrix was applied to each
  134. incoming pixel coordinate). In the case of 2D image transformation,
  135. if (Rx,Ry) specifies the rotation origin, the effect of applying the
  136. 2D image transformation operators can be defined as follows. First,
  137. the image is translated by -Rx in the x direction and -Ry in the y
  138. direction so that its rotation origin is at the origin of the 2D
  139. coordinate system. Second, the x and y scaling factors are
  140. applied, causing the image to be scaled as specified in x and y.
  141. Third, the rotation angle is applied, causing the image to be rotated
  142. about the origin by the specified angle. Next, the image is translated
  143. by Rx in the x direction and Ry in the y direction. Finally, the
  144. scaled and rotated image is translated by the specified translation
  145. factors. Resampling occurs after the scaling/rotation/translation
  146. operations have been applied.
  147. The RGBA or depth value for each location is left unmodified by the image
  148. transformation. Since multiple input pixels can be mapped into a single
  149. output pixel (minification of input image), or since output pixels might
  150. not have any input pixels mapped to them (magnification of input image),
  151. some method of resampling is required. The resampling method to be
  152. used when the image is magnified is specified by calling
  153. ImageTransformParameteri, ImageTransformParameterf,
  154. ImageTransformParameteriv, or ImageTransformParameterfv with <pname>
  155. set to IMAGE_MAG_FILTER_HP and <params> set to NEAREST, LINEAR, or CUBIC_HP.
  156. The resampling method to be used when the image is minified is specified
  157. by calling ImageTransformParameteri, ImageTransformParameterf,
  158. ImageTransformParameteriv, or ImageTransformParameterfv with <pname>
  159. set to IMAGE_MIN_FILTER_HP and <params> set to NEAREST, LINEAR, CUBIC_HP,
  160. or AVERAGE_HP. If the resampling method is NEAREST, each output pixel will
  161. have the value of the input pixel whose transformed coordinate value is
  162. nearest (in Manhattan distance). If the resampling method is LINEAR, each
  163. output pixel will have a value that is the weighted average of the four input
  164. pixels whose transformed coordinate values are nearest.
  165. If the resampling method is CUBIC_HP, each output pixel will have a value
  166. that is affected by the 16 input pixels whose transformed coordinate
  167. values are nearest. The 16 input pixels will be used to perform a cubic
  168. spline interpolation to determine the value of the output pixel. The
  169. cubic weight factor is a floating point value that is applied to the
  170. cubic interpolation in the manner described in "Digital Image Warping"
  171. by George Wolberg (IEEE Computer Society Press, ISBN 0-8186-8944-7).
  172. Visually pleasing cubic weighting values are typically in the
  173. range [-1,0]. The values -1.0 and -0.5 are most commonly used.
  174. For the purpose of performing bicubic interpolation along the outer
  175. edge of the image, the outermost one pixel edge of the image is
  176. duplicated prior to performing the interpolation along the edges.
  177. If the resampling method is AVERAGE_HP, the values of all of the input
  178. pixels that contribute to the final output pixel will be averaged to
  179. determine the final output pixel value.
  180. The operation of the POST_IMAGE_TRANSFORM_COLOR_TABLE is added to the GL
  181. Specification in section 3.6.3, "Rasterization of Pixel Rectangles".
  182. This color table behaves in the manner described in the SGI_color_table
  183. extension, and it is located immediately after the image transformation
  184. operation. This color table can be enabled or disabled separately from
  185. the image transformation operation by calling Enable or Disable with
  186. POST_IMAGE_TRANSFORM_COLOR_TABLE. It can be modified using the procedures
  187. defined in the SGI_color_table extension. The proxy version of this table
  188. can be set or queried by using a target value of
  189. PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE.
  190. Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations
  191. and the Frame Buffer)
  192. The operation of image transformation during pixel copy and query
  193. operations is identical to the operation during pixel drawing and
  194. texture image definition. The image transformation operation occurs
  195. immediately after the operations described by EXT_convolution and
  196. the post-convolution color table described by SGI_color_table, which
  197. follow section 4.3.2 (Reading Pixels) of the GL Specification.
  198. Additions to Chapter 5 of the 1.0 Specification (Special Functions)
  199. GetImageTransformParameterivHP, and GetImageTransformParameterfvHP
  200. are not included in display lists, but are instead executed immediately.
  201. Additions to Chapter 6 of the 1.0 Specification (State and State Requests)
  202. Integer and floating point query functions GetImageTransformParameterivHP
  203. and GetImageTransformParameterfvHP are provided. <target> must be
  204. IMAGE_TRANSFORM_2D_HP. <pname> is one of IMAGE_SCALE_X_HP,
  205. IMAGE_SCALE_Y_HP, IMAGE_TRANSLATE_X_HP, IMAGE_TRANSLATE_Y_HP,
  206. IMAGE_ROTATE_ANGLE_HP, IMAGE_ROTATE_ORIGIN_X_HP,
  207. IMAGE_ROTATE_ORIGIN_Y_HP, IMAGE_MAG_FILTER_HP, IMAGE_MIN_FILTER_HP,
  208. or IMAGE_CUBIC_WEIGHT_HP. The value of the specified parameter is
  209. returned in <params>.
  210. Additions to the GLX Specification
  211. None
  212. Dependencies on EXT_texture
  213. EXT_texture is required. This extension builds on the notion of
  214. internal image format, which is defined by EXT_texture.
  215. Dependencies on EXT_convolution
  216. None, except that image transformation follows the convolution
  217. operation (and its scale and bias). If the post-convolution color
  218. table is supported, the image transformation operation will occur
  219. immediately after the post-convolution color table operation. If
  220. convolution is not supported, the location with respect to all other
  221. pixel operations remains the same.
  222. Dependencies on SGI_color_table
  223. SGI_color_table is required. This extension builds on the notion of
  224. color lookup tables at various locations in the pixel processing pipeline.
  225. This extension adds another table to the list specified by SGI_color_table.
  226. This new table can be manipulated using the procedures defined by
  227. SGI_color_table.
  228. Errors
  229. INVALID_ENUM is generated if ImageTransformParameteriHP,
  230. ImageTransformParameterfHP, ImageTransformParameterivHP,
  231. ImageTransformParameterfvHP, GetImageTransformParameterivHP,
  232. or GetImageTransformParameterfvHP is called with <target> set to
  233. a value other than IMAGE_TRANSFORM_2D_HP.
  234. INVALID_ENUM is generated if GetImageTransformParameterivHP or
  235. GetImageTransformParameterfvHP is called with <pname> set to
  236. IMAGE_MAG_FILTER_HP and <params> is not one of NEAREST, LINEAR,
  237. or CUBIC_HP.
  238. INVALID_ENUM is generated if GetImageTransformParameterivHP or
  239. GetImageTransformParameterfvHP is called with <pname> set to
  240. IMAGE_MIN_FILTER_HP and <params> is not one of NEAREST, LINEAR,
  241. CUBIC_HP, or AVERAGE_HP.
  242. INVALID_VALUE is generated if ImageTransformParameteriHP,
  243. ImageTransformParameterfHP, ImageTransformParameterivHP, or
  244. ImageTransformParameterfvHP is called with <pname> set to
  245. IMAGE_CUBIC_WEIGHT_HP and <params> is a value outside of
  246. the range [0,1].
  247. INVALID_OPERATION is generated if ImageTransformParameteriHP,
  248. ImageTransformParameterfHP, ImageTransformParameterivHP,
  249. ImageTransformParameterfvHP, GetImageTransformParameterivHP,
  250. or GetImageTransformParameterfvHP is called between execution of
  251. Begin and the corresponding execution of End.
  252. New State
  253. Initial
  254. Get Value Get Command Type Value Attrib
  255. --------- ----------- ---- ------- ------
  256. IMAGE_TRANSFORM_2D_HP IsEnabled B False pixel/enable
  257. IMAGE_SCALE_X_HP GetImageTransformParameterf R 1 pixel
  258. IMAGE_SCALE_Y_HP GetImageTransformParameterf R 1 pixel
  259. IMAGE_TRANSLATE_X_HP GetImageTransformParameterf R 0 pixel
  260. IMAGE_TRANSLATE_Y_HP GetImageTransformParameterf R 0 pixel
  261. IMAGE_ROTATE_ANGLE_HP GetImageTransformParameterf R 0 pixel
  262. IMAGE_ROTATE_ORIGIN_X_HP GetImageTransformParameterf R 0 pixel
  263. IMAGE_ROTATE_ORIGIN_Y_HP GetImageTransformParameterf R 0 pixel
  264. IMAGE_MAG_FILTER_HP GetImageTransformParameteri Z3 NEAREST pixel
  265. IMAGE_MIN_FILTER_HP GetImageTransformParameteri Z4 NEAREST pixel
  266. IMAGE_CUBIC_WEIGHT_HP GetImageTransformParameterf R -1 pixel
  267. POST_IMAGE_TRANSFORM_COLOR_TABLE_HP IsEnabled B False pixel/enable
  268. POST_IMAGE_TRANSFORM_COLOR_TABLE_HP GetColorTableHP 3 x I empty -
  269. New Implementation Dependent State
  270. None
  271. Issues
  272. What is the behavior of ReadPixels when the image transformation
  273. is enabled? One suggestion is to assume that the specified width
  274. and height of the region being read are used to define the size
  275. of the 2D array in host memory in which the pixel values are to
  276. be written. Any pixels that would be written outside of this region
  277. would be clipped. Why would anyone want to rotate/scale during
  278. a readback operation anyway? Another suggestion is that image
  279. transformation is ignored during readback, but this makes it
  280. different than the other pixel transfer operations.
  281. Notes
  282. I originally wrote this extension to utilize an image transformation
  283. matrix that worked the same way the other OpenGL matrices worked.
  284. However, we found that we could not easily extract the rotation and
  285. scaling information and use it to select optimized software routines
  286. for special cases like integer zoom and 90 degree rotations.
  287. Consequently, I've reverted back to specifying the image transformation
  288. parameters individually and the image transformation operation
  289. in a more rigid way.
  290. I would rather have separate state setting calls for each of the
  291. 2D image transformation parameters. However, SGI's convolution,
  292. color table, and histogram extension all use FooParameter{i,f}v calls
  293. to set the state. I've mimicked their API for three reasons:
  294. 1. For consistency with those extensions
  295. 2. To maximize the likelihood of industry acceptance
  296. of this extension
  297. 3. To allow for the possibility of 1D and 3D image
  298. transforms at a future time.
  299. I have not excluded the ability to scale, rotate, and translate
  300. depth component values. I thought that image transformation might
  301. be useful when the <format> was DEPTH_COMPONENT (i.e., reading or writing
  302. depth buffer values). In this case, the "image" will have x and y values
  303. that define the pixel locations, and depth (z) values instead of color
  304. values. The depth values will end up being treated as a single channel
  305. image. This capability might be necessary if you have a depth buffer
  306. associated with an image that you want to remain registered as it is
  307. stored in the frame buffer.