671242f350d172e106580348e24bab66b0d7e6a5vboxsync/*---------------------------------------------------------------------------
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync rpng2 - progressive-model PNG display program readpng2.h
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync ---------------------------------------------------------------------------
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync This software is provided "as is," without warranty of any kind,
671242f350d172e106580348e24bab66b0d7e6a5vboxsync express or implied. In no event shall the author or contributors
671242f350d172e106580348e24bab66b0d7e6a5vboxsync be held liable for any damages arising in any way from the use of
671242f350d172e106580348e24bab66b0d7e6a5vboxsync this software.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync Permission is granted to anyone to use this software for any purpose,
671242f350d172e106580348e24bab66b0d7e6a5vboxsync including commercial applications, and to alter it and redistribute
671242f350d172e106580348e24bab66b0d7e6a5vboxsync it freely, subject to the following restrictions:
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync 1. Redistributions of source code must retain the above copyright
671242f350d172e106580348e24bab66b0d7e6a5vboxsync notice, disclaimer, and this list of conditions.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync 2. Redistributions in binary form must reproduce the above copyright
671242f350d172e106580348e24bab66b0d7e6a5vboxsync notice, disclaimer, and this list of conditions in the documenta-
671242f350d172e106580348e24bab66b0d7e6a5vboxsync tion and/or other materials provided with the distribution.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync 3. All advertising materials mentioning features or use of this
671242f350d172e106580348e24bab66b0d7e6a5vboxsync software must display the following acknowledgment:
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync This product includes software developed by Greg Roelofs
671242f350d172e106580348e24bab66b0d7e6a5vboxsync and contributors for the book, "PNG: The Definitive Guide,"
671242f350d172e106580348e24bab66b0d7e6a5vboxsync published by O'Reilly and Associates.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync ---------------------------------------------------------------------------*/
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#ifndef TRUE
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# define TRUE 1
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# define FALSE 0
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#endif
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#ifndef MAX
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# define MAX(a,b) ((a) > (b)? (a) : (b))
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# define MIN(a,b) ((a) < (b)? (a) : (b))
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#endif
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#ifdef DEBUG
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);}
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#else
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# define Trace(x) ;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#endif
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsynctypedef unsigned char uch;
671242f350d172e106580348e24bab66b0d7e6a5vboxsynctypedef unsigned short ush;
671242f350d172e106580348e24bab66b0d7e6a5vboxsynctypedef unsigned long ulg;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsynctypedef struct _mainprog_info {
671242f350d172e106580348e24bab66b0d7e6a5vboxsync double display_exponent;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync ulg width;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync ulg height;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync void *png_ptr;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync void *info_ptr;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync void (*mainprog_init)(void);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync void (*mainprog_display_row)(ulg row_num);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync void (*mainprog_finish_display)(void);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync uch *image_data;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync uch **row_pointers;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync jmp_buf jmpbuf;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int passes; /* not used */
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int pass;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int rowbytes;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int channels;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int need_bgcolor;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#if (defined(__i386__) || defined(_M_IX86))
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int nommxfilters;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int nommxcombine;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int nommxinterlace;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#endif
671242f350d172e106580348e24bab66b0d7e6a5vboxsync int done;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync uch bg_red;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync uch bg_green;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync uch bg_blue;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync} mainprog_info;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync/* prototypes for public functions in readpng2.c */
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncvoid readpng2_version_info(void);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncint readpng2_check_sig(uch *sig, int num);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncint readpng2_init(mainprog_info *mainprog_ptr);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncint readpng2_decode_data(mainprog_info *mainprog_ptr, uch *rawbuf, ulg length);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncvoid readpng2_cleanup(mainprog_info *mainprog_ptr);