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 GLintptr
42_mesa_image_offset( GLuint dimensions,
43                    const struct gl_pixelstore_attrib *packing,
44                    GLsizei width, GLsizei height,
45                    GLenum format, GLenum type,
46                    GLint img, GLint row, GLint column );
47
48extern GLvoid *
49_mesa_image_address( GLuint dimensions,
50                     const struct gl_pixelstore_attrib *packing,
51                     const GLvoid *image,
52                     GLsizei width, GLsizei height,
53                     GLenum format, GLenum type,
54                     GLint img, GLint row, GLint column );
55
56extern GLvoid *
57_mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
58                       const GLvoid *image,
59                       GLsizei width,
60                       GLenum format, GLenum type,
61                       GLint column );
62
63extern GLvoid *
64_mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
65                       const GLvoid *image,
66                       GLsizei width, GLsizei height,
67                       GLenum format, GLenum type,
68                       GLint row, GLint column );
69
70extern GLvoid *
71_mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
72                       const GLvoid *image,
73                       GLsizei width, GLsizei height,
74                       GLenum format, GLenum type,
75                       GLint img, GLint row, GLint column );
76
77
78extern GLint
79_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
80                        GLint width, GLenum format, GLenum type );
81
82
83extern GLint
84_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
85                          GLint width, GLint height,
86                          GLenum format, GLenum type );
87
88
89extern void
90_mesa_expand_bitmap(GLsizei width, GLsizei height,
91                    const struct gl_pixelstore_attrib *unpack,
92                    const GLubyte *bitmap,
93                    GLubyte *destBuffer, GLint destStride,
94                    GLubyte onValue);
95
96
97extern void
98_mesa_convert_colors(GLenum srcType, const GLvoid *src,
99                     GLenum dstType, GLvoid *dst,
100                     GLuint count, const GLubyte mask[]);
101
102
103extern GLboolean
104_mesa_clip_drawpixels(const struct gl_context *ctx,
105                      GLint *destX, GLint *destY,
106                      GLsizei *width, GLsizei *height,
107                      struct gl_pixelstore_attrib *unpack);
108
109
110extern GLboolean
111_mesa_clip_readpixels(const struct gl_context *ctx,
112                      GLint *srcX, GLint *srcY,
113                      GLsizei *width, GLsizei *height,
114                      struct gl_pixelstore_attrib *pack);
115
116extern GLboolean
117_mesa_clip_copytexsubimage(const struct gl_context *ctx,
118                           GLint *destX, GLint *destY,
119                           GLint *srcX, GLint *srcY,
120                           GLsizei *width, GLsizei *height);
121
122extern GLboolean
123_mesa_clip_to_region(GLint xmin, GLint ymin,
124                     GLint xmax, GLint ymax,
125                     GLint *x, GLint *y,
126                     GLsizei *width, GLsizei *height );
127
128extern GLboolean
129_mesa_clip_blit(struct gl_context *ctx,
130                GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
131                GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
132
133
134#endif
135