2
* PNG loader library for OpenGL v1.45 (10/07/00)
3
* by Ben Wyatt ben@wyatt100.freeserve.co.uk
4
* Using LibPNG 1.0.2 and ZLib 1.1.3
6
* This software is provided 'as-is', without any express or implied warranty.
7
* In no event will the author be held liable for any damages arising from the
8
* use of this software.
10
* Permission is hereby granted to use, copy, modify, and distribute this
11
* source code, or portions hereof, for any purpose, without fee, subject to
12
* the following restrictions:
14
* 1. The origin of this source code must not be misrepresented. You must not
15
* claim that you wrote the original software. If you use this software in
16
* a product, an acknowledgment in the product documentation would be
17
* appreciated but is not required.
18
* 2. Altered versions must be plainly marked as such and must not be
19
* misrepresented as being the original source.
20
* 3. This notice must not be removed or altered from any source distribution.
34
#pragma comment (lib, "glpngd.lib")
36
#pragma comment (lib, "glpng.lib")
40
/* XXX This is from Win32's <windef.h> */
42
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
43
#define APIENTRY __stdcall
49
/* Mipmapping parameters */
50
#define PNG_NOMIPMAPS 0 /* No mipmapping */
51
#define PNG_BUILDMIPMAPS -1 /* Calls a clone of gluBuild2DMipmaps() */
52
#define PNG_SIMPLEMIPMAPS -2 /* Generates mipmaps without filtering */
54
/* Who needs an "S" anyway? */
55
#define PNG_NOMIPMAP PNG_NOMIPMAPS
56
#define PNG_BUILDMIPMAP PNG_BUILDMIPMAPS
57
#define PNG_SIMPLEMIPMAP PNG_SIMPLEMIPMAPS
59
/* Transparency parameters */
60
#define PNG_CALLBACK -3 /* Call the callback function to generate alpha */
61
#define PNG_ALPHA -2 /* Use alpha channel in PNG file, if there is one */
62
#define PNG_SOLID -1 /* No transparency */
63
#define PNG_STENCIL 0 /* Sets alpha to 0 for r=g=b=0, 1 otherwise */
64
#define PNG_BLEND1 1 /* a = r+g+b */
65
#define PNG_BLEND2 2 /* a = (r+g+b)/2 */
66
#define PNG_BLEND3 3 /* a = (r+g+b)/3 */
67
#define PNG_BLEND4 4 /* a = r*r+g*g+b*b */
68
#define PNG_BLEND5 5 /* a = (r*r+g*g+b*b)/2 */
69
#define PNG_BLEND6 6 /* a = (r*r+g*g+b*b)/3 */
70
#define PNG_BLEND7 7 /* a = (r*r+g*g+b*b)/4 */
71
#define PNG_BLEND8 8 /* a = sqrt(r*r+g*g+b*b) */
86
unsigned int Components;
88
unsigned char *Palette;
91
extern int APIENTRY pngLoadRaw(const char *filename, pngRawInfo *rawinfo);
92
extern int APIENTRY pngLoadRawF(FILE *file, pngRawInfo *rawinfo);
94
extern int APIENTRY pngLoad(const char *filename, int mipmap, int trans, pngInfo *info);
95
extern int APIENTRY pngLoadF(FILE *file, int mipmap, int trans, pngInfo *info);
97
extern unsigned int APIENTRY pngBind(const char *filename, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter);
98
extern unsigned int APIENTRY pngBindF(FILE *file, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter);
100
extern void APIENTRY pngSetStencil(unsigned char red, unsigned char green, unsigned char blue);
101
extern void APIENTRY pngSetAlphaCallback(unsigned char (*callback)(unsigned char red, unsigned char green, unsigned char blue));
102
extern void APIENTRY pngSetViewingGamma(double viewingGamma);
103
extern void APIENTRY pngSetStandardOrientation(int standardorientation);