image.h revision d488af5b34e390a9b81dac96053bd45f34ffffff
1/* $Id: image.h,v 1.18 2002/03/13 04:34:32 brianp Exp $ */ 2 3/* 4 * Mesa 3-D graphics library 5 * Version: 4.1 6 * 7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. 8 * 9 * Permission is hereby granted, free of charge, to any person obtaining a 10 * copy of this software and associated documentation files (the "Software"), 11 * to deal in the Software without restriction, including without limitation 12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 * and/or sell copies of the Software, and to permit persons to whom the 14 * Software is furnished to do so, subject to the following conditions: 15 * 16 * The above copyright notice and this permission notice shall be included 17 * in all copies or substantial portions of the Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 */ 26 27 28#ifndef IMAGE_H 29#define IMAGE_H 30 31 32#include "mtypes.h" 33 34 35extern const struct gl_pixelstore_attrib _mesa_native_packing; 36 37 38extern void 39_mesa_swap2( GLushort *p, GLuint n ); 40 41extern void 42_mesa_swap4( GLuint *p, GLuint n ); 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( GLenum format, GLenum type ); 58 59 60extern GLvoid * 61_mesa_image_address( const struct gl_pixelstore_attrib *packing, 62 const GLvoid *image, GLsizei width, 63 GLsizei height, GLenum format, GLenum type, 64 GLint img, GLint row, GLint column ); 65 66 67extern GLint 68_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, 69 GLint width, GLenum format, GLenum type ); 70 71 72extern GLint 73_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, 74 GLint width, GLint height, 75 GLenum format, GLenum type ); 76 77extern void 78_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], 79 const struct gl_pixelstore_attrib *unpacking ); 80 81 82extern void 83_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, 84 const struct gl_pixelstore_attrib *packing ); 85 86 87extern GLvoid * 88_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, 89 const struct gl_pixelstore_attrib *packing ); 90 91extern void 92_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, 93 GLubyte *dest, const struct gl_pixelstore_attrib *packing ); 94 95 96extern void 97_mesa_pack_float_rgba_span( GLcontext *ctx, 98 GLuint n, CONST GLfloat rgba[][4], 99 GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, 100 const struct gl_pixelstore_attrib *dstPacking, 101 GLuint transferOps ); 102 103 104extern void 105_mesa_pack_rgba_span( GLcontext *ctx, 106 GLuint n, CONST GLchan rgba[][4], 107 GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, 108 const struct gl_pixelstore_attrib *dstPacking, 109 GLuint transferOps ); 110 111 112extern void 113_mesa_unpack_chan_color_span( GLcontext *ctx, 114 GLuint n, GLenum dstFormat, GLchan dest[], 115 GLenum srcFormat, GLenum srcType, 116 const GLvoid *source, 117 const struct gl_pixelstore_attrib *srcPacking, 118 GLuint transferOps ); 119 120 121extern void 122_mesa_unpack_float_color_span( GLcontext *ctx, 123 GLuint n, GLenum dstFormat, GLfloat dest[], 124 GLenum srcFormat, GLenum srcType, 125 const GLvoid *source, 126 const struct gl_pixelstore_attrib *srcPacking, 127 GLuint transferOps, GLboolean clamp ); 128 129 130extern void 131_mesa_unpack_index_span( const GLcontext *ctx, GLuint n, 132 GLenum dstType, GLvoid *dest, 133 GLenum srcType, const GLvoid *source, 134 const struct gl_pixelstore_attrib *srcPacking, 135 GLuint transferOps ); 136 137 138extern void 139_mesa_pack_index_span( const GLcontext *ctx, GLuint n, 140 GLenum dstType, GLvoid *dest, const GLuint *source, 141 const struct gl_pixelstore_attrib *dstPacking, 142 GLuint transferOps ); 143 144 145extern void 146_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, 147 GLenum dstType, GLvoid *dest, 148 GLenum srcType, const GLvoid *source, 149 const struct gl_pixelstore_attrib *srcPacking, 150 GLuint transferOps ); 151 152extern void 153_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, 154 GLenum dstType, GLvoid *dest, const GLstencil *source, 155 const struct gl_pixelstore_attrib *dstPacking ); 156 157 158extern void 159_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest, 160 GLenum srcType, const GLvoid *source, 161 const struct gl_pixelstore_attrib *srcPacking ); 162 163extern void 164_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, 165 GLenum dstType, const GLfloat *depthSpan, 166 const struct gl_pixelstore_attrib *dstPacking ); 167 168 169extern void * 170_mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth, 171 GLenum format, GLenum type, const GLvoid *pixels, 172 const struct gl_pixelstore_attrib *unpack ); 173 174 175#endif 176