image.h revision 3464ebd5
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 "glheader.h"
31
32struct gl_context;
33struct gl_pixelstore_attrib;
34
35extern void
36_mesa_swap2( GLushort *p, GLuint n );
37
38extern void
39_mesa_swap4( GLuint *p, GLuint n );
40
41extern GLboolean
42_mesa_type_is_packed(GLenum type);
43
44extern GLint
45_mesa_sizeof_type( GLenum type );
46
47extern GLint
48_mesa_sizeof_packed_type( GLenum type );
49
50extern GLint
51_mesa_components_in_format( GLenum format );
52
53extern GLint
54_mesa_bytes_per_pixel( GLenum format, GLenum type );
55
56extern GLboolean
57_mesa_is_legal_format_and_type(const struct gl_context *ctx,
58                               GLenum format, GLenum type);
59
60extern GLboolean
61_mesa_is_color_format(GLenum format);
62
63extern GLboolean
64_mesa_is_index_format(GLenum format);
65
66extern GLboolean
67_mesa_is_depth_format(GLenum format);
68
69extern GLboolean
70_mesa_is_stencil_format(GLenum format);
71
72extern GLboolean
73_mesa_is_ycbcr_format(GLenum format);
74
75extern GLboolean
76_mesa_is_depthstencil_format(GLenum format);
77
78extern GLboolean
79_mesa_is_depth_or_stencil_format(GLenum format);
80
81extern GLboolean
82_mesa_is_dudv_format(GLenum format);
83
84extern GLboolean
85_mesa_is_integer_format(GLenum format);
86
87extern GLboolean
88_mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
89
90extern GLvoid *
91_mesa_image_address( GLuint dimensions,
92                     const struct gl_pixelstore_attrib *packing,
93                     const GLvoid *image,
94                     GLsizei width, GLsizei height,
95                     GLenum format, GLenum type,
96                     GLint img, GLint row, GLint column );
97
98extern GLvoid *
99_mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
100                       const GLvoid *image,
101                       GLsizei width,
102                       GLenum format, GLenum type,
103                       GLint column );
104
105extern GLvoid *
106_mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
107                       const GLvoid *image,
108                       GLsizei width, GLsizei height,
109                       GLenum format, GLenum type,
110                       GLint row, GLint column );
111
112extern GLvoid *
113_mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
114                       const GLvoid *image,
115                       GLsizei width, GLsizei height,
116                       GLenum format, GLenum type,
117                       GLint img, GLint row, GLint column );
118
119
120extern GLint
121_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
122                        GLint width, GLenum format, GLenum type );
123
124
125extern GLint
126_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
127                          GLint width, GLint height,
128                          GLenum format, GLenum type );
129
130
131extern void
132_mesa_expand_bitmap(GLsizei width, GLsizei height,
133                    const struct gl_pixelstore_attrib *unpack,
134                    const GLubyte *bitmap,
135                    GLubyte *destBuffer, GLint destStride,
136                    GLubyte onValue);
137
138
139extern void
140_mesa_convert_colors(GLenum srcType, const GLvoid *src,
141                     GLenum dstType, GLvoid *dst,
142                     GLuint count, const GLubyte mask[]);
143
144
145extern GLboolean
146_mesa_clip_drawpixels(const struct gl_context *ctx,
147                      GLint *destX, GLint *destY,
148                      GLsizei *width, GLsizei *height,
149                      struct gl_pixelstore_attrib *unpack);
150
151
152extern GLboolean
153_mesa_clip_readpixels(const struct gl_context *ctx,
154                      GLint *srcX, GLint *srcY,
155                      GLsizei *width, GLsizei *height,
156                      struct gl_pixelstore_attrib *pack);
157
158extern GLboolean
159_mesa_clip_copytexsubimage(const struct gl_context *ctx,
160                           GLint *destX, GLint *destY,
161                           GLint *srcX, GLint *srcY,
162                           GLsizei *width, GLsizei *height);
163
164extern GLboolean
165_mesa_clip_to_region(GLint xmin, GLint ymin,
166                     GLint xmax, GLint ymax,
167                     GLint *x, GLint *y,
168                     GLsizei *width, GLsizei *height );
169
170extern GLboolean
171_mesa_clip_blit(struct gl_context *ctx,
172                GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
173                GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
174
175
176#endif
177