This repository has been archived on 2023-11-11. You can view files and clone it, but cannot push or open issues or pull requests.
libpng/contrib/gregbook/readpng2.h

122 lines
3.8 KiB
C
Raw Normal View History

1999-10-14 12:43:10 +00:00
/*---------------------------------------------------------------------------
rpng2 - progressive-model PNG display program readpng2.h
---------------------------------------------------------------------------
2008-03-16 22:23:05 +00:00
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
1999-10-14 12:43:10 +00:00
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
2007-06-19 01:53:52 +00:00
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
1999-10-14 12:43:10 +00:00
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. Redistributions of source code must retain the above copyright
notice, disclaimer, and this list of conditions.
2. Redistributions in binary form must reproduce the above copyright
notice, disclaimer, and this list of conditions in the documenta-
tion and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
This product includes software developed by Greg Roelofs
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
2007-06-19 01:53:52 +00:00
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1999-10-14 12:43:10 +00:00
---------------------------------------------------------------------------*/
#ifndef TRUE
# define TRUE 1
# define FALSE 0
#endif
#ifndef MAX
# define MAX(a,b) ((a) > (b)? (a) : (b))
# define MIN(a,b) ((a) < (b)? (a) : (b))
#endif
#ifdef DEBUG
# define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);}
#else
# define Trace(x) ;
#endif
2008-03-16 22:23:05 +00:00
enum rpng2_states {
kPreInit = 0,
kWindowInit,
kDone
};
1999-10-14 12:43:10 +00:00
typedef unsigned char uch;
typedef unsigned short ush;
typedef unsigned long ulg;
typedef struct _mainprog_info {
double display_exponent;
ulg width;
ulg height;
void *png_ptr;
void *info_ptr;
void (*mainprog_init)(void);
void (*mainprog_display_row)(ulg row_num);
void (*mainprog_finish_display)(void);
uch *image_data;
uch **row_pointers;
jmp_buf jmpbuf;
2000-03-21 11:13:06 +00:00
int passes; /* not used */
int pass;
1999-10-14 12:43:10 +00:00
int rowbytes;
int channels;
int need_bgcolor;
2007-06-19 01:53:52 +00:00
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
2001-01-12 21:13:06 +00:00
int nommxfilters;
int nommxcombine;
int nommxinterlace;
#endif
2008-03-16 22:23:05 +00:00
int state;
1999-10-14 12:43:10 +00:00
uch bg_red;
uch bg_green;
uch bg_blue;
} mainprog_info;
/* prototypes for public functions in readpng2.c */
void readpng2_version_info(void);
int readpng2_check_sig(uch *sig, int num);
int readpng2_init(mainprog_info *mainprog_ptr);
int readpng2_decode_data(mainprog_info *mainprog_ptr, uch *rawbuf, ulg length);
void readpng2_cleanup(mainprog_info *mainprog_ptr);