|
fukasawa |
e60969 |
/*---------------------------------------------------------------------------
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
rpng - simple PNG display program readpng.h
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
---------------------------------------------------------------------------
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
This software is provided "as is," without warranty of any kind,
|
|
fukasawa |
e60969 |
express or implied. In no event shall the author or contributors
|
|
fukasawa |
e60969 |
be held liable for any damages arising in any way from the use of
|
|
fukasawa |
e60969 |
this software.
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
The contents of this file are DUAL-LICENSED. You may modify and/or
|
|
fukasawa |
e60969 |
redistribute this software according to the terms of one of the
|
|
fukasawa |
e60969 |
following two licenses (at your option):
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
LICENSE 1 ("BSD-like with advertising clause"):
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
Permission is granted to anyone to use this software for any purpose,
|
|
fukasawa |
e60969 |
including commercial applications, and to alter it and redistribute
|
|
fukasawa |
e60969 |
it freely, subject to the following restrictions:
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
1. Redistributions of source code must retain the above copyright
|
|
fukasawa |
e60969 |
notice, disclaimer, and this list of conditions.
|
|
fukasawa |
e60969 |
2. Redistributions in binary form must reproduce the above copyright
|
|
fukasawa |
e60969 |
notice, disclaimer, and this list of conditions in the documenta-
|
|
fukasawa |
e60969 |
tion and/or other materials provided with the distribution.
|
|
fukasawa |
e60969 |
3. All advertising materials mentioning features or use of this
|
|
fukasawa |
e60969 |
software must display the following acknowledgment:
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
This product includes software developed by Greg Roelofs
|
|
fukasawa |
e60969 |
and contributors for the book, "PNG: The Definitive Guide,"
|
|
fukasawa |
e60969 |
published by O'Reilly and Associates.
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
LICENSE 2 (GNU GPL v2 or later):
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
This program is free software; you can redistribute it and/or modify
|
|
fukasawa |
e60969 |
it under the terms of the GNU General Public License as published by
|
|
fukasawa |
e60969 |
the Free Software Foundation; either version 2 of the License, or
|
|
fukasawa |
e60969 |
(at your option) any later version.
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
This program is distributed in the hope that it will be useful,
|
|
fukasawa |
e60969 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
fukasawa |
e60969 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
fukasawa |
e60969 |
GNU General Public License for more details.
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
You should have received a copy of the GNU General Public License
|
|
fukasawa |
e60969 |
along with this program; if not, write to the Free Software Foundation,
|
|
fukasawa |
e60969 |
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
---------------------------------------------------------------------------*/
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
#ifndef TRUE
|
|
fukasawa |
e60969 |
# define TRUE 1
|
|
fukasawa |
e60969 |
# define FALSE 0
|
|
fukasawa |
e60969 |
#endif
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
#ifndef MAX
|
|
fukasawa |
e60969 |
# define MAX(a,b) ((a) > (b)? (a) : (b))
|
|
fukasawa |
e60969 |
# define MIN(a,b) ((a) < (b)? (a) : (b))
|
|
fukasawa |
e60969 |
#endif
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
#ifdef DEBUG
|
|
fukasawa |
e60969 |
# define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);}
|
|
fukasawa |
e60969 |
#else
|
|
fukasawa |
e60969 |
# define Trace(x) ;
|
|
fukasawa |
e60969 |
#endif
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
typedef unsigned char uch;
|
|
fukasawa |
e60969 |
typedef unsigned short ush;
|
|
fukasawa |
e60969 |
typedef unsigned long ulg;
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
/* prototypes for public functions in readpng.c */
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
void readpng_version_info(void);
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight);
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
int readpng_get_bgcolor(uch *bg_red, uch *bg_green, uch *bg_blue);
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
uch *readpng_get_image(double display_exponent, int *pChannels,
|
|
fukasawa |
e60969 |
ulg *pRowbytes);
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
void readpng_cleanup(int free_image_data);
|