00001 /*--------------------------------------------------------------------------- 00002 00003 rpng - simple PNG display program readpng.h 00004 00005 --------------------------------------------------------------------------- 00006 00007 Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. 00008 00009 This software is provided "as is," without warranty of any kind, 00010 express or implied. In no event shall the author or contributors 00011 be held liable for any damages arising in any way from the use of 00012 this software. 00013 00014 Permission is granted to anyone to use this software for any purpose, 00015 including commercial applications, and to alter it and redistribute 00016 it freely, subject to the following restrictions: 00017 00018 1. Redistributions of source code must retain the above copyright 00019 notice, disclaimer, and this list of conditions. 00020 2. Redistributions in binary form must reproduce the above copyright 00021 notice, disclaimer, and this list of conditions in the documenta- 00022 tion and/or other materials provided with the distribution. 00023 3. All advertising materials mentioning features or use of this 00024 software must display the following acknowledgment: 00025 00026 This product includes software developed by Greg Roelofs 00027 and contributors for the book, "PNG: The Definitive Guide," 00028 published by O'Reilly and Associates. 00029 00030 ---------------------------------------------------------------------------*/ 00031 00032 #ifndef TRUE 00033 # define TRUE 1 00034 # define FALSE 0 00035 #endif 00036 00037 #ifndef MAX 00038 # define MAX(a,b) ((a) > (b)? (a) : (b)) 00039 # define MIN(a,b) ((a) < (b)? (a) : (b)) 00040 #endif 00041 00042 #ifdef DEBUG 00043 # define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);} 00044 #else 00045 # define Trace(x) ; 00046 #endif 00047 00048 typedef unsigned char uch; 00049 typedef unsigned short ush; 00050 typedef unsigned long ulg; 00051 00052 00053 /* prototypes for public functions in readpng.c */ 00054 00055 void readpng_version_info(void); 00056 00057 int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight); 00058 00059 int readpng_get_bgcolor(uch *bg_red, uch *bg_green, uch *bg_blue); 00060 00061 uch *readpng_get_image(double display_exponent, int *pChannels, 00062 ulg *pRowbytes); 00063 00064 void readpng_cleanup(int free_image_data);