17117f1b4Smrg/*
27117f1b4Smrg * Mesa 3-D graphics library
37117f1b4Smrg *
4c1f859d4Smrg * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
57117f1b4Smrg *
67117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
77117f1b4Smrg * copy of this software and associated documentation files (the "Software"),
87117f1b4Smrg * to deal in the Software without restriction, including without limitation
97117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
107117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the
117117f1b4Smrg * Software is furnished to do so, subject to the following conditions:
127117f1b4Smrg *
137117f1b4Smrg * The above copyright notice and this permission notice shall be included
147117f1b4Smrg * in all copies or substantial portions of the Software.
157117f1b4Smrg *
167117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
177117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
237117f1b4Smrg */
247117f1b4Smrg
257117f1b4Smrg
267117f1b4Smrg#ifndef IMAGE_H
277117f1b4Smrg#define IMAGE_H
287117f1b4Smrg
297117f1b4Smrg
303464ebd5Sriastradh#include "glheader.h"
317117f1b4Smrg
323464ebd5Sriastradhstruct gl_context;
333464ebd5Sriastradhstruct gl_pixelstore_attrib;
3401e04c3fSmrgstruct gl_framebuffer;
357117f1b4Smrg
367117f1b4Smrgextern void
3701e04c3fSmrg_mesa_swap2(GLushort *p, GLuint n);
387117f1b4Smrg
397117f1b4Smrgextern void
4001e04c3fSmrg_mesa_swap4(GLuint *p, GLuint n);
4101e04c3fSmrg
427117f1b4Smrg
43af69d88dSmrgextern GLintptr
44af69d88dSmrg_mesa_image_offset( GLuint dimensions,
45af69d88dSmrg                    const struct gl_pixelstore_attrib *packing,
46af69d88dSmrg                    GLsizei width, GLsizei height,
47af69d88dSmrg                    GLenum format, GLenum type,
48af69d88dSmrg                    GLint img, GLint row, GLint column );
497117f1b4Smrg
507117f1b4Smrgextern GLvoid *
517117f1b4Smrg_mesa_image_address( GLuint dimensions,
527117f1b4Smrg                     const struct gl_pixelstore_attrib *packing,
537117f1b4Smrg                     const GLvoid *image,
547117f1b4Smrg                     GLsizei width, GLsizei height,
557117f1b4Smrg                     GLenum format, GLenum type,
567117f1b4Smrg                     GLint img, GLint row, GLint column );
577117f1b4Smrg
587117f1b4Smrgextern GLvoid *
597117f1b4Smrg_mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
607117f1b4Smrg                       const GLvoid *image,
617117f1b4Smrg                       GLsizei width,
627117f1b4Smrg                       GLenum format, GLenum type,
637117f1b4Smrg                       GLint column );
647117f1b4Smrg
657117f1b4Smrgextern GLvoid *
667117f1b4Smrg_mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
677117f1b4Smrg                       const GLvoid *image,
687117f1b4Smrg                       GLsizei width, GLsizei height,
697117f1b4Smrg                       GLenum format, GLenum type,
707117f1b4Smrg                       GLint row, GLint column );
717117f1b4Smrg
727117f1b4Smrgextern GLvoid *
737117f1b4Smrg_mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
747117f1b4Smrg                       const GLvoid *image,
757117f1b4Smrg                       GLsizei width, GLsizei height,
767117f1b4Smrg                       GLenum format, GLenum type,
777117f1b4Smrg                       GLint img, GLint row, GLint column );
787117f1b4Smrg
797117f1b4Smrg
807117f1b4Smrgextern GLint
817117f1b4Smrg_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
827117f1b4Smrg                        GLint width, GLenum format, GLenum type );
837117f1b4Smrg
847117f1b4Smrg
857117f1b4Smrgextern GLint
867117f1b4Smrg_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
877117f1b4Smrg                          GLint width, GLint height,
887117f1b4Smrg                          GLenum format, GLenum type );
897117f1b4Smrg
907117f1b4Smrg
914a49301eSmrgextern void
924a49301eSmrg_mesa_expand_bitmap(GLsizei width, GLsizei height,
934a49301eSmrg                    const struct gl_pixelstore_attrib *unpack,
944a49301eSmrg                    const GLubyte *bitmap,
954a49301eSmrg                    GLubyte *destBuffer, GLint destStride,
964a49301eSmrg                    GLubyte onValue);
974a49301eSmrg
987117f1b4Smrg
997117f1b4Smrgextern void
1007117f1b4Smrg_mesa_convert_colors(GLenum srcType, const GLvoid *src,
1017117f1b4Smrg                     GLenum dstType, GLvoid *dst,
1027117f1b4Smrg                     GLuint count, const GLubyte mask[]);
1037117f1b4Smrg
1047117f1b4Smrg
1057117f1b4Smrgextern GLboolean
1063464ebd5Sriastradh_mesa_clip_drawpixels(const struct gl_context *ctx,
1077117f1b4Smrg                      GLint *destX, GLint *destY,
1087117f1b4Smrg                      GLsizei *width, GLsizei *height,
1097117f1b4Smrg                      struct gl_pixelstore_attrib *unpack);
1107117f1b4Smrg
1117117f1b4Smrg
1127117f1b4Smrgextern GLboolean
1133464ebd5Sriastradh_mesa_clip_readpixels(const struct gl_context *ctx,
114cdc920a0Smrg                      GLint *srcX, GLint *srcY,
1157117f1b4Smrg                      GLsizei *width, GLsizei *height,
1167117f1b4Smrg                      struct gl_pixelstore_attrib *pack);
1177117f1b4Smrg
118c1f859d4Smrgextern GLboolean
1193464ebd5Sriastradh_mesa_clip_copytexsubimage(const struct gl_context *ctx,
120c1f859d4Smrg                           GLint *destX, GLint *destY,
121c1f859d4Smrg                           GLint *srcX, GLint *srcY,
122c1f859d4Smrg                           GLsizei *width, GLsizei *height);
123c1f859d4Smrg
1247117f1b4Smrgextern GLboolean
1257117f1b4Smrg_mesa_clip_to_region(GLint xmin, GLint ymin,
1267117f1b4Smrg                     GLint xmax, GLint ymax,
1277117f1b4Smrg                     GLint *x, GLint *y,
1287117f1b4Smrg                     GLsizei *width, GLsizei *height );
1297117f1b4Smrg
1304a49301eSmrgextern GLboolean
1313464ebd5Sriastradh_mesa_clip_blit(struct gl_context *ctx,
13201e04c3fSmrg                const struct gl_framebuffer *readFb,
13301e04c3fSmrg                const struct gl_framebuffer *drawFb,
1344a49301eSmrg                GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
1354a49301eSmrg                GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
1364a49301eSmrg
13701e04c3fSmrgvoid
13801e04c3fSmrg_mesa_swap_bytes_2d_image(GLenum format, GLenum type,
13901e04c3fSmrg                          const struct gl_pixelstore_attrib *packing,
14001e04c3fSmrg                          GLsizei width, GLsizei height,
14101e04c3fSmrg                          GLvoid *dst, const GLvoid *src);
1424a49301eSmrg
1437117f1b4Smrg#endif
144