Merge remote branch 'origin/master' into glsl2
[mesa.git] / src / mesa / main / image.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.1
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #ifndef IMAGE_H
27 #define IMAGE_H
28
29
30 #include "mtypes.h"
31
32
33 extern void
34 _mesa_swap2( GLushort *p, GLuint n );
35
36 extern void
37 _mesa_swap4( GLuint *p, GLuint n );
38
39 extern GLboolean
40 _mesa_type_is_packed(GLenum type);
41
42 extern GLint
43 _mesa_sizeof_type( GLenum type );
44
45 extern GLint
46 _mesa_sizeof_packed_type( GLenum type );
47
48 extern GLint
49 _mesa_components_in_format( GLenum format );
50
51 extern GLint
52 _mesa_bytes_per_pixel( GLenum format, GLenum type );
53
54 extern GLboolean
55 _mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type );
56
57 extern GLboolean
58 _mesa_is_color_format(GLenum format);
59
60 extern GLboolean
61 _mesa_is_index_format(GLenum format);
62
63 extern GLboolean
64 _mesa_is_depth_format(GLenum format);
65
66 extern GLboolean
67 _mesa_is_stencil_format(GLenum format);
68
69 extern GLboolean
70 _mesa_is_ycbcr_format(GLenum format);
71
72 extern GLboolean
73 _mesa_is_depthstencil_format(GLenum format);
74
75 extern GLboolean
76 _mesa_is_depth_or_stencil_format(GLenum format);
77
78 extern GLboolean
79 _mesa_is_dudv_format(GLenum format);
80
81 extern GLboolean
82 _mesa_is_integer_format(GLenum format);
83
84 extern GLboolean
85 _mesa_is_compressed_format(GLcontext *ctx, GLenum format);
86
87 extern GLvoid *
88 _mesa_image_address( GLuint dimensions,
89 const struct gl_pixelstore_attrib *packing,
90 const GLvoid *image,
91 GLsizei width, GLsizei height,
92 GLenum format, GLenum type,
93 GLint img, GLint row, GLint column );
94
95 extern GLvoid *
96 _mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
97 const GLvoid *image,
98 GLsizei width,
99 GLenum format, GLenum type,
100 GLint column );
101
102 extern GLvoid *
103 _mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
104 const GLvoid *image,
105 GLsizei width, GLsizei height,
106 GLenum format, GLenum type,
107 GLint row, GLint column );
108
109 extern GLvoid *
110 _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
111 const GLvoid *image,
112 GLsizei width, GLsizei height,
113 GLenum format, GLenum type,
114 GLint img, GLint row, GLint column );
115
116
117 extern GLint
118 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
119 GLint width, GLenum format, GLenum type );
120
121
122 extern GLint
123 _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
124 GLint width, GLint height,
125 GLenum format, GLenum type );
126
127 extern void
128 _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
129 const struct gl_pixelstore_attrib *unpacking );
130
131
132 extern void
133 _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
134 const struct gl_pixelstore_attrib *packing );
135
136
137 extern GLvoid *
138 _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
139 const struct gl_pixelstore_attrib *packing );
140
141 extern void
142 _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
143 GLubyte *dest, const struct gl_pixelstore_attrib *packing );
144
145 extern void
146 _mesa_expand_bitmap(GLsizei width, GLsizei height,
147 const struct gl_pixelstore_attrib *unpack,
148 const GLubyte *bitmap,
149 GLubyte *destBuffer, GLint destStride,
150 GLubyte onValue);
151
152
153 /** \name Pixel processing functions */
154 /*@{*/
155
156 extern void
157 _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
158 GLfloat rScale, GLfloat gScale,
159 GLfloat bScale, GLfloat aScale,
160 GLfloat rBias, GLfloat gBias,
161 GLfloat bBias, GLfloat aBias);
162
163 extern void
164 _mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
165
166
167 extern void
168 _mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
169
170
171 extern void
172 _mesa_lookup_rgba_float(const struct gl_color_table *table,
173 GLuint n, GLfloat rgba[][4]);
174
175 extern void
176 _mesa_lookup_rgba_ubyte(const struct gl_color_table *table,
177 GLuint n, GLubyte rgba[][4]);
178
179
180 extern void
181 _mesa_map_ci_to_rgba(const GLcontext *ctx,
182 GLuint n, const GLuint index[], GLfloat rgba[][4]);
183
184
185 extern void
186 _mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
187 GLubyte rgba[][4]);
188
189
190 extern void
191 _mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
192 GLfloat depthValues[]);
193
194 extern void
195 _mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n,
196 GLuint depthValues[]);
197
198 extern void
199 _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
200 GLuint n, GLfloat rgba[][4]);
201
202
203 extern void
204 _mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps,
205 GLuint n, GLuint indexes[]);
206
207
208 extern void
209 _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,
210 GLstencil stencil[]);
211
212
213 extern void
214 _mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, GLfloat rgba[][4],
215 GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
216 const struct gl_pixelstore_attrib *dstPacking,
217 GLbitfield transferOps );
218
219
220 extern void
221 _mesa_unpack_color_span_chan( GLcontext *ctx,
222 GLuint n, GLenum dstFormat, GLchan dest[],
223 GLenum srcFormat, GLenum srcType,
224 const GLvoid *source,
225 const struct gl_pixelstore_attrib *srcPacking,
226 GLbitfield transferOps );
227
228
229 extern void
230 _mesa_unpack_color_span_float( GLcontext *ctx,
231 GLuint n, GLenum dstFormat, GLfloat dest[],
232 GLenum srcFormat, GLenum srcType,
233 const GLvoid *source,
234 const struct gl_pixelstore_attrib *srcPacking,
235 GLbitfield transferOps );
236
237 extern void
238 _mesa_unpack_dudv_span_byte( GLcontext *ctx,
239 GLuint n, GLenum dstFormat, GLbyte dest[],
240 GLenum srcFormat, GLenum srcType,
241 const GLvoid *source,
242 const struct gl_pixelstore_attrib *srcPacking,
243 GLbitfield transferOps );
244
245 extern void
246 _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
247 GLenum dstType, GLvoid *dest,
248 GLenum srcType, const GLvoid *source,
249 const struct gl_pixelstore_attrib *srcPacking,
250 GLbitfield transferOps );
251
252
253 extern void
254 _mesa_pack_index_span( const GLcontext *ctx, GLuint n,
255 GLenum dstType, GLvoid *dest, const GLuint *source,
256 const struct gl_pixelstore_attrib *dstPacking,
257 GLbitfield transferOps );
258
259
260 extern void
261 _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
262 GLenum dstType, GLvoid *dest,
263 GLenum srcType, const GLvoid *source,
264 const struct gl_pixelstore_attrib *srcPacking,
265 GLbitfield transferOps );
266
267 extern void
268 _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
269 GLenum dstType, GLvoid *dest, const GLstencil *source,
270 const struct gl_pixelstore_attrib *dstPacking );
271
272
273 extern void
274 _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
275 GLenum dstType, GLvoid *dest, GLuint depthMax,
276 GLenum srcType, const GLvoid *source,
277 const struct gl_pixelstore_attrib *srcPacking );
278
279 extern void
280 _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
281 GLenum dstType, const GLfloat *depthSpan,
282 const struct gl_pixelstore_attrib *dstPacking );
283
284
285 extern void
286 _mesa_pack_depth_stencil_span(const GLcontext *ctx, GLuint n, GLuint *dest,
287 const GLfloat *depthVals,
288 const GLstencil *stencilVals,
289 const struct gl_pixelstore_attrib *dstPacking);
290
291
292 extern void *
293 _mesa_unpack_image( GLuint dimensions,
294 GLsizei width, GLsizei height, GLsizei depth,
295 GLenum format, GLenum type, const GLvoid *pixels,
296 const struct gl_pixelstore_attrib *unpack );
297
298
299 extern void
300 _mesa_convert_colors(GLenum srcType, const GLvoid *src,
301 GLenum dstType, GLvoid *dst,
302 GLuint count, const GLubyte mask[]);
303
304
305 extern GLboolean
306 _mesa_clip_drawpixels(const GLcontext *ctx,
307 GLint *destX, GLint *destY,
308 GLsizei *width, GLsizei *height,
309 struct gl_pixelstore_attrib *unpack);
310
311
312 extern GLboolean
313 _mesa_clip_readpixels(const GLcontext *ctx,
314 GLint *srcX, GLint *srcY,
315 GLsizei *width, GLsizei *height,
316 struct gl_pixelstore_attrib *pack);
317
318 extern GLboolean
319 _mesa_clip_copytexsubimage(const GLcontext *ctx,
320 GLint *destX, GLint *destY,
321 GLint *srcX, GLint *srcY,
322 GLsizei *width, GLsizei *height);
323
324 extern GLboolean
325 _mesa_clip_to_region(GLint xmin, GLint ymin,
326 GLint xmax, GLint ymax,
327 GLint *x, GLint *y,
328 GLsizei *width, GLsizei *height );
329
330 extern GLboolean
331 _mesa_clip_blit(GLcontext *ctx,
332 GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
333 GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
334
335
336 #endif