include/glpng.h

Go to the documentation of this file.
00001 /*
00002  * PNG loader library for OpenGL v1.45 (10/07/00)
00003  * by Ben Wyatt ben@wyatt100.freeserve.co.uk
00004  * Using LibPNG 1.0.2 and ZLib 1.1.3
00005  *
00006  * This software is provided 'as-is', without any express or implied warranty.
00007  * In no event will the author be held liable for any damages arising from the
00008  * use of this software.
00009  *
00010  * Permission is hereby granted to use, copy, modify, and distribute this
00011  * source code, or portions hereof, for any purpose, without fee, subject to
00012  * the following restrictions:
00013  *
00014  * 1. The origin of this source code must not be misrepresented. You must not
00015  *    claim that you wrote the original software. If you use this software in
00016  *    a product, an acknowledgment in the product documentation would be
00017  *    appreciated but is not required.
00018  * 2. Altered versions must be plainly marked as such and must not be
00019  *    misrepresented as being the original source.
00020  * 3. This notice must not be removed or altered from any source distribution.
00021  */
00022 
00023 #ifndef _GLPNG_H_
00024 #define _GLPNG_H_
00025 
00026 #include <stdio.h>
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /* //not building as a library anymore
00033 #ifdef _MSC_VER
00034         #ifdef _DEBUG
00035                 #pragma comment (lib, "glpngd.lib")
00036         #else
00037                 #pragma comment (lib, "glpng.lib")
00038         #endif
00039 #endif*/
00040 
00041 /* XXX This is from Win32's <windef.h> */
00042 #ifndef APIENTRY
00043         #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
00044                 #define APIENTRY    __stdcall
00045         #else
00046                 #define APIENTRY
00047         #endif
00048 #endif
00049 
00050 /* Mipmapping parameters */
00051 #define PNG_NOMIPMAPS      0 /* No mipmapping                        */
00052 #define PNG_BUILDMIPMAPS  -1 /* Calls a clone of gluBuild2DMipmaps() */
00053 #define PNG_SIMPLEMIPMAPS -2 /* Generates mipmaps without filtering  */
00054 
00055 /* Who needs an "S" anyway? */
00056 #define PNG_NOMIPMAP     PNG_NOMIPMAPS
00057 #define PNG_BUILDMIPMAP  PNG_BUILDMIPMAPS
00058 #define PNG_SIMPLEMIPMAP PNG_SIMPLEMIPMAPS
00059 
00060 /* Transparency parameters */
00061 #define PNG_CALLBACK  -3 /* Call the callback function to generate alpha   */
00062 #define PNG_ALPHA     -2 /* Use alpha channel in PNG file, if there is one */
00063 #define PNG_SOLID     -1 /* No transparency                                */
00064 #define PNG_STENCIL    0 /* Sets alpha to 0 for r=g=b=0, 1 otherwise       */
00065 #define PNG_BLEND1     1 /* a = r+g+b                                      */
00066 #define PNG_BLEND2     2 /* a = (r+g+b)/2                                  */
00067 #define PNG_BLEND3     3 /* a = (r+g+b)/3                                  */
00068 #define PNG_BLEND4     4 /* a = r*r+g*g+b*b                                */
00069 #define PNG_BLEND5     5 /* a = (r*r+g*g+b*b)/2                            */
00070 #define PNG_BLEND6     6 /* a = (r*r+g*g+b*b)/3                            */
00071 #define PNG_BLEND7     7 /* a = (r*r+g*g+b*b)/4                            */
00072 #define PNG_BLEND8     8 /* a = sqrt(r*r+g*g+b*b)                          */
00073 
00074 typedef struct {
00075         unsigned int Width;
00076         unsigned int Height;
00077         unsigned int Depth;
00078         unsigned int Alpha;
00079 } pngInfo;
00080 
00081 typedef struct {
00082         unsigned int Width;
00083         unsigned int Height;
00084         unsigned int Depth;
00085         unsigned int Alpha;
00086 
00087         unsigned int Components;
00088         unsigned char *Data;
00089         unsigned char *Palette;
00090 } pngRawInfo;
00091 
00092 extern int APIENTRY pngLoadRaw(const char *filename, pngRawInfo *rawinfo);
00093 extern int APIENTRY pngLoadRawF(FILE *file, pngRawInfo *rawinfo);
00094 
00095 extern int APIENTRY pngLoad(const char *filename, int mipmap, int trans, pngInfo *info);
00096 extern int APIENTRY pngLoadF(FILE *file, int mipmap, int trans, pngInfo *info);
00097 
00098 extern unsigned int APIENTRY pngBind(const char *filename, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter);
00099 extern unsigned int APIENTRY pngBindF(FILE *file, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter);
00100 
00101 extern void APIENTRY pngSetStencil(unsigned char red, unsigned char green, unsigned char blue);
00102 extern void APIENTRY pngSetAlphaCallback(unsigned char (*callback)(unsigned char red, unsigned char green, unsigned char blue));
00103 extern void APIENTRY pngSetViewingGamma(double viewingGamma);
00104 extern void APIENTRY pngSetStandardOrientation(int standardorientation);
00105 
00106 #ifdef __cplusplus
00107 }
00108 #endif
00109 
00110 #endif

Generated on Wed Dec 5 20:32:03 2007 for GLWX by  doxygen 1.5.3