1 /* 2 * Mesa 3-D graphics library 3 * 4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * and/or sell copies of the Software, and to permit persons to whom the 11 * Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included 14 * in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 * OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 25 26 #ifndef IMAGE_H 27 #define IMAGE_H 28 29 30 #include "glheader.h" 31 32 struct gl_context; 33 struct gl_pixelstore_attrib; 34 struct gl_framebuffer; 35 36 extern void 37 _mesa_swap2(GLushort *p, GLuint n); 38 39 extern void 40 _mesa_swap4(GLuint *p, GLuint n); 41 42 43 extern GLintptr 44 _mesa_image_offset( GLuint dimensions, 45 const struct gl_pixelstore_attrib *packing, 46 GLsizei width, GLsizei height, 47 GLenum format, GLenum type, 48 GLint img, GLint row, GLint column ); 49 50 extern GLvoid * 51 _mesa_image_address( GLuint dimensions, 52 const struct gl_pixelstore_attrib *packing, 53 const GLvoid *image, 54 GLsizei width, GLsizei height, 55 GLenum format, GLenum type, 56 GLint img, GLint row, GLint column ); 57 58 extern GLvoid * 59 _mesa_image_address1d( const struct gl_pixelstore_attrib *packing, 60 const GLvoid *image, 61 GLsizei width, 62 GLenum format, GLenum type, 63 GLint column ); 64 65 extern GLvoid * 66 _mesa_image_address2d( const struct gl_pixelstore_attrib *packing, 67 const GLvoid *image, 68 GLsizei width, GLsizei height, 69 GLenum format, GLenum type, 70 GLint row, GLint column ); 71 72 extern GLvoid * 73 _mesa_image_address3d( const struct gl_pixelstore_attrib *packing, 74 const GLvoid *image, 75 GLsizei width, GLsizei height, 76 GLenum format, GLenum type, 77 GLint img, GLint row, GLint column ); 78 79 80 extern GLint 81 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, 82 GLint width, GLenum format, GLenum type ); 83 84 85 extern GLint 86 _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, 87 GLint width, GLint height, 88 GLenum format, GLenum type ); 89 90 91 extern void 92 _mesa_expand_bitmap(GLsizei width, GLsizei height, 93 const struct gl_pixelstore_attrib *unpack, 94 const GLubyte *bitmap, 95 GLubyte *destBuffer, GLint destStride, 96 GLubyte onValue); 97 98 99 extern void 100 _mesa_convert_colors(GLenum srcType, const GLvoid *src, 101 GLenum dstType, GLvoid *dst, 102 GLuint count, const GLubyte mask[]); 103 104 105 extern GLboolean 106 _mesa_clip_drawpixels(const struct gl_context *ctx, 107 GLint *destX, GLint *destY, 108 GLsizei *width, GLsizei *height, 109 struct gl_pixelstore_attrib *unpack); 110 111 112 extern GLboolean 113 _mesa_clip_readpixels(const struct gl_context *ctx, 114 GLint *srcX, GLint *srcY, 115 GLsizei *width, GLsizei *height, 116 struct gl_pixelstore_attrib *pack); 117 118 extern GLboolean 119 _mesa_clip_copytexsubimage(const struct gl_context *ctx, 120 GLint *destX, GLint *destY, 121 GLint *srcX, GLint *srcY, 122 GLsizei *width, GLsizei *height); 123 124 extern GLboolean 125 _mesa_clip_to_region(GLint xmin, GLint ymin, 126 GLint xmax, GLint ymax, 127 GLint *x, GLint *y, 128 GLsizei *width, GLsizei *height ); 129 130 extern GLboolean 131 _mesa_clip_blit(struct gl_context *ctx, 132 const struct gl_framebuffer *readFb, 133 const struct gl_framebuffer *drawFb, 134 GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1, 135 GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1); 136 137 void 138 _mesa_swap_bytes_2d_image(GLenum format, GLenum type, 139 const struct gl_pixelstore_attrib *packing, 140 GLsizei width, GLsizei height, 141 GLvoid *dst, const GLvoid *src); 142 143 #endif 144