Imported from libpng-1.0.5c.tar

This commit is contained in:
Glenn Randers-Pehrson 1999-11-27 10:22:33 -06:00
parent 6d8f3b080a
commit 5379b24536
46 changed files with 720 additions and 178 deletions

View File

@ -1,12 +1,12 @@
Libpng 1.0.5a - October 23, 1999
Libpng 1.0.5c - November 27, 1999
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
Changes since the last public release (1.0.5):
version 1.0.5a [October 23, 1999]
version libpng-1.0.5a October 23, 1999
Added contrib/pngsuite and contrib/pngminus (Willem van Schaik)
Fixed a typo in the png_set_sRGB() function call in example.c (Jan Nijtmans)
Further optimization and bugfix of pngvcrd.c
@ -14,6 +14,26 @@ version 1.0.5a [October 23, 1999]
text_ptr structure. Instead, it makes its own copy.
Created separate write_end_info_struct in pngtest.c for a more severe test.
Added code in pngwrite.c to free info_ptr->text[i].key to stop a memory leak.
version libpng-1.0.5b November 23, 1999
Moved PNG_FLAG_HAVE_CHUNK_HEADER, PNG_FLAG_BACKGROUND_IS_GRAY and
PNG_FLAG_WROTE_tIME from flags to mode.
Added png_write_info_before_PLTE() function.
Fixed some typecasting in contrib/gregbook/*.c
Updated scripts/makevms.com and added makevms.com to contrib/gregbook
and contrib/pngminus (Martin Zinser)
version 1.0.5c [November 27, 1999]
Moved png_get_header_version from png.h to png.c, to accomodate ansi2knr.
Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to
accomodate making DLL's: Moved usr_png_ver from global variable to function
png_get_header_ver() in png.c. Moved png_sig to png_sig_bytes in png.c and
eliminated use of png_sig in pngwutil.c. Moved the various png_CHNK arrays
into pngtypes.h. Eliminated use of global png_pass arrays. Declared the
png_CHNK and png_pass arrays to be "const". Made the global arrays
available to applications (although none are used in libpng itself) when
PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined.
Removed some extraneous "-I" from contrib/pngminus/makefile.std
Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2.
Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

20
CHANGES
View File

@ -484,3 +484,23 @@ version 1.0.5a [October 23, 1999]
text_ptr structure. Instead, it makes its own copy.
Created separate write_end_info_struct in pngtest.c for a more severe test.
Added code in pngwrite.c to free info_ptr->text[i].key to stop a memory leak.
version 1.0.5b [November 23, 1999]
Moved PNG_FLAG_HAVE_CHUNK_HEADER, PNG_FLAG_BACKGROUND_IS_GRAY and
PNG_FLAG_WROTE_tIME from flags to mode.
Added png_write_info_before_PLTE() function.
Fixed some typecasting in contrib/gregbook/*.c
Updated scripts/makevms.com and added makevms.com to contrib/gregbook
and contrib/pngminus (Martin Zinser)
version 1.0.5c [November 27, 1999]
Moved png_get_header_version from png.h to png.c, to accomodate ansi2knr.
Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to
accomodate making DLL's: Moved usr_png_ver from global variable to function
png_get_header_ver() in png.c. Moved png_sig to png_sig_bytes in png.c and
eliminated use of png_sig in pngwutil.c. Moved the various png_CHNK arrays
into pngtypes.h. Eliminated use of global png_pass arrays. Declared the
png_CHNK and png_pass arrays to be "const". Made the global arrays
available to applications (although none are used in libpng itself) when
PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined.
Removed some extraneous "-I" from contrib/pngminus/makefile.std
Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2.
Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3

View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.5a - October 23, 1999
Installing libpng version 1.0.5c - November 27, 1999
Before installing libpng, you must first install zlib. zlib
can usually be found wherever you got libpng. zlib can be
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
version of zlib that's installed.
You can rename the directories that you downloaded (they
might be called "libpng-1.0.5a" or "lpng103" and "zlib-1.1.3"
might be called "libpng-1.0.5c" or "lpng103" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@ -51,8 +51,8 @@ include
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.sgi => Silicon Graphics IRIX makefile
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.5a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5a)
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.5c)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5c)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

View File

@ -5,7 +5,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.90, December 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.5a, October 23, 1999)
(libpng versions 0.97, January 1998, through 1.0.5c, November 27, 1999)
For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals:
@ -67,4 +67,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
randeg@alum.rpi.edu
October 23, 1999
November 27, 1999

6
README
View File

@ -1,4 +1,4 @@
README for libpng 1.0.5a - October 23, 1999 (shared library 2.1)
README for libpng 1.0.5c - November 27, 1999 (shared library 2.1)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@ -171,9 +171,9 @@ Files in this distribution:
makefile.sgi => Silicon Graphics IRIX makefile
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.5a)
(gcc, creates libpng.so.2.1.0.5c)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.5a)
(gcc, creates libpng.so.2.1.0.5c)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

View File

@ -1,13 +1,13 @@
Y2K compliance in libpng:
=========================
October 23, 1999
November 27, 1999
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.5a are Y2K compliant. It is my belief that earlier
upward through 1.0.5c are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer

View File

@ -0,0 +1,104 @@
$!------------------------------------------------------------------------------
$! make Contrib programs of libpng under OpenVMS
$!
$!
$! Look for the compiler used
$!
$ zlibsrc = "[---.zlib]"
$ ccopt="/include=(''zlibsrc',[--])"
$ if f$getsyi("HW_MODEL").ge.1024
$ then
$ ccopt = "/prefix=all"+ccopt
$ comp = "__decc__=1"
$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
$ else
$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
$ then
$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
$ if f$search("SYS$SYSTEM:VAXC.EXE").eqs.""
$ then
$ comp = "__gcc__=1"
$ CC :== GCC
$ else
$ comp = "__vaxc__=1"
$ endif
$ else
$ if f$trnlnm("SYS").eqs."" then define sys decc$library_include:
$ ccopt = "/decc/prefix=all"+ccopt
$ comp = "__decc__=1"
$ endif
$ endif
$ open/write lopt lib.opt
$ write lopt "[--]libpng.olb/lib"
$ write lopt "''zlibsrc'libz.olb/lib"
$ close lopt
$ open/write xopt x11.opt
$ write xopt "sys$library:decw$xlibshr.exe/share"
$ close xopt
$ write sys$output "Compiling PNG contrib programs ..."
$ CALL MAKE readpng.OBJ "cc ''CCOPT' readpng" -
readpng.c readpng.h
$ CALL MAKE readpng2.OBJ "cc ''CCOPT' readpng2" -
readpng2.c readpng2.h
$ CALL MAKE writepng.OBJ "cc ''CCOPT' writepng" -
writepng.c writepng.h
$ write sys$output "Building rpng-x..."
$ CALL MAKE rpng-x.OBJ "cc ''CCOPT' rpng-x" -
rpng-x.c readpng.h
$ call make rpng-x.exe -
"LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" -
rpng-x.obj readpng.obj
$ write sys$output "Building rpng2-x..."
$ CALL MAKE rpng2-x.OBJ "cc ''CCOPT' rpng2-x" -
rpng2-x.c readpng2.h
$ call make rpng2-x.exe -
"LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" -
rpng2-x.obj readpng2.obj
$ write sys$output "Building wpng..."
$ CALL MAKE wpng.OBJ "cc ''CCOPT' wpng" -
wpng.c writepng.h
$ call make wpng.exe -
"LINK wpng,writepng,lib.opt/opt" -
wpng.obj writepng.obj
$ exit
$!
$!
$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
$ V = 'F$Verify(0)
$! P1 = What we are trying to make
$! P2 = Command to make it
$! P3 - P8 What it depends on
$
$ If F$Search(P1) .Eqs. "" Then Goto Makeit
$ Time = F$CvTime(F$File(P1,"RDT"))
$arg=3
$Loop:
$ Argument = P'arg
$ If Argument .Eqs. "" Then Goto Exit
$ El=0
$Loop2:
$ File = F$Element(El," ",Argument)
$ If File .Eqs. " " Then Goto Endl
$ AFile = ""
$Loop3:
$ OFile = AFile
$ AFile = F$Search(File)
$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
$ Goto Loop3
$NextEL:
$ El = El + 1
$ Goto Loop2
$EndL:
$ arg=arg+1
$ If arg .Le. 8 Then Goto Loop
$ Goto Exit
$
$Makeit:
$ VV=F$VERIFY(0)
$ write sys$output P2
$ 'P2
$ VV='F$Verify(VV)
$Exit:
$ If V Then Set Verify
$ENDSUBROUTINE

View File

@ -222,7 +222,8 @@ int main(int argc, char **argv)
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
++error;
} else {
if ((rc = readpng_init(infile, &image_width, &image_height)) != 0) {
if ((rc = readpng_init(infile, (long *)(&image_width),
(long *)(&image_height))) != 0) {
switch (rc) {
case 1:
fprintf(stderr, PROGNAME
@ -542,7 +543,8 @@ static int rpng_x_create_window()
static int rpng_x_display_image()
{
uch *src, *dest;
uch *src;
char *dest;
uch r, g, b, a;
int ximage_rowbytes = ximage->bytes_per_line;
ulg i, row, lastrow = 0;

View File

@ -57,6 +57,10 @@
#include <X11/Xos.h>
#include <X11/keysym.h> /* defines XK_* macros */
#ifdef VMS
#include <unistd.h>
#endif
/* all for PvdM background code: */
#ifndef PI
# define PI 3.141592653589793238
@ -721,7 +725,8 @@ static int rpng2_x_create_window()
static int rpng2_x_load_bg_image()
{
uch *src, *dest;
uch *src;
char *dest;
uch r1, r2, g1, g2, b1, b2;
uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv;
int k, hmax, max;
@ -784,7 +789,7 @@ static int rpng2_x_load_bg_image()
g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max;
b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max;
dest = bg_data + row*bg_rowbytes;
dest = (char *)(bg_data + row*bg_rowbytes);
for (i = 0; i < rpng2_info.width; ++i) {
even_odd_horiz = (i / bgscale) & 1;
even_odd = even_odd_vert ^ even_odd_horiz;
@ -837,7 +842,7 @@ static int rpng2_x_load_bg_image()
yidx = row % bgscale;
if (yidx > hmax)
yidx = bgscale-1 - yidx;
dest = bg_data + row*bg_rowbytes;
dest = (char *)(bg_data + row*bg_rowbytes);
for (i = 0; i < rpng2_info.width; ++i) {
xidx = i % bgscale;
if (xidx > hmax)
@ -887,7 +892,7 @@ static int rpng2_x_load_bg_image()
for (row = 0; row < rpng2_info.height; ++row) {
y = row - hh;
dest = bg_data + row*bg_rowbytes;
dest = (char *)(bg_data + row*bg_rowbytes);
for (i = 0; i < rpng2_info.width; ++i) {
x = i - hw;
angle = (x == 0)? PI_2 : atan((double)y / (double)x);
@ -1001,7 +1006,8 @@ static void rpng2_x_display_row(ulg row)
uch bg_red = rpng2_info.bg_red;
uch bg_green = rpng2_info.bg_green;
uch bg_blue = rpng2_info.bg_blue;
uch *src, *src2=NULL, *dest;
uch *src, *src2=NULL;
char *dest;
uch r, g, b, a;
int ximage_rowbytes = ximage->bytes_per_line;
ulg i, pixel;

View File

@ -94,8 +94,8 @@ can be part of a pipe.
To list the options type "png2pnm -h" or "pnm2png -h".
Just like IKEA
--------------
Just like Scandinavian furniture
--------------------------------
You have to put it together yourself. I did test the software under
MS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In both
cases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK,

View File

@ -10,13 +10,13 @@ RM=rm
CP=cp
PNGPATH = /usr/local
PNGINC = -I$(PNGPATH)/include
#PNGLIB = -L$(PNGPATH)/lib -lpng
PNGINC = $(PNGPATH)/include
#PNGLIB = $(PNGPATH)/lib -lpng
PNGLIB = $(PNGPATH)/lib/libpng.a
ZPATH = /usr/local
ZINC = -I$(ZPATH)/include
#ZLIB = -L$(ZPATH)/lib -lz
ZINC = $(ZPATH)/include
#ZLIB = $(ZPATH)/lib -lz
ZLIB = $(ZPATH)/lib/libz.a
CCFLAGS=-I$(PNGINC) -I$(ZINC)

View File

@ -0,0 +1,92 @@
$!------------------------------------------------------------------------------
$! make Contrib programs of libpng under OpenVMS
$!
$!
$! Look for the compiler used
$!
$ zlibsrc = "[---.zlib]"
$ ccopt="/include=(''zlibsrc',[--])"
$ if f$getsyi("HW_MODEL").ge.1024
$ then
$ ccopt = "/prefix=all"+ccopt
$ comp = "__decc__=1"
$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
$ else
$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
$ then
$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
$ if f$search("SYS$SYSTEM:VAXC.EXE").eqs.""
$ then
$ comp = "__gcc__=1"
$ CC :== GCC
$ else
$ comp = "__vaxc__=1"
$ endif
$ else
$ if f$trnlnm("SYS").eqs."" then define sys decc$library_include:
$ ccopt = "/decc/prefix=all"+ccopt
$ comp = "__decc__=1"
$ endif
$ endif
$ open/write lopt lib.opt
$ write lopt "[--]libpng.olb/lib"
$ write lopt "''zlibsrc'libz.olb/lib"
$ close lopt
$ open/write xopt x11.opt
$ write xopt "sys$library:decw$xlibshr.exe/share"
$ close xopt
$ write sys$output "Compiling PNG contrib programs ..."
$ write sys$output "Building pnm2png..."
$ CALL MAKE pnm2png.OBJ "cc ''CCOPT' pnm2png" -
pnm2png.c
$ call make pnm2png.exe -
"LINK pnm2png,lib.opt/opt" -
pnm2png.obj
$ write sys$output "Building png2pnm..."
$ CALL MAKE png2pnm.OBJ "cc ''CCOPT' png2pnm" -
png2pnm.c
$ call make pnm2png.exe -
"LINK pnm2png,lib.opt/opt" -
pnm2png.obj
$ exit
$!
$!
$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
$ V = 'F$Verify(0)
$! P1 = What we are trying to make
$! P2 = Command to make it
$! P3 - P8 What it depends on
$
$ If F$Search(P1) .Eqs. "" Then Goto Makeit
$ Time = F$CvTime(F$File(P1,"RDT"))
$arg=3
$Loop:
$ Argument = P'arg
$ If Argument .Eqs. "" Then Goto Exit
$ El=0
$Loop2:
$ File = F$Element(El," ",Argument)
$ If File .Eqs. " " Then Goto Endl
$ AFile = ""
$Loop3:
$ OFile = AFile
$ AFile = F$Search(File)
$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
$ Goto Loop3
$NextEL:
$ El = El + 1
$ Goto Loop2
$EndL:
$ arg=arg+1
$ If arg .Le. 8 Then Goto Loop
$ Goto Exit
$
$Makeit:
$ VV=F$VERIFY(0)
$ write sys$output P2
$ 'P2
$ VV='F$Verify(VV)
$Exit:
$ If V Then Set Verify
$ENDSUBROUTINE

View File

@ -604,6 +604,14 @@ void write_png(char *file_name /* , ... other image information ... */)
/* Write the file header information. REQUIRED */
png_write_info(png_ptr, info_ptr);
/* If you want, you can write the info in two steps, in case you need to
* write your private chunk ahead of PLTE:
*
* png_write_info_before_PLTE(write_ptr, write_info_ptr);
* write_my_chunk();
* png_write_info(png_ptr, info_ptr);
*/
/* Once we write out the header, the compression type on the text
* chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or
* PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again

View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "October 23, 1999"
.TH LIBPNG 3 "November 27, 1999"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23, 1999
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5c - November 27, 1999
.SH SYNOPSIS
\fI\fB
@ -128,6 +128,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23,
\fI\fB
\fBpng_byte png_get_header_ver (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBpng_byte png_get_header_version (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
@ -156,6 +160,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23,
\fI\fB
\fBpng_byte png_get_libpng_ver (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBpng_voidp png_get_mem_ptr(png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
@ -598,6 +606,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23,
\fI\fB
\fBvoid png_write_info_before_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_write_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
@ -617,7 +629,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.5a - October 23, 1999
libpng version 1.0.5c - November 27, 1999
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
@ -846,7 +858,7 @@ called after each row has been read, which you can use to control
a progress meter or the like. It's demonstrated in pngtest.c.
You must supply a function
void read_row_callback(png_ptr, png_uint_32 row, int pass);
void read_row_callback(png_ptr ptr, png_uint_32 row, int pass);
{
/* put your code here */
}
@ -1939,10 +1951,10 @@ Some of the more important parts of the png_info are:
Color Consortium
(http://www.color.org).
It can be one of
PNG_SRGB_INTENT_SATURATION,
PNG_SRGB_INTENT_PERCEPTUAL,
PNG_SRGB_INTENT_ABSOLUTE, or
PNG_SRGB_INTENT_RELATIVE.
PNG_sRGB_INTENT_SATURATION,
PNG_sRGB_INTENT_PERCEPTUAL,
PNG_sRGB_INTENT_ABSOLUTE, or
PNG_sRGB_INTENT_RELATIVE.
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr,
@ -2106,6 +2118,14 @@ image data. You do this with a call to png_write_info().
png_write_info(png_ptr, info_ptr);
If you need to write a private chunk that you want to appear before
the PLTE chunk when PLTE is present, you can write the PNG info in
two steps, and insert code to write your own chunk between them:
png_write_info_before_PLTE(png_ptr, info_ptr);
write_my_private_chunks();
png_write_info(png_ptr, info_ptr);
After you've written the file information, you can set up the library
to handle any special transformations of the image data. The various
ways to transform the data will be described in the order that they
@ -2675,13 +2695,13 @@ the old method.
.SH VII. Y2K Compliance in libpng
October 23, 1999
November 27, 1999
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.5a are Y2K compliant. It is my belief that earlier
upward through 1.0.5c are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
@ -2807,7 +2827,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.5a - October 23, 1999:
Libpng version 1.0.5c - November 27, 1999:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
@ -2822,7 +2842,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.90, December 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.5a, October 23, 1999)
(libpng versions 0.97, January 1998, through 1.0.5c, November 27, 1999)
For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals:

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.5a - October 23, 1999
libpng version 1.0.5c - November 27, 1999
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
@ -229,7 +229,7 @@ called after each row has been read, which you can use to control
a progress meter or the like. It's demonstrated in pngtest.c.
You must supply a function
void read_row_callback(png_ptr, png_uint_32 row, int pass);
void read_row_callback(png_ptr ptr, png_uint_32 row, int pass);
{
/* put your code here */
}
@ -1322,10 +1322,10 @@ Some of the more important parts of the png_info are:
Color Consortium
(http://www.color.org).
It can be one of
PNG_SRGB_INTENT_SATURATION,
PNG_SRGB_INTENT_PERCEPTUAL,
PNG_SRGB_INTENT_ABSOLUTE, or
PNG_SRGB_INTENT_RELATIVE.
PNG_sRGB_INTENT_SATURATION,
PNG_sRGB_INTENT_PERCEPTUAL,
PNG_sRGB_INTENT_ABSOLUTE, or
PNG_sRGB_INTENT_RELATIVE.
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr,
@ -1489,6 +1489,14 @@ image data. You do this with a call to png_write_info().
png_write_info(png_ptr, info_ptr);
If you need to write a private chunk that you want to appear before
the PLTE chunk when PLTE is present, you can write the PNG info in
two steps, and insert code to write your own chunk between them:
png_write_info_before_PLTE(png_ptr, info_ptr);
write_my_private_chunks();
png_write_info(png_ptr, info_ptr);
After you've written the file information, you can set up the library
to handle any special transformations of the image data. The various
ways to transform the data will be described in the order that they
@ -2058,13 +2066,13 @@ the old method.
VII. Y2K Compliance in libpng
October 23, 1999
November 27, 1999
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.5a are Y2K compliant. It is my belief that earlier
upward through 1.0.5c are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 October 23, 1999
.TH LIBPNGPF 3 November 27, 1999
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23, 1999
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5c - November 27, 1999
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "October 23, 1999"
.TH PNG 5 "November 27, 1999"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

67
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* libpng version 1.0.5a - October 23, 1999
* libpng version 1.0.5c - November 27, 1999
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999 Glenn Randers-Pehrson
@ -12,16 +12,21 @@
#define PNG_NO_EXTERN
#include "png.h"
PNG_GET_HEADER
/* Version information for C files. This had better match the version
* string defined in png.h.
*/
char png_libpng_ver[12] = "1.0.5a";
#ifdef PNG_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
char png_libpng_ver[12] = "1.0.5c";
/* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
/* This was moved to pngtypes.h and other places in version 1.0.5c.
* It was nicer having them all in one place, but it interfered with
* people building DLL's. */
/* Constant strings for known chunk types. If you need to add a chunk,
* add a string holding the name here. If you want to make the code
@ -75,6 +80,8 @@ int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
/* Mask to determine which pixels to overwrite while displaying */
int FARDATA png_pass_dsp_mask[] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
#endif
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
* stream we can set num_bytes = 8 so that libpng will not attempt to read
@ -102,6 +109,7 @@ png_set_sig_bytes(png_structp png_ptr, int num_bytes)
int
png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
{
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
if (num_to_check > 8)
num_to_check = 8;
else if (num_to_check < 1)
@ -113,7 +121,7 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
if (start + num_to_check > 8)
num_to_check = 8 - start;
return ((int)(png_memcmp(&sig[start], &png_sig[start], num_to_check)));
return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
}
/* (Obsolete) function to check signature bytes. It does not allow one
@ -356,22 +364,65 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
}
#endif /* PNG_TIME_RFC1123_SUPPORTED */
/* Signature string for a PNG file. */
png_bytep
png_sig_bytes(png_structp png_ptr)
{
const png_byte png_sig_numbers[9] = {137, 80, 78, 71, 13, 10, 26, 10, 0};
if (png_ptr == NULL) /* silence compiler warning */
return ((png_bytep) strdup(png_sig_numbers));
return ((png_bytep) strdup(png_sig_numbers));
}
png_charp
png_get_copyright(png_structp png_ptr)
{
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
return ("\n libpng version 1.0.5a - October 23, 1999\n\
return ("\n libpng version 1.0.5c - November 27, 1999\n\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\
Copyright (c) 1996, 1997 Andreas Dilger\n\
Copyright (c) 1998, 1999 Glenn Randers-Pehrson\n");
return ("");
}
/* The following return the library version as a short string in the
* format 1.0.0 through 99.99.99zz. To get the version of *.h files used
* with your application, print out PNG_LIBPNG_VER_STRING, which is defined
* in png.h.
*/
png_charp
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return("1.0.5c");
return("1.0.5c");
}
png_charp
png_get_header_ver(png_structp png_ptr)
{
/* Version of *.h files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return(PNG_LIBPNG_VER_STRING);
return(PNG_LIBPNG_VER_STRING);
}
png_charp
png_get_header_version(png_structp png_ptr)
{
/* Returns longer string containing both version and date */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return(PNG_HEADER_VERSION_STRING);
return(PNG_HEADER_VERSION_STRING);
}
/* Generate a compiler error if there is an old png.h in the search path. */
void
png_check_version
(version_1_0_5a png_h_is_not_version_1_0_5a)
(version_1_0_5c png_h_is_not_version_1_0_5c)
{
if(png_h_is_not_version_1_0_5a == NULL)
if(png_h_is_not_version_1_0_5c == NULL)
return;
}

86
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.0.5a - October 23, 1999
* libpng version 1.0.5c - November 27, 1999
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999 Glenn Randers-Pehrson
@ -9,19 +9,19 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.89c, May 1996: Guy Schalnat
* libpng versions 0.90, December 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.5a - October 23, 1999: Glenn
* libpng versions 0.97, January 1998, through 1.0.5c - November 27, 1999: Glenn
* See also "Contributing Authors", below.
*
* Y2K compliance in libpng:
* =========================
*
* October 23, 1999
* November 27, 1999
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.0.5a are Y2K compliant. It is my belief that earlier
* upward through 1.0.5c are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@ -97,7 +97,7 @@
* 1.0.4 1.0.4 10004 2.1.0.4
* 1.0.4a-f 1.0.4a-f 10005 2.1.0.4a-f
* 1.0.5 1.0.5 10005 2.1.0.5
* 1.0.5a 1.0.5a 10006 2.1.0.5a
* 1.0.5a-d 1.0.5a-d 10006 2.1.0.5a-d
* 1.0.6 1.0.6 10006 2.1.0.6
*
* Henceforth the source version will match the shared-library minor
@ -122,7 +122,7 @@
* Copyright (c) 1996, 1997 Andreas Dilger
* (libpng versions 0.90, December 1996, through 0.96, May 1997)
* Copyright (c) 1998, 1999 Glenn Randers-Pehrson
* (libpng versions 0.97, January 1998, through 1.0.5a, October 23, 1999)
* (libpng versions 0.97, January 1998, through 1.0.5c, November 27, 1999)
*
* For the purposes of this copyright and license, "Contributing Authors"
* is defined as the following set of individuals:
@ -222,7 +222,7 @@ extern "C" {
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.5a"
#define PNG_LIBPNG_VER_STRING "1.0.5c"
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
@ -238,8 +238,14 @@ extern "C" {
/* Version information for C files, stored in png.c. This had better match
* the version above.
*/
#ifdef PNG_GLOBAL_ARRAYS
extern char png_libpng_ver[12]; /* need room for 99.99.99aa */
#else
#define png_libpng_ver png_get_header_ver(NULL)
#endif
#ifdef PNG_GLOBAL_ARRAYS
/* This was removed in version 1.0.5c */
/* Structures to facilitate easy interlacing. See png.c for more details */
extern int FARDATA png_pass_start[7];
extern int FARDATA png_pass_inc[7];
@ -251,6 +257,7 @@ extern int FARDATA png_pass_dsp_mask[7];
extern int FARDATA png_pass_width[7];
extern int FARDATA png_pass_height[7];
*/
#endif
#endif /* PNG_NO_EXTERN */
@ -559,10 +566,10 @@ typedef png_info FAR * FAR * png_infopp;
#define PNG_RESOLUTION_LAST 2 /* Not a valid value */
/* These are for the sRGB chunk. These values should NOT be changed. */
#define PNG_sRGB_INTENT_SATURATION 0
#define PNG_sRGB_INTENT_PERCEPTUAL 1
#define PNG_sRGB_INTENT_ABSOLUTE 2
#define PNG_sRGB_INTENT_RELATIVE 3
#define PNG_sRGB_INTENT_PERCEPTUAL 0
#define PNG_sRGB_INTENT_RELATIVE 1
#define PNG_sRGB_INTENT_SATURATION 2
#define PNG_sRGB_INTENT_ABSOLUTE 3
#define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */
@ -820,9 +827,9 @@ struct png_struct_def
};
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
and png.h are both at * version 1.0.5a
and png.h are both at * version 1.0.5c
*/
typedef png_structp version_1_0_5a;
typedef png_structp version_1_0_5c;
typedef png_struct FAR * FAR * png_structpp;
@ -895,6 +902,8 @@ extern PNG_EXPORT(png_infop,png_create_info_struct)
extern void png_info_init PNGARG((png_infop info_ptr));
/* Writes all the PNG information before the image. */
extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
png_infop info_ptr));
extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
@ -1633,21 +1642,14 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
#define png_debug2(l, m, p1, p2)
#endif
extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
#ifdef PNG_NO_EXTERN
/* this only gets included in png.c */
#define PNG_GET_HEADER \
png_charp \
png_get_header_version(png_structp png_ptr) \
{ \
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ \
return("\n libpng version 1.0.5a - October 23, 1999 (header)\n"); \
return("\n libpng version 1.0.5a - October 23, 1999 (header)\n"); \
}
#endif
#define PNG_HEADER_VERSION_STRING " libpng version 1.0.5c - November 27, 1999 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on
@ -1701,15 +1703,19 @@ png_get_header_version(png_structp png_ptr) \
/* Various modes of operation. Note that after an init, mode is set to
* zero automatically when the structure is created.
*/
#define PNG_BEFORE_IHDR 0x00
#define PNG_HAVE_IHDR 0x01
#define PNG_HAVE_PLTE 0x02
#define PNG_HAVE_IDAT 0x04
#define PNG_AFTER_IDAT 0x08
#define PNG_HAVE_IEND 0x10
#define PNG_HAVE_gAMA 0x20
#define PNG_HAVE_cHRM 0x40
#define PNG_HAVE_sRGB 0x80
#define PNG_BEFORE_IHDR 0x00
#define PNG_HAVE_IHDR 0x01
#define PNG_HAVE_PLTE 0x02
#define PNG_HAVE_IDAT 0x04
#define PNG_AFTER_IDAT 0x08
#define PNG_HAVE_IEND 0x10
#define PNG_HAVE_gAMA 0x20
#define PNG_HAVE_cHRM 0x40
#define PNG_HAVE_sRGB 0x80
#define PNG_HAVE_CHUNK_HEADER 0x100
#define PNG_WROTE_tIME 0x200
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
#define PNG_BACKGROUND_IS_GRAY 0x800
/* push model modes */
#define PNG_READ_SIG_MODE 0
@ -1773,9 +1779,7 @@ png_get_header_version(png_structp png_ptr) \
#define PNG_FLAG_FREE_PALETTE 0x1000
#define PNG_FLAG_FREE_TRANS 0x2000
#define PNG_FLAG_FREE_HIST 0x4000
#define PNG_FLAG_HAVE_CHUNK_HEADER 0x8000L
#define PNG_FLAG_WROTE_tIME 0x10000L
#define PNG_FLAG_BACKGROUND_IS_GRAY 0x20000L
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
PNG_FLAG_CRC_ANCILLARY_NOWARN)
@ -1794,8 +1798,13 @@ png_get_header_version(png_structp png_ptr) \
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
/* place to hold the signature string for a PNG file. */
extern png_byte FARDATA png_sig[8];
#ifdef PNG_GLOBAL_ARRAYS
extern png_byte FARDATA png_sig[8];
#else
#define png_sig png_sig_bytes(NULL)
#endif
#ifdef PNG_GLOBAL_ARRAYS
/* Constant strings for known chunk types. If you need to add a chunk,
* add a string holding the name here. See png.c for more details. We
* can't selectively include these, since we still check for chunk in the
@ -1818,6 +1827,7 @@ extern png_byte FARDATA png_tEXt[5];
extern png_byte FARDATA png_tIME[5];
extern png_byte FARDATA png_tRNS[5];
extern png_byte FARDATA png_zTXt[5];
#endif /* PNG_GLOBAL_ARRAYS */
#endif /* PNG_NO_EXTERN */

View File

@ -1,6 +1,6 @@
/* pngasmrd.h - assembler version of utilities to read a PNG file
*
* libpng 1.0.5a - October 23, 1999
* libpng 1.0.5c - November 27, 1999
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1999 Glenn Randers-Pehrson
*
@ -21,7 +21,7 @@
/* Set this in the makefile for gcc on Pentium, not in pngconf.h */
#ifdef PNG_USE_PNGGCCRD
/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c
* (not available in libpng 1.0.5a).
* (not available in libpng 1.0.5c).
* MMX will be detected at run time and used if present.
*/
#define PNG_HAVE_ASSEMBLER_COMBINE_ROW

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng 1.0.5a - October 23, 1999
* libpng 1.0.5c - November 27, 1999
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
@ -418,6 +418,14 @@ __dont__ include it again
#define PNG_ASSEMBLER_CODE_SUPPORTED
#endif
/* Do not use global arrays (helps with building DLL's)
* They are no longer used in libpng itself, since version 1.0.5c,
* but might be required for some pre-1.0.5c applications.
*/
#ifndef PNG_NO_GLOBAL_ARRAYS
#define PNG_GLOBAL_ARRAYS
#endif
/* These are currently experimental features, define them if you want */
/* very little testing */

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* libpng 1.0.5a - October 23, 1999
* libpng 1.0.5c - November 27, 1999
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* libpng 1.0.5a - October 23, 1999
* libpng 1.0.5c - November 27, 1999
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* libpng 1.0.5a - October 23, 1999
* libpng 1.0.5c - November 27, 1999
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* libpng 1.0.5a - October 23, 1999
* libpng 1.0.5c - November 27, 1999
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
@ -116,13 +116,14 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
void
png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
{
#include "pngtypes.h"
/* First we make sure we have enough data for the 4 byte chunk name
* and the 4 byte chunk length before proceeding with decoding the
* chunk data. To fully decode each of these chunks, we also make
* sure we have enough data in the buffer for the 4 byte CRC at the
* end of every chunk (except IDAT, which is handled separately).
*/
if (!(png_ptr->flags & PNG_FLAG_HAVE_CHUNK_HEADER))
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
{
png_byte chunk_length[4];
@ -136,7 +137,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_ptr->push_length = png_get_uint_32(chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_ptr->flags |= PNG_FLAG_HAVE_CHUNK_HEADER;
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
}
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
@ -159,7 +160,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
}
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
{
/* If we reach an IDAT chunk, this means we have read all of the
* header chunks, and we can start reading the image (or if this
@ -343,7 +344,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
}
png_ptr->flags &= ~PNG_FLAG_HAVE_CHUNK_HEADER;
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
}
void
@ -496,7 +497,8 @@ png_push_restore_buffer(png_structp png_ptr, png_bytep buffer,
void
png_push_read_IDAT(png_structp png_ptr)
{
if (!(png_ptr->flags & PNG_FLAG_HAVE_CHUNK_HEADER))
const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'};
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
{
png_byte chunk_length[4];
@ -511,9 +513,9 @@ png_push_read_IDAT(png_structp png_ptr)
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_ptr->flags |= PNG_FLAG_HAVE_CHUNK_HEADER;
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
{
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
@ -576,7 +578,7 @@ png_push_read_IDAT(png_structp png_ptr)
}
png_crc_finish(png_ptr, 0);
png_ptr->flags &= ~PNG_FLAG_HAVE_CHUNK_HEADER;
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
}
}
@ -767,6 +769,30 @@ png_push_process_row(png_structp png_ptr)
void
png_read_push_finish_row(png_structp png_ptr)
{
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
const int png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
/* offset to next interlace block */
const int png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
/* start of interlace block in the y direction */
const int png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
/* offset to next interlace block in the y direction */
const int png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
/* Width of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h
const int png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
*/
/* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h
const int png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/
png_ptr->row_number++;
if (png_ptr->row_number < png_ptr->num_rows)
return;
@ -1115,6 +1141,7 @@ void
png_progressive_combine_row (png_structp png_ptr,
png_bytep old_row, png_bytep new_row)
{
const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */
png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
}

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* libpng 1.0.5a - October 23, 1999
* libpng 1.0.5c - November 27, 1999
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
@ -156,6 +156,7 @@ png_read_init(png_structp png_ptr)
void
png_read_info(png_structp png_ptr, png_infop info_ptr)
{
#include "pngtypes.h"
png_debug(1, "in png_read_info\n");
/* save jump buffer and error functions */
/* If we haven't checked all of the PNG signature bytes, do so now. */
@ -297,6 +298,9 @@ png_start_read_image(png_structp png_ptr)
void
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{
const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'};
const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
int ret;
png_debug2(1, "in png_read_row (row %d, pass %d)\n",
png_ptr->row_number, png_ptr->pass);
@ -529,7 +533,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
* not called png_set_interlace_handling(), the display_row buffer will
* be ignored, so pass NULL to it.
*
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.5a.
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.5c.
*/
void
@ -578,7 +582,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
* only call this function once. If you desire to have an image for
* each