Merge branch 'mesa_7_5_branch'
[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_ycbcr_format(GLenum format);
68
69 extern GLboolean
70 _mesa_is_depthstencil_format(GLenum format);
71
72 extern GLboolean
73 _mesa_is_dudv_format(GLenum format);
74
75
76 extern GLvoid *
77 _mesa_image_address( GLuint dimensions,
78 const struct gl_pixelstore_attrib *packing,
79 const GLvoid *image,
80 GLsizei width, GLsizei height,
81 GLenum format, GLenum type,
82 GLint img, GLint row, GLint column );
83
84 extern GLvoid *
85 _mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
86 const GLvoid *image,
87 GLsizei width,
88 GLenum format, GLenum type,
89 GLint column );
90
91 extern GLvoid *
92 _mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
93 const GLvoid *image,
94 GLsizei width, GLsizei height,
95 GLenum format, GLenum type,
96 GLint row, GLint column );
97
98 extern GLvoid *
99 _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
100 const GLvoid *image,
101 GLsizei width, GLsizei height,
102 GLenum format, GLenum type,
103 GLint img, GLint row, GLint column );
104
105
106 extern GLint
107 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
108 GLint width, GLenum format, GLenum type );
109
110
111 extern GLint
112 _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
113 GLint width, GLint height,
114 GLenum format, GLenum type );
115
116 extern void
117 _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
118 const struct gl_pixelstore_attrib *unpacking );
119
120
121 extern void
122 _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
123 const struct gl_pixelstore_attrib *packing );
124
125
126 extern GLvoid *
127 _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
128 const struct gl_pixelstore_attrib *packing );
129
130 extern void
131 _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
132 GLubyte *dest, const struct gl_pixelstore_attrib *packing );
133
134
135 /** \name Pixel processing functions */
136 /*@{*/
137
138 extern void
139 _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
140 GLfloat rScale, GLfloat gScale,
141 GLfloat bScale, GLfloat aScale,
142 GLfloat rBias, GLfloat gBias,
143 GLfloat bBias, GLfloat aBias);
144
145 extern void
146 _mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
147
148
149 extern void
150 _mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
151
152
153 extern void
154 _mesa_lookup_rgba_float(const struct gl_color_table *table,
155 GLuint n, GLfloat rgba[][4]);
156
157 extern void
158 _mesa_lookup_rgba_ubyte(const struct gl_color_table *table,
159 GLuint n, GLubyte rgba[][4]);
160
161
162 extern void
163 _mesa_map_ci_to_rgba(const GLcontext *ctx,
164 GLuint n, const GLuint index[], GLfloat rgba[][4]);
165
166
167 extern void
168 _mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
169 GLubyte rgba[][4]);
170
171
172 extern void
173 _mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
174 GLfloat depthValues[]);
175
176 extern void
177 _mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n,
178 GLuint depthValues[]);
179
180 extern void
181 _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
182 GLuint n, GLfloat rgba[][4]);
183
184
185 extern void
186 _mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps,
187 GLuint n, GLuint indexes[]);
188
189
190 extern void
191 _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,
192 GLstencil stencil[]);
193
194
195 extern void
196 _mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, GLfloat rgba[][4],
197 GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
198 const struct gl_pixelstore_attrib *dstPacking,
199 GLbitfield transferOps );
200
201
202 extern void
203 _mesa_unpack_color_span_chan( GLcontext *ctx,
204 GLuint n, GLenum dstFormat, GLchan dest[],
205 GLenum srcFormat, GLenum srcType,
206 const GLvoid *source,
207 const struct gl_pixelstore_attrib *srcPacking,
208 GLbitfield transferOps );
209
210
211 extern void
212 _mesa_unpack_color_span_float( GLcontext *ctx,
213 GLuint n, GLenum dstFormat, GLfloat dest[],
214 GLenum srcFormat, GLenum srcType,
215 const GLvoid *source,
216 const struct gl_pixelstore_attrib *srcPacking,
217 GLbitfield transferOps );
218
219 extern void
220 _mesa_unpack_dudv_span_byte( GLcontext *ctx,
221 GLuint n, GLenum dstFormat, GLbyte dest[],
222 GLenum srcFormat, GLenum srcType,
223 const GLvoid *source,
224 const struct gl_pixelstore_attrib *srcPacking,
225 GLbitfield transferOps );
226
227 extern void
228 _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
229 GLenum dstType, GLvoid *dest,
230 GLenum srcType, const GLvoid *source,
231 const struct gl_pixelstore_attrib *srcPacking,
232 GLbitfield transferOps );
233
234
235 extern void
236 _mesa_pack_index_span( const GLcontext *ctx, GLuint n,
237 GLenum dstType, GLvoid *dest, const GLuint *source,
238 const struct gl_pixelstore_attrib *dstPacking,
239 GLbitfield transferOps );
240
241
242 extern void
243 _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
244 GLenum dstType, GLvoid *dest,
245 GLenum srcType, const GLvoid *source,
246 const struct gl_pixelstore_attrib *srcPacking,
247 GLbitfield transferOps );
248
249 extern void
250 _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
251 GLenum dstType, GLvoid *dest, const GLstencil *source,
252 const struct gl_pixelstore_attrib *dstPacking );
253
254
255 extern void
256 _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
257 GLenum dstType, GLvoid *dest, GLuint depthMax,
258 GLenum srcType, const GLvoid *source,
259 const struct gl_pixelstore_attrib *srcPacking );
260
261 extern void
262 _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
263 GLenum dstType, const GLfloat *depthSpan,
264 const struct gl_pixelstore_attrib *dstPacking );
265
266
267 extern void
268 _mesa_pack_depth_stencil_span(const GLcontext *ctx, GLuint n, GLuint *dest,
269 const GLfloat *depthVals,
270 const GLstencil *stencilVals,
271 const struct gl_pixelstore_attrib *dstPacking);
272
273
274 extern void *
275 _mesa_unpack_image( GLuint dimensions,
276 GLsizei width, GLsizei height, GLsizei depth,
277 GLenum format, GLenum type, const GLvoid *pixels,
278 const struct gl_pixelstore_attrib *unpack );
279
280
281 extern void
282 _mesa_convert_colors(GLenum srcType, const GLvoid *src,
283 GLenum dstType, GLvoid *dst,
284 GLuint count, const GLubyte mask[]);
285
286
287 extern GLboolean
288 _mesa_clip_drawpixels(const GLcontext *ctx,
289 GLint *destX, GLint *destY,
290 GLsizei *width, GLsizei *height,
291 struct gl_pixelstore_attrib *unpack);
292
293
294 extern GLboolean
295 _mesa_clip_readpixels(const GLcontext *ctx,
296 GLint *destX, GLint *destY,
297 GLsizei *width, GLsizei *height,
298 struct gl_pixelstore_attrib *pack);
299
300 extern GLboolean
301 _mesa_clip_copytexsubimage(const GLcontext *ctx,
302 GLint *destX, GLint *destY,
303 GLint *srcX, GLint *srcY,
304 GLsizei *width, GLsizei *height);
305
306 extern GLboolean
307 _mesa_clip_to_region(GLint xmin, GLint ymin,
308 GLint xmax, GLint ymax,
309 GLint *x, GLint *y,
310 GLsizei *width, GLsizei *height );
311
312 extern GLboolean
313 _mesa_clip_blit(GLcontext *ctx,
314 GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
315 GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
316
317
318 #endif