source: branches/port5/GL/glpng/glpng.h

Last change on this file was 5390, checked in by westram, 17 years ago
  • TAB-Ex
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/*
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
5 *
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.
9 *
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:
13 *
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.
21 */
22
23#ifndef _GLPNG_H_
24#define _GLPNG_H_
25
26#include <stdio.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#ifdef _MSC_VER
33#ifdef _DEBUG
34#pragma comment (lib, "glpngd.lib")
35#else
36#pragma comment (lib, "glpng.lib")
37#endif
38#endif
39
40    /* XXX This is from Win32's <windef.h> */
41#ifndef APIENTRY
42#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
43#define APIENTRY    __stdcall
44#else
45#define APIENTRY
46#endif
47#endif
48
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  */
53
54    /* Who needs an "S" anyway? */
55#define PNG_NOMIPMAP     PNG_NOMIPMAPS
56#define PNG_BUILDMIPMAP  PNG_BUILDMIPMAPS
57#define PNG_SIMPLEMIPMAP PNG_SIMPLEMIPMAPS
58
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)                          */
72
73    typedef struct {
74        unsigned int Width;
75        unsigned int Height;
76        unsigned int Depth;
77        unsigned int Alpha;
78    } pngInfo;
79
80    typedef struct {
81        unsigned int Width;
82        unsigned int Height;
83        unsigned int Depth;
84        unsigned int Alpha;
85
86        unsigned int Components;
87        unsigned char *Data;
88        unsigned char *Palette;
89    } pngRawInfo;
90
91    extern int APIENTRY pngLoadRaw(const char *filename, pngRawInfo *rawinfo);
92    extern int APIENTRY pngLoadRawF(FILE *file, pngRawInfo *rawinfo);
93
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);
96
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);
99
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);
104
105#ifdef __cplusplus
106}
107#endif
108
109#endif
Note: See TracBrowser for help on using the repository browser.