xref: /aosp_15_r20/external/libpng/contrib/gregbook/readpng.h (revision a67afe4df73cf47866eedc69947994b8ff839aba)
1*a67afe4dSAndroid Build Coastguard Worker /*---------------------------------------------------------------------------
2*a67afe4dSAndroid Build Coastguard Worker 
3*a67afe4dSAndroid Build Coastguard Worker    rpng - simple PNG display program                              readpng.h
4*a67afe4dSAndroid Build Coastguard Worker 
5*a67afe4dSAndroid Build Coastguard Worker   ---------------------------------------------------------------------------
6*a67afe4dSAndroid Build Coastguard Worker 
7*a67afe4dSAndroid Build Coastguard Worker       Copyright (c) 1998-2007 Greg Roelofs.  All rights reserved.
8*a67afe4dSAndroid Build Coastguard Worker 
9*a67afe4dSAndroid Build Coastguard Worker       This software is provided "as is," without warranty of any kind,
10*a67afe4dSAndroid Build Coastguard Worker       express or implied.  In no event shall the author or contributors
11*a67afe4dSAndroid Build Coastguard Worker       be held liable for any damages arising in any way from the use of
12*a67afe4dSAndroid Build Coastguard Worker       this software.
13*a67afe4dSAndroid Build Coastguard Worker 
14*a67afe4dSAndroid Build Coastguard Worker       The contents of this file are DUAL-LICENSED.  You may modify and/or
15*a67afe4dSAndroid Build Coastguard Worker       redistribute this software according to the terms of one of the
16*a67afe4dSAndroid Build Coastguard Worker       following two licenses (at your option):
17*a67afe4dSAndroid Build Coastguard Worker 
18*a67afe4dSAndroid Build Coastguard Worker 
19*a67afe4dSAndroid Build Coastguard Worker       LICENSE 1 ("BSD-like with advertising clause"):
20*a67afe4dSAndroid Build Coastguard Worker 
21*a67afe4dSAndroid Build Coastguard Worker       Permission is granted to anyone to use this software for any purpose,
22*a67afe4dSAndroid Build Coastguard Worker       including commercial applications, and to alter it and redistribute
23*a67afe4dSAndroid Build Coastguard Worker       it freely, subject to the following restrictions:
24*a67afe4dSAndroid Build Coastguard Worker 
25*a67afe4dSAndroid Build Coastguard Worker       1. Redistributions of source code must retain the above copyright
26*a67afe4dSAndroid Build Coastguard Worker          notice, disclaimer, and this list of conditions.
27*a67afe4dSAndroid Build Coastguard Worker       2. Redistributions in binary form must reproduce the above copyright
28*a67afe4dSAndroid Build Coastguard Worker          notice, disclaimer, and this list of conditions in the documenta-
29*a67afe4dSAndroid Build Coastguard Worker          tion and/or other materials provided with the distribution.
30*a67afe4dSAndroid Build Coastguard Worker       3. All advertising materials mentioning features or use of this
31*a67afe4dSAndroid Build Coastguard Worker          software must display the following acknowledgment:
32*a67afe4dSAndroid Build Coastguard Worker 
33*a67afe4dSAndroid Build Coastguard Worker             This product includes software developed by Greg Roelofs
34*a67afe4dSAndroid Build Coastguard Worker             and contributors for the book, "PNG: The Definitive Guide,"
35*a67afe4dSAndroid Build Coastguard Worker             published by O'Reilly and Associates.
36*a67afe4dSAndroid Build Coastguard Worker 
37*a67afe4dSAndroid Build Coastguard Worker 
38*a67afe4dSAndroid Build Coastguard Worker       LICENSE 2 (GNU GPL v2 or later):
39*a67afe4dSAndroid Build Coastguard Worker 
40*a67afe4dSAndroid Build Coastguard Worker       This program is free software; you can redistribute it and/or modify
41*a67afe4dSAndroid Build Coastguard Worker       it under the terms of the GNU General Public License as published by
42*a67afe4dSAndroid Build Coastguard Worker       the Free Software Foundation; either version 2 of the License, or
43*a67afe4dSAndroid Build Coastguard Worker       (at your option) any later version.
44*a67afe4dSAndroid Build Coastguard Worker 
45*a67afe4dSAndroid Build Coastguard Worker       This program is distributed in the hope that it will be useful,
46*a67afe4dSAndroid Build Coastguard Worker       but WITHOUT ANY WARRANTY; without even the implied warranty of
47*a67afe4dSAndroid Build Coastguard Worker       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
48*a67afe4dSAndroid Build Coastguard Worker       GNU General Public License for more details.
49*a67afe4dSAndroid Build Coastguard Worker 
50*a67afe4dSAndroid Build Coastguard Worker       You should have received a copy of the GNU General Public License
51*a67afe4dSAndroid Build Coastguard Worker       along with this program; if not, write to the Free Software Foundation,
52*a67afe4dSAndroid Build Coastguard Worker       Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
53*a67afe4dSAndroid Build Coastguard Worker 
54*a67afe4dSAndroid Build Coastguard Worker   ---------------------------------------------------------------------------*/
55*a67afe4dSAndroid Build Coastguard Worker 
56*a67afe4dSAndroid Build Coastguard Worker #ifndef TRUE
57*a67afe4dSAndroid Build Coastguard Worker #  define TRUE 1
58*a67afe4dSAndroid Build Coastguard Worker #  define FALSE 0
59*a67afe4dSAndroid Build Coastguard Worker #endif
60*a67afe4dSAndroid Build Coastguard Worker 
61*a67afe4dSAndroid Build Coastguard Worker #ifndef MAX
62*a67afe4dSAndroid Build Coastguard Worker #  define MAX(a,b)  ((a) > (b)? (a) : (b))
63*a67afe4dSAndroid Build Coastguard Worker #  define MIN(a,b)  ((a) < (b)? (a) : (b))
64*a67afe4dSAndroid Build Coastguard Worker #endif
65*a67afe4dSAndroid Build Coastguard Worker 
66*a67afe4dSAndroid Build Coastguard Worker #ifdef DEBUG
67*a67afe4dSAndroid Build Coastguard Worker #  define Trace(x)  {fprintf x ; fflush(stderr); fflush(stdout);}
68*a67afe4dSAndroid Build Coastguard Worker #else
69*a67afe4dSAndroid Build Coastguard Worker #  define Trace(x)  ;
70*a67afe4dSAndroid Build Coastguard Worker #endif
71*a67afe4dSAndroid Build Coastguard Worker 
72*a67afe4dSAndroid Build Coastguard Worker typedef unsigned char   uch;
73*a67afe4dSAndroid Build Coastguard Worker typedef unsigned short  ush;
74*a67afe4dSAndroid Build Coastguard Worker typedef unsigned long   ulg;
75*a67afe4dSAndroid Build Coastguard Worker 
76*a67afe4dSAndroid Build Coastguard Worker 
77*a67afe4dSAndroid Build Coastguard Worker /* prototypes for public functions in readpng.c */
78*a67afe4dSAndroid Build Coastguard Worker 
79*a67afe4dSAndroid Build Coastguard Worker void readpng_version_info(void);
80*a67afe4dSAndroid Build Coastguard Worker 
81*a67afe4dSAndroid Build Coastguard Worker int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight);
82*a67afe4dSAndroid Build Coastguard Worker 
83*a67afe4dSAndroid Build Coastguard Worker int readpng_get_bgcolor(uch *bg_red, uch *bg_green, uch *bg_blue);
84*a67afe4dSAndroid Build Coastguard Worker 
85*a67afe4dSAndroid Build Coastguard Worker uch *readpng_get_image(double display_exponent, int *pChannels,
86*a67afe4dSAndroid Build Coastguard Worker                        ulg *pRowbytes);
87*a67afe4dSAndroid Build Coastguard Worker 
88*a67afe4dSAndroid Build Coastguard Worker void readpng_cleanup(int free_image_data);
89