image.h revision 3464ebd5
17117f1b4Smrg/*
27117f1b4Smrg * Mesa 3-D graphics library
3c1f859d4Smrg * Version:  7.1
47117f1b4Smrg *
5c1f859d4Smrg * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
67117f1b4Smrg *
77117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
87117f1b4Smrg * copy of this software and associated documentation files (the "Software"),
97117f1b4Smrg * to deal in the Software without restriction, including without limitation
107117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
117117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the
127117f1b4Smrg * Software is furnished to do so, subject to the following conditions:
137117f1b4Smrg *
147117f1b4Smrg * The above copyright notice and this permission notice shall be included
157117f1b4Smrg * in all copies or substantial portions of the Software.
167117f1b4Smrg *
177117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
187117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
197117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
207117f1b4Smrg * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
217117f1b4Smrg * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
227117f1b4Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR 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;
347117f1b4Smrg
357117f1b4Smrgextern void
367117f1b4Smrg_mesa_swap2( GLushort *p, GLuint n );
377117f1b4Smrg
387117f1b4Smrgextern void
397117f1b4Smrg_mesa_swap4( GLuint *p, GLuint n );
407117f1b4Smrg
41c1f859d4Smrgextern GLboolean
42c1f859d4Smrg_mesa_type_is_packed(GLenum type);
43c1f859d4Smrg
447117f1b4Smrgextern GLint
457117f1b4Smrg_mesa_sizeof_type( GLenum type );
467117f1b4Smrg
477117f1b4Smrgextern GLint
487117f1b4Smrg_mesa_sizeof_packed_type( GLenum type );
497117f1b4Smrg
507117f1b4Smrgextern GLint
517117f1b4Smrg_mesa_components_in_format( GLenum format );
527117f1b4Smrg
537117f1b4Smrgextern GLint
547117f1b4Smrg_mesa_bytes_per_pixel( GLenum format, GLenum type );
557117f1b4Smrg
567117f1b4Smrgextern GLboolean
573464ebd5Sriastradh_mesa_is_legal_format_and_type(const struct gl_context *ctx,
583464ebd5Sriastradh                               GLenum format, GLenum type);
597117f1b4Smrg
604a49301eSmrgextern GLboolean
614a49301eSmrg_mesa_is_color_format(GLenum format);
624a49301eSmrg
634a49301eSmrgextern GLboolean
644a49301eSmrg_mesa_is_index_format(GLenum format);
654a49301eSmrg
664a49301eSmrgextern GLboolean
674a49301eSmrg_mesa_is_depth_format(GLenum format);
684a49301eSmrg
694a49301eSmrgextern GLboolean
704a49301eSmrg_mesa_is_stencil_format(GLenum format);
714a49301eSmrg
724a49301eSmrgextern GLboolean
734a49301eSmrg_mesa_is_ycbcr_format(GLenum format);
744a49301eSmrg
754a49301eSmrgextern GLboolean
764a49301eSmrg_mesa_is_depthstencil_format(GLenum format);
774a49301eSmrg
783464ebd5Sriastradhextern GLboolean
793464ebd5Sriastradh_mesa_is_depth_or_stencil_format(GLenum format);
803464ebd5Sriastradh
814a49301eSmrgextern GLboolean
824a49301eSmrg_mesa_is_dudv_format(GLenum format);
834a49301eSmrg
843464ebd5Sriastradhextern GLboolean
853464ebd5Sriastradh_mesa_is_integer_format(GLenum format);
863464ebd5Sriastradh
873464ebd5Sriastradhextern GLboolean
883464ebd5Sriastradh_mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
897117f1b4Smrg
907117f1b4Smrgextern GLvoid *
917117f1b4Smrg_mesa_image_address( GLuint dimensions,
927117f1b4Smrg                     const struct gl_pixelstore_attrib *packing,
937117f1b4Smrg                     const GLvoid *image,
947117f1b4Smrg                     GLsizei width, GLsizei height,
957117f1b4Smrg                     GLenum format, GLenum type,
967117f1b4Smrg                     GLint img, GLint row, GLint column );
977117f1b4Smrg
987117f1b4Smrgextern GLvoid *
997117f1b4Smrg_mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
1007117f1b4Smrg                       const GLvoid *image,
1017117f1b4Smrg                       GLsizei width,
1027117f1b4Smrg                       GLenum format, GLenum type,
1037117f1b4Smrg                       GLint column );
1047117f1b4Smrg
1057117f1b4Smrgextern GLvoid *
1067117f1b4Smrg_mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
1077117f1b4Smrg                       const GLvoid *image,
1087117f1b4Smrg                       GLsizei width, GLsizei height,
1097117f1b4Smrg                       GLenum format, GLenum type,
1107117f1b4Smrg                       GLint row, GLint column );
1117117f1b4Smrg
1127117f1b4Smrgextern GLvoid *
1137117f1b4Smrg_mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
1147117f1b4Smrg                       const GLvoid *image,
1157117f1b4Smrg                       GLsizei width, GLsizei height,
1167117f1b4Smrg                       GLenum format, GLenum type,
1177117f1b4Smrg                       GLint img, GLint row, GLint column );
1187117f1b4Smrg
1197117f1b4Smrg
1207117f1b4Smrgextern GLint
1217117f1b4Smrg_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
1227117f1b4Smrg                        GLint width, GLenum format, GLenum type );
1237117f1b4Smrg
1247117f1b4Smrg
1257117f1b4Smrgextern GLint
1267117f1b4Smrg_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
1277117f1b4Smrg                          GLint width, GLint height,
1287117f1b4Smrg                          GLenum format, GLenum type );
1297117f1b4Smrg
1307117f1b4Smrg
1314a49301eSmrgextern void
1324a49301eSmrg_mesa_expand_bitmap(GLsizei width, GLsizei height,
1334a49301eSmrg                    const struct gl_pixelstore_attrib *unpack,
1344a49301eSmrg                    const GLubyte *bitmap,
1354a49301eSmrg                    GLubyte *destBuffer, GLint destStride,
1364a49301eSmrg                    GLubyte onValue);
1374a49301eSmrg
1387117f1b4Smrg
1397117f1b4Smrgextern void
1407117f1b4Smrg_mesa_convert_colors(GLenum srcType, const GLvoid *src,
1417117f1b4Smrg                     GLenum dstType, GLvoid *dst,
1427117f1b4Smrg                     GLuint count, const GLubyte mask[]);
1437117f1b4Smrg
1447117f1b4Smrg
1457117f1b4Smrgextern GLboolean
1463464ebd5Sriastradh_mesa_clip_drawpixels(const struct gl_context *ctx,
1477117f1b4Smrg                      GLint *destX, GLint *destY,
1487117f1b4Smrg                      GLsizei *width, GLsizei *height,
1497117f1b4Smrg                      struct gl_pixelstore_attrib *unpack);
1507117f1b4Smrg
1517117f1b4Smrg
1527117f1b4Smrgextern GLboolean
1533464ebd5Sriastradh_mesa_clip_readpixels(const struct gl_context *ctx,
154cdc920a0Smrg                      GLint *srcX, GLint *srcY,
1557117f1b4Smrg                      GLsizei *width, GLsizei *height,
1567117f1b4Smrg                      struct gl_pixelstore_attrib *pack);
1577117f1b4Smrg
158c1f859d4Smrgextern GLboolean
1593464ebd5Sriastradh_mesa_clip_copytexsubimage(const struct gl_context *ctx,
160c1f859d4Smrg                           GLint *destX, GLint *destY,
161c1f859d4Smrg                           GLint *srcX, GLint *srcY,
162c1f859d4Smrg                           GLsizei *width, GLsizei *height);
163c1f859d4Smrg
1647117f1b4Smrgextern GLboolean
1657117f1b4Smrg_mesa_clip_to_region(GLint xmin, GLint ymin,
1667117f1b4Smrg                     GLint xmax, GLint ymax,
1677117f1b4Smrg                     GLint *x, GLint *y,
1687117f1b4Smrg                     GLsizei *width, GLsizei *height );
1697117f1b4Smrg
1704a49301eSmrgextern GLboolean
1713464ebd5Sriastradh_mesa_clip_blit(struct gl_context *ctx,
1724a49301eSmrg                GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
1734a49301eSmrg                GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
1744a49301eSmrg
1754a49301eSmrg
1767117f1b4Smrg#endif
177