ffe629e103fd6c45dbb2888e0919835b9c2e408a
[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.1
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( GLenum format, GLenum type );
58
59
60 extern GLvoid *
61 _mesa_image_address( const struct gl_pixelstore_attrib *packing,
62 const GLvoid *image, GLsizei width,
63 GLsizei height, GLenum format, GLenum type,
64 GLint img, GLint row, GLint column );
65
66
67 extern GLint
68 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
69 GLint width, GLenum format, GLenum type );
70
71
72 extern GLint
73 _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
74 GLint width, GLint height,
75 GLenum format, GLenum type );
76
77 extern void
78 _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
79 const struct gl_pixelstore_attrib *unpacking );
80
81
82 extern void
83 _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest,
84 const struct gl_pixelstore_attrib *packing );
85
86
87 extern GLvoid *
88 _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
89 const struct gl_pixelstore_attrib *packing );
90
91 extern void
92 _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
93 GLubyte *dest, const struct gl_pixelstore_attrib *packing );
94
95
96 extern void
97 _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLuint transferOps,
98 GLuint n, GLfloat rgba[][4]);
99
100 extern void
101 _mesa_pack_rgba_span_float( GLcontext *ctx,
102 GLuint n, CONST GLfloat rgba[][4],
103 GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
104 const struct gl_pixelstore_attrib *dstPacking,
105 GLuint transferOps );
106
107
108 extern void
109 _mesa_pack_rgba_span_chan( GLcontext *ctx,
110 GLuint n, CONST GLchan rgba[][4],
111 GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
112 const struct gl_pixelstore_attrib *dstPacking,
113 GLuint transferOps );
114
115
116 extern void
117 _mesa_unpack_color_span_chan( GLcontext *ctx,
118 GLuint n, GLenum dstFormat, GLchan dest[],
119 GLenum srcFormat, GLenum srcType,
120 const GLvoid *source,
121 const struct gl_pixelstore_attrib *srcPacking,
122 GLuint transferOps );
123
124
125 extern void
126 _mesa_unpack_color_span_float( GLcontext *ctx,
127 GLuint n, GLenum dstFormat, GLfloat dest[],
128 GLenum srcFormat, GLenum srcType,
129 const GLvoid *source,
130 const struct gl_pixelstore_attrib *srcPacking,
131 GLuint transferOps );
132
133
134 extern void
135 _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
136 GLenum dstType, GLvoid *dest,
137 GLenum srcType, const GLvoid *source,
138 const struct gl_pixelstore_attrib *srcPacking,
139 GLuint transferOps );
140
141
142 extern void
143 _mesa_pack_index_span( const GLcontext *ctx, GLuint n,
144 GLenum dstType, GLvoid *dest, const GLuint *source,
145 const struct gl_pixelstore_attrib *dstPacking,
146 GLuint transferOps );
147
148
149 extern void
150 _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
151 GLenum dstType, GLvoid *dest,
152 GLenum srcType, const GLvoid *source,
153 const struct gl_pixelstore_attrib *srcPacking,
154 GLuint transferOps );
155
156 extern void
157 _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
158 GLenum dstType, GLvoid *dest, const GLstencil *source,
159 const struct gl_pixelstore_attrib *dstPacking );
160
161
162 extern void
163 _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest,
164 GLenum srcType, const GLvoid *source,
165 const struct gl_pixelstore_attrib *srcPacking );
166
167 extern void
168 _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
169 GLenum dstType, const GLfloat *depthSpan,
170 const struct gl_pixelstore_attrib *dstPacking );
171
172
173 extern void *
174 _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth,
175 GLenum format, GLenum type, const GLvoid *pixels,
176 const struct gl_pixelstore_attrib *unpack );
177
178
179 #endif