1 /*---------------------------------------------------------------------------
3 rpng2 - progressive-model PNG display program readpng2.h
5 ---------------------------------------------------------------------------
7 Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
9 This software is provided "as is," without warranty of any kind,
10 express or implied. In no event shall the author or contributors
11 be held liable for any damages arising in any way from the use of
14 The contents of this file are DUAL-LICENSED. You may modify and/or
15 redistribute this software according to the terms of one of the
16 following two licenses (at your option):
19 LICENSE 1 ("BSD-like with advertising clause"):
21 Permission is granted to anyone to use this software for any purpose,
22 including commercial applications, and to alter it and redistribute
23 it freely, subject to the following restrictions:
25 1. Redistributions of source code must retain the above copyright
26 notice, disclaimer, and this list of conditions.
27 2. Redistributions in binary form must reproduce the above copyright
28 notice, disclaimer, and this list of conditions in the documenta-
29 tion and/or other materials provided with the distribution.
30 3. All advertising materials mentioning features or use of this
31 software must display the following acknowledgment:
33 This product includes software developed by Greg Roelofs
34 and contributors for the book, "PNG: The Definitive Guide,"
35 published by O'Reilly and Associates.
38 LICENSE 2 (GNU GPL v2 or later):
40 This program is free software; you can redistribute it and/or modify
41 it under the terms of the GNU General Public License as published by
42 the Free Software Foundation; either version 2 of the License, or
43 (at your option) any later version.
45 This program is distributed in the hope that it will be useful,
46 but WITHOUT ANY WARRANTY; without even the implied warranty of
47 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 GNU General Public License for more details.
50 You should have received a copy of the GNU General Public License
51 along with this program; if not, write to the Free Software Foundation,
52 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
54 ---------------------------------------------------------------------------*/
62 # define MAX(a,b) ((a) > (b)? (a) : (b))
63 # define MIN(a,b) ((a) < (b)? (a) : (b))
67 # define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);}
78 typedef unsigned char uch
;
79 typedef unsigned short ush
;
80 typedef unsigned long ulg
;
82 typedef struct _mainprog_info
{
83 double display_exponent
;
88 void (*mainprog_init
)(void);
89 void (*mainprog_display_row
)(ulg row_num
);
90 void (*mainprog_finish_display
)(void);
94 int passes
; /* not used */
106 /* prototypes for public functions in readpng2.c */
108 void readpng2_version_info(void);
110 int readpng2_check_sig(uch
*sig
, int num
);
112 int readpng2_init(mainprog_info
*mainprog_ptr
);
114 int readpng2_decode_data(mainprog_info
*mainprog_ptr
, uch
*rawbuf
, ulg length
);
116 void readpng2_cleanup(mainprog_info
*mainprog_ptr
);