ARB
glpng.h
Go to the documentation of this file.
1 /* PNG loader library for OpenGL v1.45 (10/07/00)
2  * by Ben Wyatt ben@wyatt100.freeserve.co.uk
3  * Using LibPNG 1.0.2 and ZLib 1.1.3
4  *
5  * This software is provided 'as-is', without any express or implied warranty.
6  * In no event will the author be held liable for any damages arising from the
7  * use of this software.
8  *
9  * Permission is hereby granted to use, copy, modify, and distribute this
10  * source code, or portions hereof, for any purpose, without fee, subject to
11  * the following restrictions:
12  *
13  * 1. The origin of this source code must not be misrepresented. You must not
14  * claim that you wrote the original software. If you use this software in
15  * a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  * 2. Altered versions must be plainly marked as such and must not be
18  * misrepresented as being the original source.
19  * 3. This notice must not be removed or altered from any source distribution.
20  *
21  * ---------------------------------------------------
22  * This version has been modified for usage inside ARB
23  * http://arb-home.de/
24  */
25 
26 #ifndef _GLPNG_H_
27 #define _GLPNG_H_
28 
29 #include <stdio.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #ifdef _MSC_VER
36 #ifdef _DEBUG
37 #pragma comment (lib, "glpngd.lib")
38 #else
39 #pragma comment (lib, "glpng.lib")
40 #endif
41 #endif
42 
43  // XXX This is from Win32's <windef.h>
44 #ifndef APIENTRY
45 #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
46 #define APIENTRY __stdcall
47 #else
48 #define APIENTRY
49 #endif
50 #endif
51 
52  // Mipmapping parameters
53 #define GLPNG_NOMIPMAPS 0 // No mipmapping
54 #define GLPNG_BUILDMIPMAPS -1 // Calls a clone of gluBuild2DMipmaps()
55 #define GLPNG_SIMPLEMIPMAPS -2 // Generates mipmaps without filtering
56 
57  // Who needs an "S" anyway?
58 #define GLPNG_NOMIPMAP GLPNG_NOMIPMAPS
59 #define GLPNG_BUILDMIPMAP GLPNG_BUILDMIPMAPS
60 #define GLPNG_SIMPLEMIPMAP GLPNG_SIMPLEMIPMAPS
61 
62  // Transparency parameters
63 #define GLPNG_CALLBACK -3 // Call the callback function to generate alpha
64 #define GLPNG_ALPHA -2 // Use alpha channel in PNG file, if there is one
65 #define GLPNG_SOLID -1 // No transparency
66 #define GLPNG_STENCIL 0 // Sets alpha to 0 for r=g=b=0, 1 otherwise
67 #define GLPNG_BLEND1 1 // a = r+g+b
68 #define GLPNG_BLEND2 2 // a = (r+g+b)/2
69 #define GLPNG_BLEND3 3 // a = (r+g+b)/3
70 #define GLPNG_BLEND4 4 // a = r*r+g*g+b*b
71 #define GLPNG_BLEND5 5 // a = (r*r+g*g+b*b)/2
72 #define GLPNG_BLEND6 6 // a = (r*r+g*g+b*b)/3
73 #define GLPNG_BLEND7 7 // a = (r*r+g*g+b*b)/4
74 #define GLPNG_BLEND8 8 // a = sqrt(r*r+g*g+b*b)
75 
76  typedef struct {
77  unsigned int Width;
78  unsigned int Height;
79  unsigned int Depth;
80  unsigned int Alpha;
81  } pngInfo;
82 
83  typedef struct {
84  unsigned int Width;
85  unsigned int Height;
86  unsigned int Depth;
87  unsigned int Alpha;
88 
89  unsigned int Components;
90  unsigned char *Data;
91  unsigned char *Palette;
92  } pngRawInfo;
93 
94  extern unsigned int APIENTRY pngBind(const char *filename, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter);
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif
unsigned int Components
Definition: glpng.h:89
unsigned int Depth
Definition: glpng.h:86
unsigned int Height
Definition: glpng.h:85
unsigned int Alpha
Definition: glpng.h:80
unsigned int Height
Definition: glpng.h:78
unsigned int APIENTRY pngBind(const char *filename, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter)
Definition: glpng.c:569
Definition: glpng.h:76
unsigned int Width
Definition: glpng.h:84
unsigned int Alpha
Definition: glpng.h:87
unsigned char * Data
Definition: glpng.h:90
unsigned int Width
Definition: glpng.h:77
unsigned int Depth
Definition: glpng.h:79
unsigned char * Palette
Definition: glpng.h:91
#define APIENTRY
Definition: glpng.h:48
static int info[maxsites+1]