3fd2ca8b33874027d511d7f7b970176fbf636d64
[mesa.git] / src / mesa / main / image.h
1 /* $Id: image.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.1
6 *
7 * Copyright (C) 1999 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
29
30
31 #ifndef IMAGE_H
32 #define IMAGE_H
33
34
35 #include "types.h"
36
37
38 extern void gl_flip_bytes( GLubyte *p, GLuint n );
39
40
41 extern void gl_swap2( GLushort *p, GLuint n );
42
43 extern void gl_swap4( GLuint *p, GLuint n );
44
45
46 extern GLint gl_sizeof_type( GLenum type );
47
48 extern GLint gl_sizeof_packed_type( GLenum type );
49
50 extern GLint gl_components_in_format( GLenum format );
51
52 extern GLint gl_bytes_per_pixel( GLenum format, GLenum type );
53
54 extern GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type );
55
56
57 extern GLvoid *
58 gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing,
59 const GLvoid *image, GLsizei width,
60 GLsizei height, GLenum format, GLenum type,
61 GLint img, GLint row, GLint column );
62
63
64 extern struct gl_image *
65 gl_unpack_bitmap( GLcontext *ctx, GLsizei width, GLsizei height,
66 const GLubyte *bitmap,
67 const struct gl_pixelstore_attrib *packing );
68
69
70 extern void gl_unpack_polygon_stipple( const GLcontext *ctx,
71 const GLubyte *pattern,
72 GLuint dest[32] );
73
74
75 extern void gl_pack_polygon_stipple( const GLcontext *ctx,
76 const GLuint pattern[32],
77 GLubyte *dest );
78
79
80 extern struct gl_image *
81 gl_unpack_image( GLcontext *ctx, GLint width, GLint height,
82 GLenum srcFormat, GLenum srcType, const GLvoid *pixels,
83 const struct gl_pixelstore_attrib *packing );
84
85
86
87 struct gl_image *
88 gl_unpack_image3D( GLcontext *ctx, GLint width, GLint height,GLint depth,
89 GLenum srcFormat, GLenum srcType, const GLvoid *pixels,
90 const struct gl_pixelstore_attrib *packing );
91
92
93 extern void
94 gl_pack_rgba_span( const GLcontext *ctx,
95 GLuint n, CONST GLubyte rgba[][4],
96 GLenum format, GLenum type, GLvoid *dest,
97 const struct gl_pixelstore_attrib *packing,
98 GLboolean applyTransferOps );
99
100
101 extern void gl_free_image( struct gl_image *image );
102
103
104 extern GLboolean gl_image_error_test( GLcontext *ctx,
105 const struct gl_image *image,
106 const char *msg );
107
108
109 #endif