Use ALIGN_MALLOC for parameter lists.
[mesa.git] / src / mesa / main / image.h
1 /**
2 * \file image.h
3 * Image handling.
4 */
5
6 /*
7 * Mesa 3-D graphics library
8 * Version: 6.3
9 *
10 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30
31 #ifndef IMAGE_H
32 #define IMAGE_H
33
34
35 #include "mtypes.h"
36
37
38 extern void
39 _mesa_swap2( GLushort *p, GLuint n );
40
41 extern void
42 _mesa_swap4( GLuint *p, GLuint n );
43
44 extern GLint
45 _mesa_sizeof_type( GLenum type );
46
47 extern GLint
48 _mesa_sizeof_packed_type( GLenum type );
49
50 extern GLint
51 _mesa_components_in_format( GLenum format );
52
53 extern GLint
54 _mesa_bytes_per_pixel( GLenum format, GLenum type );
55
56 extern GLboolean
57 _mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type );
58
59
60 extern GLvoid *
61 _mesa_image_address( GLuint dimensions,
62 const struct gl_pixelstore_attrib *packing,
63 const GLvoid *image,
64 GLsizei width, GLsizei height,
65 GLenum format, GLenum type,
66 GLint img, GLint row, GLint column );
67
68 extern GLvoid *
69 _mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
70 const GLvoid *image,
71 GLsizei width,
72 GLenum format, GLenum type,
73 GLint column );
74
75 extern GLvoid *
76 _mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
77 const GLvoid *image,
78 GLsizei width, GLsizei height,
79 GLenum format, GLenum type,
80 GLint row, GLint column );
81
82 extern GLvoid *
83 _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
84 const GLvoid *image,
85 GLsizei width, GLsizei height,
86 GLenum format, GLenum type,
87 GLint img, GLint row, GLint column );
88
89
90 extern GLint
91 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
92 GLint width, GLenum format, GLenum type );
93
94
95 extern GLint
96 _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
97 GLint width, GLint height,
98 GLenum format, GLenum type );
99
100 extern void
101 _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
102 const struct gl_pixelstore_attrib *unpacking );
103
104
105 extern void
106 _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
107 const struct gl_pixelstore_attrib *packing );
108
109
110 extern GLvoid *
111 _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
112 const struct gl_pixelstore_attrib *packing );
113
114 extern void
115 _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
116 GLubyte *dest, const struct gl_pixelstore_attrib *packing );
117
118
119 extern void
120 _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLuint transferOps,
121 GLuint n, GLfloat rgba[][4]);
122
123 extern void
124 _mesa_pack_rgba_span_float( GLcontext *ctx,
125 GLuint n, CONST GLfloat rgba[][4],
126 GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
127 const struct gl_pixelstore_attrib *dstPacking,
128 GLuint transferOps );
129
130
131 extern void
132 _mesa_pack_rgba_span_chan( GLcontext *ctx,
133 GLuint n, CONST GLchan rgba[][4],
134 GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
135 const struct gl_pixelstore_attrib *dstPacking,
136 GLuint transferOps );
137
138
139 extern void
140 _mesa_unpack_color_span_chan( GLcontext *ctx,
141 GLuint n, GLenum dstFormat, GLchan dest[],
142 GLenum srcFormat, GLenum srcType,
143 const GLvoid *source,
144 const struct gl_pixelstore_attrib *srcPacking,
145 GLuint transferOps );
146
147
148 extern void
149 _mesa_unpack_color_span_float( GLcontext *ctx,
150 GLuint n, GLenum dstFormat, GLfloat dest[],
151 GLenum srcFormat, GLenum srcType,
152 const GLvoid *source,
153 const struct gl_pixelstore_attrib *srcPacking,
154 GLuint transferOps );
155
156
157 extern void
158 _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
159 GLenum dstType, GLvoid *dest,
160 GLenum srcType, const GLvoid *source,
161 const struct gl_pixelstore_attrib *srcPacking,
162 GLuint transferOps );
163
164
165 extern void
166 _mesa_pack_index_span( const GLcontext *ctx, GLuint n,
167 GLenum dstType, GLvoid *dest, const GLuint *source,
168 const struct gl_pixelstore_attrib *dstPacking,
169 GLuint transferOps );
170
171
172 extern void
173 _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
174 GLenum dstType, GLvoid *dest,
175 GLenum srcType, const GLvoid *source,
176 const struct gl_pixelstore_attrib *srcPacking,
177 GLuint transferOps );
178
179 extern void
180 _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
181 GLenum dstType, GLvoid *dest, const GLstencil *source,
182 const struct gl_pixelstore_attrib *dstPacking );
183
184
185 extern void
186 _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest,
187 GLenum srcType, const GLvoid *source,
188 const struct gl_pixelstore_attrib *srcPacking );
189
190 extern void
191 _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
192 GLenum dstType, const GLfloat *depthSpan,
193 const struct gl_pixelstore_attrib *dstPacking );
194
195
196 extern void *
197 _mesa_unpack_image( GLuint dimensions,
198 GLsizei width, GLsizei height, GLsizei depth,
199 GLenum format, GLenum type, const GLvoid *pixels,
200 const struct gl_pixelstore_attrib *unpack );
201
202
203 extern GLboolean
204 _mesa_clip_drawpixels(const GLcontext *ctx,
205 GLint *destX, GLint *destY,
206 GLsizei *width, GLsizei *height,
207 GLint *skipPixels, GLint *skipRows);
208
209
210 extern GLboolean
211 _mesa_clip_readpixels(const GLcontext *ctx,
212 GLint *destX, GLint *destY,
213 GLsizei *width, GLsizei *height,
214 GLint *skipPixels, GLint *skipRows);
215
216
217 #endif