1848b8605Smrg/*
2848b8605Smrg * Mesa 3-D graphics library
3848b8605Smrg *
4848b8605Smrg * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
5848b8605Smrg *
6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7848b8605Smrg * copy of this software and associated documentation files (the "Software"),
8848b8605Smrg * to deal in the Software without restriction, including without limitation
9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the
11848b8605Smrg * Software is furnished to do so, subject to the following conditions:
12848b8605Smrg *
13848b8605Smrg * The above copyright notice and this permission notice shall be included
14848b8605Smrg * in all copies or substantial portions of the Software.
15848b8605Smrg *
16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE.
23848b8605Smrg */
24848b8605Smrg
25848b8605Smrg
26848b8605Smrg#ifndef IMAGE_H
27848b8605Smrg#define IMAGE_H
28848b8605Smrg
29848b8605Smrg
30848b8605Smrg#include "glheader.h"
31848b8605Smrg
32848b8605Smrgstruct gl_context;
33848b8605Smrgstruct gl_pixelstore_attrib;
34b8e80941Smrgstruct gl_framebuffer;
35848b8605Smrg
36848b8605Smrgextern void
37b8e80941Smrg_mesa_swap2(GLushort *p, GLuint n);
38848b8605Smrg
39848b8605Smrgextern void
40b8e80941Smrg_mesa_swap4(GLuint *p, GLuint n);
41b8e80941Smrg
42848b8605Smrg
43848b8605Smrgextern GLintptr
44848b8605Smrg_mesa_image_offset( GLuint dimensions,
45848b8605Smrg                    const struct gl_pixelstore_attrib *packing,
46848b8605Smrg                    GLsizei width, GLsizei height,
47848b8605Smrg                    GLenum format, GLenum type,
48848b8605Smrg                    GLint img, GLint row, GLint column );
49848b8605Smrg
50848b8605Smrgextern GLvoid *
51848b8605Smrg_mesa_image_address( GLuint dimensions,
52848b8605Smrg                     const struct gl_pixelstore_attrib *packing,
53848b8605Smrg                     const GLvoid *image,
54848b8605Smrg                     GLsizei width, GLsizei height,
55848b8605Smrg                     GLenum format, GLenum type,
56848b8605Smrg                     GLint img, GLint row, GLint column );
57848b8605Smrg
58848b8605Smrgextern GLvoid *
59848b8605Smrg_mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
60848b8605Smrg                       const GLvoid *image,
61848b8605Smrg                       GLsizei width,
62848b8605Smrg                       GLenum format, GLenum type,
63848b8605Smrg                       GLint column );
64848b8605Smrg
65848b8605Smrgextern GLvoid *
66848b8605Smrg_mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
67848b8605Smrg                       const GLvoid *image,
68848b8605Smrg                       GLsizei width, GLsizei height,
69848b8605Smrg                       GLenum format, GLenum type,
70848b8605Smrg                       GLint row, GLint column );
71848b8605Smrg
72848b8605Smrgextern GLvoid *
73848b8605Smrg_mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
74848b8605Smrg                       const GLvoid *image,
75848b8605Smrg                       GLsizei width, GLsizei height,
76848b8605Smrg                       GLenum format, GLenum type,
77848b8605Smrg                       GLint img, GLint row, GLint column );
78848b8605Smrg
79848b8605Smrg
80848b8605Smrgextern GLint
81848b8605Smrg_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
82848b8605Smrg                        GLint width, GLenum format, GLenum type );
83848b8605Smrg
84848b8605Smrg
85848b8605Smrgextern GLint
86848b8605Smrg_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
87848b8605Smrg                          GLint width, GLint height,
88848b8605Smrg                          GLenum format, GLenum type );
89848b8605Smrg
90848b8605Smrg
91848b8605Smrgextern void
92848b8605Smrg_mesa_expand_bitmap(GLsizei width, GLsizei height,
93848b8605Smrg                    const struct gl_pixelstore_attrib *unpack,
94848b8605Smrg                    const GLubyte *bitmap,
95848b8605Smrg                    GLubyte *destBuffer, GLint destStride,
96848b8605Smrg                    GLubyte onValue);
97848b8605Smrg
98848b8605Smrg
99848b8605Smrgextern void
100848b8605Smrg_mesa_convert_colors(GLenum srcType, const GLvoid *src,
101848b8605Smrg                     GLenum dstType, GLvoid *dst,
102848b8605Smrg                     GLuint count, const GLubyte mask[]);
103848b8605Smrg
104848b8605Smrg
105848b8605Smrgextern GLboolean
106848b8605Smrg_mesa_clip_drawpixels(const struct gl_context *ctx,
107848b8605Smrg                      GLint *destX, GLint *destY,
108848b8605Smrg                      GLsizei *width, GLsizei *height,
109848b8605Smrg                      struct gl_pixelstore_attrib *unpack);
110848b8605Smrg
111848b8605Smrg
112848b8605Smrgextern GLboolean
113848b8605Smrg_mesa_clip_readpixels(const struct gl_context *ctx,
114848b8605Smrg                      GLint *srcX, GLint *srcY,
115848b8605Smrg                      GLsizei *width, GLsizei *height,
116848b8605Smrg                      struct gl_pixelstore_attrib *pack);
117848b8605Smrg
118848b8605Smrgextern GLboolean
119848b8605Smrg_mesa_clip_copytexsubimage(const struct gl_context *ctx,
120848b8605Smrg                           GLint *destX, GLint *destY,
121848b8605Smrg                           GLint *srcX, GLint *srcY,
122848b8605Smrg                           GLsizei *width, GLsizei *height);
123848b8605Smrg
124848b8605Smrgextern GLboolean
125848b8605Smrg_mesa_clip_to_region(GLint xmin, GLint ymin,
126848b8605Smrg                     GLint xmax, GLint ymax,
127848b8605Smrg                     GLint *x, GLint *y,
128848b8605Smrg                     GLsizei *width, GLsizei *height );
129848b8605Smrg
130848b8605Smrgextern GLboolean
131848b8605Smrg_mesa_clip_blit(struct gl_context *ctx,
132b8e80941Smrg                const struct gl_framebuffer *readFb,
133b8e80941Smrg                const struct gl_framebuffer *drawFb,
134848b8605Smrg                GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
135848b8605Smrg                GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
136848b8605Smrg
137b8e80941Smrgvoid
138b8e80941Smrg_mesa_swap_bytes_2d_image(GLenum format, GLenum type,
139b8e80941Smrg                          const struct gl_pixelstore_attrib *packing,
140b8e80941Smrg                          GLsizei width, GLsizei height,
141b8e80941Smrg                          GLvoid *dst, const GLvoid *src);
142848b8605Smrg
143848b8605Smrg#endif
144