Imported from libpng-1.0.6g.tar

This commit is contained in:
Glenn Randers-Pehrson 2000-04-23 23:14:02 -05:00
parent 4accabb590
commit 228bd390ac
47 changed files with 571 additions and 369 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.0.6f - April 14, 2000
Libpng 1.0.6g - April 24, 2000
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.
@ -15,7 +15,7 @@ version 1.0.6d [April 8, 2000]
Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file
Added a check for info_ptr->free_me&PNG_FREE_TEXT when free'ing text in png.c
Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
version 1.0.6f [April 14, 2000]
version 1.0.6e [April 9, 2000]
Added png_data_freer() function.
In the code that checks for over-length tRNS chunks, added check of
info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)
@ -26,11 +26,20 @@ version 1.0.6f [April 14, 2000]
is defined.
Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c
and mentioned the purposes of the two macros in libpng.txt/libpng.3.
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
Glenn R-P
version 1.0.6f [April 14, 2000]
Revised png_set_iCCP() and png_set_rows() to avoid prematurely freeing data.
Add checks in png_set_text() for NULL members of the input text structure.
Revised libpng.txt/libpng.3.
Removed superfluous prototype for png_set_itxt from png.h
Removed "else" from pngread.c, after png_error(), and changed "0" to "length".
Changed several png_errors about malformed ancillary chunks to png_warnings.
version 1.0.6g [April 24, 2000]
Added png_pass-* arrays to pnggccrd.c when PNG_USE_LOCAL_ARRAYS is defined.
Relocated paragraph about png_set_background() in libpng.3/libpng.txt
and other revisions (Matthias Benckmann)
Relocated info_ptr->free_me, png_ptr->free_me, and other info_ptr and
png_ptr members to restore binary compatibility with libpng-1.0.5
(breaks compatibility with libpng-1.0.6).
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

View File

@ -123,6 +123,7 @@ version 0.90 [January, 1997]
- all chunk handling routines have the same prototypes, so we will
be able to handle all chunks via a callback mechanism
try to fix Linux "setjmp" buffer size problems
removed png_large_malloc, png_large_free, and png_realloc functions.
version 0.95 [March, 1997]
fixed bug in pngwutil.c allocating "up_row" twice and "avg_row" never
fixed bug in PNG file signature compares when start != 0
@ -259,6 +260,7 @@ version 0.99h [March 6, 1998, evening]
Minor changes to previous minor changes to pngtest.c
Changed PNG_READ_NOT_FULLY_SUPPORTED to PNG_READ_TRANSFORMS_NOT_SUPPORTED
and added PNG_PROGRESSIVE_READ_NOT_SUPPORTED macro
Added user transform capability
version 1.00 [March 7, 1998]
Changed several typedefs in pngrutil.c
Added makefile.wat (Pawel Mrochen), updated makefile.tc3 (Willem van Schaik)
@ -687,6 +689,13 @@ version 1.0.6f [April 14, 2000]
Removed superfluous prototype for png_set_itxt from png.h
Removed "else" from pngread.c, after png_error(), and changed "0" to "length".
Changed several png_errors about malformed ancillary chunks to png_warnings.
version 1.0.6g [April 24, 2000]
Added png_pass-* arrays to pnggccrd.c when PNG_USE_LOCAL_ARRAYS is defined.
Relocated paragraph about png_set_background() in libpng.3/libpng.txt
and other revisions (Matthias Benckmann)
Relocated info_ptr->free_me, png_ptr->free_me, and other info_ptr and
png_ptr members to restore binary compatibility with libpng-1.0.5
(breaks compatibility with libpng-1.0.6).
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

12
INSTALL
View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.6f - April 14, 2000
Installing libpng version 1.0.6g - April 24, 2000
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.6f" or "lpng106" and "zlib-1.1.3"
might be called "libpng-1.0.6g" or "lpng106" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@ -47,8 +47,8 @@ The files that are presently available in the scripts directory
include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6f)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6f,
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6g)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6g,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@ -59,9 +59,9 @@ include
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6f)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6g)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6f)
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6g)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

View File

@ -1,47 +1,61 @@
Known bugs and suggested enhancements in libpng-1.0.6
1. April 1, 2000 -- BUG
1. April 23, 2000 -- BUG -- binary incompatibility
Libpng-1.0.6 introduced binary incompatibility for applications that
make direct access to the info_ptr and png_ptr, due to the insertion
of the free_me member ahead of some previously existing members.
STATUS: Fixed in libpng-1.0.6g
2. April 15, 2000 -- BUG -- pnggccrd.c
If PNG_NO_GLOBAL_ARRAYS is defined, pnggccrd.c will not compile.
STATUS: Fixed in libpng-1.0.6g
3. April 1, 2000 -- BUG
Under some circumstances old applications that make direct access to
the info_ptr->text and its members might free the same memory that
is also free'ed by libpng during the png_destroy_struct process.
Fixed in libpng-1.0.6-patch-03 and libpng-1.0.6d. The PNG_FREE_TEXT flag
Fixed in libpng-1.0.6-patch-c and libpng-1.0.6d. The PNG_FREE_TEXT flag
bit in info_ptr->free_me is now checked to make sure libpng is responsible
for freeing the memory.
2. April 1, 2000 -- BUG
4. April 1, 2000 -- BUG
The non-ISO-C "strdup()" function is used in png.c
STATUS: The function has been simplified and no longer uses strdup()
in libpng-1.0.6-patch-03 and libpng-1.0.6d.
in libpng-1.0.6-patch-c and libpng-1.0.6d.
3. March 24, 2000 -- BUG
5. March 24, 2000 -- BUG
The png_set_rgb_to_gray_fixed() function is setting incorrect weighting
factors.
STATUS: Fixed in libpng-1.0.6-patch-02 and libpng-1.0.6d.
STATUS: Fixed in libpng-1.0.6-patch-b and libpng-1.0.6d.
4. March 22, 2000 -- BUG
6. March 22, 2000 -- BUG
There are some printf() and fprintf() statements active in pngwutil.c
when PNG_NO_STDIO and PNG_sCAL_SUPPORTED are both defined.
STATUS: Fixed in libpng-1.0.6-patch-01 and libpng-1.0.6d. The strcpy()
STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d. The strcpy()
function is used instead.
5. March 22, 2000 -- BUG
7. March 22, 2000 -- BUG
The length of the iCCP chunk data is calculated incorrectly; because
it can contain zeroes, strlen() doesn't work.
STATUS: Fixed in libpng-1.0.6-patch-01 and libpng-1.0.6d by adding a
STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d by adding a
data_length parameter to the png_decompress_chunk() function.
6. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
8. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
Loops need to be optimized everywhere
@ -56,7 +70,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
libpng-1.1.0. About 160 loops will be turned around
in libpng-1.1.Nn, for testing.
7. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
9. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
libpng-1.0.5 and earlier transform colors to gamma=1.0 space for
merging with background, and then back to the image's gamma. The
@ -68,7 +82,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
STATUS: under development.
8. September 1999 -- ENHANCEMENT --
10. September 1999 -- ENHANCEMENT --
It should be possible to use libpng without floating-point aritmetic.

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, 2000 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000)
(libpng versions 0.97, January 1998, through 1.0.6g, April 24, 2000)
For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals:
@ -68,4 +68,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
randeg@alum.rpi.edu
April 14, 2000
April 24, 2000

10
README
View File

@ -1,4 +1,4 @@
README for libpng 1.0.6f - April 14, 2000 (shared library 2.1)
README for libpng 1.0.6g - April 24, 2000 (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.
@ -172,9 +172,9 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.6f)
(gcc, creates libpng.so.2.1.0.6g)
makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng.so.2.1.0.6f, uses assembler code
libpng.so.2.1.0.6g, uses assembler code
tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@ -185,10 +185,10 @@ Files in this distribution:
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6f)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6g)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.6f)
(gcc, creates libpng.so.2.1.0.6g)
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:
=========================
April 14, 2000
April 24, 2000
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.6f are Y2K compliant. It is my belief that earlier
upward through 1.0.6g 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

2
configure vendored
View File

@ -1,5 +1,5 @@
echo "
There is no \"configure\" script for Libpng-1.0.6f. Instead, please
There is no \"configure\" script for Libpng-1.0.6g. Instead, please
copy the appropriate makefile for your system from the \"scripts\"
directory. Read the INSTALL file for more details.
"

View File

@ -1,104 +0,0 @@
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
# Greg Roelofs
# Last modified: 28 February 2000
#
# The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Buy some for friends
# and family, too. (Not that this is a blatant plug or anything.)
#
# Invoke this makefile from a shell prompt in the usual way; for example:
#
# make -f Makefile.unx
#
# This makefile assumes libpng and zlib have already been built or downloaded
# and are both installed in /usr/local/{include,lib} (as indicated by the
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of
# the PNGINC, PNGLIB, ZINC and ZLIB lines.
#
# This makefile builds statically linked executables (against libpng and zlib,
# that is), but that can be changed by uncommenting the appropriate PNGLIB and
# ZLIB lines.
# macros --------------------------------------------------------------------
PNGINC = -I/usr/local/include
#PNGLIB = -L/usr/local/lib -lpng # dynamically linked against libpng
PNGLIB = /usr/local/lib/libpng.a # statically linked against libpng
# or:
#PNGINC = -I../..
#PNGLIB = -L../.. -lpng
#PNGLIB = ../../libpng.a
ZINC = -I/usr/local/include
#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
ZLIB = /usr/local/lib/libz.a # statically linked against zlib
#ZINC = -I../zlib
#ZLIB = -L../zlib -lz
#ZLIB = ../../../zlib/libz.a
XINC = -I/usr/include/X11 # old-style, stock X distributions
XLIB = -L/usr/lib/X11 -lX11
#XINC = -I/usr/openwin/include/X11 # Sun workstations (OpenWindows)
#XLIB = -L/usr/openwin/lib -lX11
#XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
#XLIB = -L/usr/X11R6/lib -lX11
INCS = $(PNGINC) $(ZINC) $(XINC)
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
WLIBS = $(PNGLIB) $(ZLIB)
CC = cc -n32
LD = cc -n32
RM = rm -f
CFLAGS = -O -fullwarn $(INCS)
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used]
LDFLAGS =
O = .o
E =
RPNG = rpng-x
RPNG2 = rpng2-x
WPNG = wpng
ROBJS = $(RPNG)$(O) readpng$(O)
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
WOBJS = $(WPNG)$(O) writepng$(O)
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
# implicit make rules -------------------------------------------------------
.c$(O):
$(CC) -c $(CFLAGS) $<
# dependencies --------------------------------------------------------------
all: $(EXES)
$(RPNG)$(E): $(ROBJS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
$(RPNG2)$(E): $(ROBJS2)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
$(WPNG)$(E): $(WOBJS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS)
$(RPNG)$(O): $(RPNG).c readpng.h
$(RPNG2)$(O): $(RPNG2).c readpng2.h
$(WPNG)$(O): $(WPNG).c writepng.h
readpng$(O): readpng.c readpng.h
readpng2$(O): readpng2.c readpng2.h
writepng$(O): writepng.c writepng.h
# maintenance ---------------------------------------------------------------
clean:
$(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,52 +0,0 @@
# Makefile for PngMinus (png2pnm and pnm2png)
# Linux / Unix
CC=cc -O -n32
LD=cc -O -n32
#CC=gcc -O
#LD=gcc -O
LB=ar
RM=rm
CP=cp
PNGPATH = /usr/local
PNGINC = $(PNGPATH)/include
PNGLIB = $(PNGPATH)/lib -lpng
# PNGLIB = $(PNGPATH)/libpng.a
ZPATH = /usr/local
ZINC = $(ZPATH)/include
ZLIB = $(ZPATH)/lib -lz
# ZLIB = $(ZPATH)/libz.a
CCFLAGS=-I$(PNGINC) -I$(ZINC)
LDFLAGS=-L$(PNGLIB) -L$(ZLIB) -lm
C=.c
O=.o
L=.a
E=
# dependencies
all: png2pnm$(E) pnm2png$(E)
png2pnm$(O): png2pnm$(C)
$(CC) -c $(CCFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O)
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS)
pnm2png$(O): pnm2png$(C)
$(CC) -c $(CCFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O)
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS)
clean:
$(RM) png2pnm$(O)
$(RM) pnm2png$(O)
$(RM) png2pnm$(E)
$(RM) pnm2png$(E)
# End of makefile for png2pnm / pnm2png

137
libpng.3
View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "April 14, 2000"
.TH LIBPNG 3 "April 24, 2000"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6g
.SH SYNOPSIS
\fI\fB
@ -234,7 +234,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f
\fI\fB
\fBpng_uint_32 png_get_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fP\fI*splt_ptr\fP\fB, int \fInum\fP\fB);\fP
\fBpng_uint_32 png_get_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fI*splt_ptr\fP\fB);\fP
\fI\fB
@ -294,6 +294,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f
\fI\fB
\fBpng_uint_32 png_get_compression_buffer_size (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_info_init (png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
@ -614,6 +618,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f
\fI\fB
\fBvoid png_set_unknown_chunk_location(png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fP\fIchunk\fP\fB, int \fIlocation\fP\fB);\fP
\fI\fB
\fBvoid png_set_read_user_chunk_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIuser_chunk_ptr\fP\fB, png_user_chunk_ptr \fIread_user_chunk_fn\fP\fB);\fP
\fI\fB
@ -634,6 +642,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f
\fI\fB
\fBvoid png_set_compression_buffer_size(png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIsize\fP\fB);\fP
\fI\fB
\fBint png_sig_cmp (png_bytep \fP\fIsig\fP\fB, png_size_t \fP\fIstart\fP\fB, png_size_t \fInum_to_check\fP\fB);\fP
\fI\fB
@ -713,7 +725,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.6f - April 14, 2000
libpng version 1.0.6g - April 24, 2000
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -1393,8 +1405,8 @@ transparency information in a tRNS chunk. This is most useful on
grayscale images with bit depths of 2 or 4 or if there is a multiple-image
viewing application that wishes to treat all images in the same way.
if (color_type == PNG_COLOR_TYPE_PALETTE &&
bit_depth <= 8) png_set_palette_to_rgb(png_ptr);
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY &&
bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
@ -1413,17 +1425,6 @@ PNG can have files with 16 bits per channel. If you only can handle
if (bit_depth == 16)
png_set_strip_16(png_ptr);
The png_set_background() function tells libpng to composite images
with alpha or simple transparency against the supplied background
color. If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid),
you may use this color, or supply another color more suitable for
the current display (e.g., the background color from a web page). You
need to tell libpng whether the color is in the gamma space of the
display (PNG_BACKGROUND_GAMMA_SCREEN for colors you supply), the file
(PNG_BACKGROUND_GAMMA_FILE for colors from the bKGD chunk), or one
that is neither of these gammas (PNG_BACKGROUND_GAMMA_UNIQUE - I don't
know why anyone would use this, but it's here).
If, for some reason, you don't need the alpha channel on an image,
and you want to remove it rather than combining it with the background
(but the image author certainly had in mind that you *would* combine
@ -1567,6 +1568,17 @@ or as an RGB triplet that may or may not be in the palette (need_expand = 0).
png_set_background(png_ptr, &my_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
The png_set_background() function tells libpng to composite images
with alpha or simple transparency against the supplied background
color. If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid),
you may use this color, or supply another color more suitable for
the current display (e.g., the background color from a web page). You
need to tell libpng whether the color is in the gamma space of the
display (PNG_BACKGROUND_GAMMA_SCREEN for colors you supply), the file
(PNG_BACKGROUND_GAMMA_FILE for colors from the bKGD chunk), or one
that is neither of these gammas (PNG_BACKGROUND_GAMMA_UNIQUE - I don't
know why anyone would use this, but it's here).
To properly display PNG images on any kind of system, the application needs
to know what the display gamma is. Ideally, the user will know this, and
the application will allow them to set it. One method of allowing the user
@ -1763,7 +1775,7 @@ If you are doing this just one row at a time, you can do this with
a single row_pointer instead of an array of row_pointers:
png_bytep row_pointer = row;
png_read_row(png_ptr, row_pointers, NULL);
png_read_row(png_ptr, row_pointer, NULL);
If the file is interlaced (interlace_type != 0 in the IHDR chunk), things
get somewhat harder. The only current (PNG Specification version 1.2)
@ -2182,21 +2194,33 @@ speed/compression ratio. The second parameter to png_set_filter() is
the filter method, for which the only valid value is '0' (as of the
July 1999 PNG specification, version 1.2). The third parameter is a
flag that indicates which filter type(s) are to be tested for each
scanline. See the Compression Library for details on the specific filter
scanline. See the PNG specification for details on the specific filter
types.
/* turn on or off filtering, and/or choose
specific filters */
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
or the "OR" of one or more PNG_FILTER_NAME masks. */
png_set_filter(png_ptr, 0,
PNG_FILTER_NONE | PNG_FILTER_SUB |
PNG_FILTER_PAETH);
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
PNG_FILTER_AVE | PNG_FILTER_VALUE_AVE |
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
PNG_ALL_FILTERS);
If an application
wants to start and stop using particular filters during compression,
it should start out with all of the filters (to ensure that the previous
row of pixels will be stored in case it's needed later), and then add
and remove them after the start of compression.
The png_set_compression_*() functions interface to the zlib compression
library, and should mostly be ignored unless you really know what you are
doing. The only generally useful call is png_set_compression_level()
which changes how much time zlib spends on trying to compress the image
data. See the Compression Library for details on the compression levels.
data. See the Compression Library (zlib.h and algorithm.txt, distributed
with zlib) for details on the compression levels.
/* set the zlib compression level */
png_set_compression_level(png_ptr,
@ -2208,6 +2232,9 @@ data. See the Compression Library for details on the compression levels.
Z_DEFAULT_STRATEGY);
png_set_compression_window_bits(png_ptr, 15);
png_set_compression_method(png_ptr, 8);
png_set_compression_buffer_size(png_ptr, 8192)
extern PNG_EXPORT(void,png_set_zbuf_size)
.SS Setting the contents of info for output
@ -2416,18 +2443,17 @@ Some of the more important parts of the png_info are:
A quick word about text and num_text. text is an array of png_text
structures. num_text is the number of valid structures in the array.
If you want, you can use max_text to hold the size of the array, but
libpng ignores it for writing (it does use it for reading). Each
png_text structure holds a language code, a keyword, a text value, and
a compression type.
Each png_text structure holds a language code, a keyword, a text value,
and a compression type.
The compression types have the same valid numbers as the compression
types of the image data. Currently, the only valid number is zero.
However, you can store text either compressed or uncompressed, unlike
images, which always have to be compressed. So if you don't want the
text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE.
Because compressed-text chunks don't have a language field, if you
specify compression any language code will not be written out.
Because tEXt and zTXt chunks don't have a language field, if you
specify PNG_TEXT_COMPRESSION_NONE or PNG_TEXT_COMPRESSION_zTXt
any language code or translated keyword will not be written out.
Until text gets around 1000 bytes, it is not worth compressing it.
After the text has been written out to the file, the compression type
@ -2587,8 +2613,8 @@ bytes per pixel).
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
where the 0 is unused, and the location is either PNG_FILLER_BEFORE or
PNG_FILLER_AFTER, depending upon whether the filler byte in the is stored
XRGB or RGBX.
PNG_FILLER_AFTER, depending upon whether the filler byte in the pixel
is stored XRGB or RGBX.
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
they can, resulting in, for example, 8 pixels per byte for 1 bit files.
@ -2599,7 +2625,7 @@ correctly pack the pixels into a single byte:
PNG files reduce possible bit depths to 1, 2, 4, 8, and 16. If your
data is of another bit depth, you can write an sBIT chunk into the
file so that decoders can get the original data if desired.
file so that decoders can recover the original data if desired.
/* Set the true bit depth of the image data */
if (color_type & PNG_COLOR_MASK_COLOR)
@ -2674,8 +2700,8 @@ callback function.
The user_channels and user_depth parameters of this function are ignored
when writing; you can set them to zero as shown.
You can retrieve the pointer via the function
png_get_user_transform_ptr(). For example:
You can retrieve the pointer via the function png_get_user_transform_ptr().
For example:
voidp write_user_transform_ptr =
png_get_user_transform_ptr(png_ptr);
@ -2737,7 +2763,7 @@ a single row_pointer instead of an array of row_pointers:
png_write_row(png_ptr, row_pointer);
When the file is interlaced, things can get a good deal more
complicated. The only currently (as of January 2000 -- PNG Specification
complicated. The only currently (as of the PNG Specification
version 1.2, dated July 1999) defined interlacing scheme for PNG files
is the "Adam7" interlace scheme, that breaks down an
image into seven smaller images of varying size. libpng will build
@ -2828,7 +2854,7 @@ to a write structure, you could use
PNG_DESTROY_WILL_FREE_DATA,
PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
Thereby briefly reassigning responsibility for freeing to the user but
thereby briefly reassigning responsibility for freeing to the user but
immediately afterwards reassigning it once more to the write_destroy
function. Having done this, it would then be safe to destroy the read
structure and continue to use the PLTE, tRNS, and hIST data in the write
@ -2845,13 +2871,11 @@ adding new transformations, and generally changing how libpng works.
All of the memory allocation, input/output, and error handling in libpng
goes through callbacks that are user settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function.
Memory allocation is done through the functions png_large_malloc(),
png_malloc(), png_realloc(), png_large_free(), and png_free(). These
currently just call the standard C functions. The large functions must
handle exactly 64K, but they don't have to handle more than that. If
Memory allocation is done through the functions png_malloc() and png_free().
These currently just call the standard C functions. If
your pointers can't access more then 64K at a time, you will want to set
MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling
memory allocation on a platform will change between applications, these
@ -2904,8 +2928,8 @@ fprintf() unless the library is compiled with PNG_NO_CONSOLE_IO defined
fprintf() isn't available). If you wish to change the behavior of the error
functions, you will need to set up your own message callbacks. These
functions are normally supplied at the time that the png_struct is created.
It is also possible to change these functions after png_create_*_struct()
has been called by calling:
It is also possible to redirect errors and warnings to your own replacement
functions after png_create_*_struct() has been called by calling:
png_set_error_fn(png_structp png_ptr,
png_voidp error_ptr, png_error_ptr error_fn,
@ -2929,7 +2953,8 @@ as there is no need to check every return code of every function call.
However, there are some uncertainties about the status of local variables
after a longjmp, so the user may want to be careful about doing anything after
setjmp returns non-zero besides returning itself. Consult your compiler
documentation for more details.
documentation for more details. For an alternative approach, you may wish
to use the "cexcept" facility (see http://cexcept.sourceforge.net).
.SS Custom chunks
@ -2959,10 +2984,7 @@ can be found in the comments inside the code itself.
.SS Configuring for 16 bit platforms
You may need to change the png_large_malloc() and png_large_free()
routines in pngmem.c, as these are required to allocate 64K, although
there is already support for many of the common DOS compilers. Also,
you will want to look into zconf.h to tell zlib (and thus libpng) that
You will want to look into zconf.h to tell zlib (and thus libpng) that
it cannot allocate more then 64K at a time. Even if you can, the memory
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
@ -3031,6 +3053,7 @@ zlib.h for more information on what these mean.
png_set_compression_window_bits(png_ptr,
window_bits);
png_set_compression_method(png_ptr, method);
png_set_compression_buffer_size(png_ptr, size);
.SS Controlling row filtering
@ -3059,7 +3082,13 @@ you intend to use so that libpng can initialize its internal
structures appropriately for all of the filter types.
filters = PNG_FILTER_NONE | PNG_FILTER_SUB
| PNG_FILTER_UP;
PNG_FILTER_UP | PNG_FILTER_AVE |
PNG_FILTER_PAETH | PNG_ALL_FILTERS;
or
filters = one of PNG_FILTER_VALUE_NONE,
PNG_FILTER_VALUE_SUB, PNG_FILTER_VALUE_UP,
PNG_FILTER_VALUE_AVE, PNG_FILTER_VALUE_PAETH
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
filters);
@ -3108,7 +3137,7 @@ you can turn off individual capabilities with defines that begin with
PNG_NO_.
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do
@ -3208,13 +3237,13 @@ the old method.
.SH VII. Y2K Compliance in libpng
April 14, 2000
April 24, 2000
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.6f are Y2K compliant. It is my belief that earlier
upward through 1.0.6g 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
@ -3355,7 +3384,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.6f - April 14, 2000:
Libpng version 1.0.6g - April 24, 2000:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
@ -3370,7 +3399,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.89c, May 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000)
(libpng versions 0.97, January 1998, through 1.0.6g, April 24, 2000)
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.6f - April 14, 2000
libpng version 1.0.6g - April 24, 2000
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -680,8 +680,8 @@ transparency information in a tRNS chunk. This is most useful on
grayscale images with bit depths of 2 or 4 or if there is a multiple-image
viewing application that wishes to treat all images in the same way.
if (color_type == PNG_COLOR_TYPE_PALETTE &&
bit_depth <= 8) png_set_palette_to_rgb(png_ptr);
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY &&
bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
@ -700,17 +700,6 @@ PNG can have files with 16 bits per channel. If you only can handle
if (bit_depth == 16)
png_set_strip_16(png_ptr);
The png_set_background() function tells libpng to composite images
with alpha or simple transparency against the supplied background
color. If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid),
you may use this color, or supply another color more suitable for
the current display (e.g., the background color from a web page). You
need to tell libpng whether the color is in the gamma space of the
display (PNG_BACKGROUND_GAMMA_SCREEN for colors you supply), the file
(PNG_BACKGROUND_GAMMA_FILE for colors from the bKGD chunk), or one
that is neither of these gammas (PNG_BACKGROUND_GAMMA_UNIQUE - I don't
know why anyone would use this, but it's here).
If, for some reason, you don't need the alpha channel on an image,
and you want to remove it rather than combining it with the background
(but the image author certainly had in mind that you *would* combine
@ -854,6 +843,17 @@ or as an RGB triplet that may or may not be in the palette (need_expand = 0).
png_set_background(png_ptr, &my_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
The png_set_background() function tells libpng to composite images
with alpha or simple transparency against the supplied background
color. If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid),
you may use this color, or supply another color more suitable for
the current display (e.g., the background color from a web page). You
need to tell libpng whether the color is in the gamma space of the
display (PNG_BACKGROUND_GAMMA_SCREEN for colors you supply), the file
(PNG_BACKGROUND_GAMMA_FILE for colors from the bKGD chunk), or one
that is neither of these gammas (PNG_BACKGROUND_GAMMA_UNIQUE - I don't
know why anyone would use this, but it's here).
To properly display PNG images on any kind of system, the application needs
to know what the display gamma is. Ideally, the user will know this, and
the application will allow them to set it. One method of allowing the user
@ -1050,7 +1050,7 @@ If you are doing this just one row at a time, you can do this with
a single row_pointer instead of an array of row_pointers:
png_bytep row_pointer = row;
png_read_row(png_ptr, row_pointers, NULL);
png_read_row(png_ptr, row_pointer, NULL);
If the file is interlaced (interlace_type != 0 in the IHDR chunk), things
get somewhat harder. The only current (PNG Specification version 1.2)
@ -1469,21 +1469,33 @@ speed/compression ratio. The second parameter to png_set_filter() is
the filter method, for which the only valid value is '0' (as of the
July 1999 PNG specification, version 1.2). The third parameter is a
flag that indicates which filter type(s) are to be tested for each
scanline. See the Compression Library for details on the specific filter
scanline. See the PNG specification for details on the specific filter
types.
/* turn on or off filtering, and/or choose
specific filters */
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
or the "OR" of one or more PNG_FILTER_NAME masks. */
png_set_filter(png_ptr, 0,
PNG_FILTER_NONE | PNG_FILTER_SUB |
PNG_FILTER_PAETH);
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
PNG_FILTER_AVE | PNG_FILTER_VALUE_AVE |
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
PNG_ALL_FILTERS);
If an application
wants to start and stop using particular filters during compression,
it should start out with all of the filters (to ensure that the previous
row of pixels will be stored in case it's needed later), and then add
and remove them after the start of compression.
The png_set_compression_*() functions interface to the zlib compression
library, and should mostly be ignored unless you really know what you are
doing. The only generally useful call is png_set_compression_level()
which changes how much time zlib spends on trying to compress the image
data. See the Compression Library for details on the compression levels.
data. See the Compression Library (zlib.h and algorithm.txt, distributed
with zlib) for details on the compression levels.
/* set the zlib compression level */
png_set_compression_level(png_ptr,
@ -1495,6 +1507,9 @@ data. See the Compression Library for details on the compression levels.
Z_DEFAULT_STRATEGY);
png_set_compression_window_bits(png_ptr, 15);
png_set_compression_method(png_ptr, 8);
png_set_compression_buffer_size(png_ptr, 8192)
extern PNG_EXPORT(void,png_set_zbuf_size)
Setting the contents of info for output
@ -1703,18 +1718,17 @@ Some of the more important parts of the png_info are:
A quick word about text and num_text. text is an array of png_text
structures. num_text is the number of valid structures in the array.
If you want, you can use max_text to hold the size of the array, but
libpng ignores it for writing (it does use it for reading). Each
png_text structure holds a language code, a keyword, a text value, and
a compression type.
Each png_text structure holds a language code, a keyword, a text value,
and a compression type.
The compression types have the same valid numbers as the compression
types of the image data. Currently, the only valid number is zero.
However, you can store text either compressed or uncompressed, unlike
images, which always have to be compressed. So if you don't want the
text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE.
Because compressed-text chunks don't have a language field, if you
specify compression any language code will not be written out.
Because tEXt and zTXt chunks don't have a language field, if you
specify PNG_TEXT_COMPRESSION_NONE or PNG_TEXT_COMPRESSION_zTXt
any language code or translated keyword will not be written out.
Until text gets around 1000 bytes, it is not worth compressing it.
After the text has been written out to the file, the compression type
@ -1874,8 +1888,8 @@ bytes per pixel).
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
where the 0 is unused, and the location is either PNG_FILLER_BEFORE or
PNG_FILLER_AFTER, depending upon whether the filler byte in the is stored
XRGB or RGBX.
PNG_FILLER_AFTER, depending upon whether the filler byte in the pixel
is stored XRGB or RGBX.
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
they can, resulting in, for example, 8 pixels per byte for 1 bit files.
@ -1886,7 +1900,7 @@ correctly pack the pixels into a single byte:
PNG files reduce possible bit depths to 1, 2, 4, 8, and 16. If your
data is of another bit depth, you can write an sBIT chunk into the
file so that decoders can get the original data if desired.
file so that decoders can recover the original data if desired.
/* Set the true bit depth of the image data */
if (color_type & PNG_COLOR_MASK_COLOR)
@ -1961,8 +1975,8 @@ callback function.
The user_channels and user_depth parameters of this function are ignored
when writing; you can set them to zero as shown.
You can retrieve the pointer via the function
png_get_user_transform_ptr(). For example:
You can retrieve the pointer via the function png_get_user_transform_ptr().
For example:
voidp write_user_transform_ptr =
png_get_user_transform_ptr(png_ptr);
@ -2024,7 +2038,7 @@ a single row_pointer instead of an array of row_pointers:
png_write_row(png_ptr, row_pointer);
When the file is interlaced, things can get a good deal more
complicated. The only currently (as of January 2000 -- PNG Specification
complicated. The only currently (as of the PNG Specification
version 1.2, dated July 1999) defined interlacing scheme for PNG files
is the "Adam7" interlace scheme, that breaks down an
image into seven smaller images of varying size. libpng will build
@ -2115,7 +2129,7 @@ to a write structure, you could use
PNG_DESTROY_WILL_FREE_DATA,
PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
Thereby briefly reassigning responsibility for freeing to the user but
thereby briefly reassigning responsibility for freeing to the user but
immediately afterwards reassigning it once more to the write_destroy
function. Having done this, it would then be safe to destroy the read
structure and continue to use the PLTE, tRNS, and hIST data in the write
@ -2132,13 +2146,11 @@ adding new transformations, and generally changing how libpng works.
All of the memory allocation, input/output, and error handling in libpng
goes through callbacks that are user settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function.
Memory allocation is done through the functions png_large_malloc(),
png_malloc(), png_realloc(), png_large_free(), and png_free(). These
currently just call the standard C functions. The large functions must
handle exactly 64K, but they don't have to handle more than that. If
Memory allocation is done through the functions png_malloc() and png_free().
These currently just call the standard C functions. If
your pointers can't access more then 64K at a time, you will want to set
MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling
memory allocation on a platform will change between applications, these
@ -2191,8 +2203,8 @@ fprintf() unless the library is compiled with PNG_NO_CONSOLE_IO defined
fprintf() isn't available). If you wish to change the behavior of the error
functions, you will need to set up your own message callbacks. These
functions are normally supplied at the time that the png_struct is created.
It is also possible to change these functions after png_create_*_struct()
has been called by calling:
It is also possible to redirect errors and warnings to your own replacement
functions after png_create_*_struct() has been called by calling:
png_set_error_fn(png_structp png_ptr,
png_voidp error_ptr, png_error_ptr error_fn,
@ -2216,7 +2228,8 @@ as there is no need to check every return code of every function call.
However, there are some uncertainties about the status of local variables
after a longjmp, so the user may want to be careful about doing anything after
setjmp returns non-zero besides returning itself. Consult your compiler
documentation for more details.
documentation for more details. For an alternative approach, you may wish
to use the "cexcept" facility (see http://cexcept.sourceforge.net).
Custom chunks
@ -2246,10 +2259,7 @@ can be found in the comments inside the code itself.
Configuring for 16 bit platforms
You may need to change the png_large_malloc() and png_large_free()
routines in pngmem.c, as these are required to allocate 64K, although
there is already support for many of the common DOS compilers. Also,
you will want to look into zconf.h to tell zlib (and thus libpng) that
You will want to look into zconf.h to tell zlib (and thus libpng) that
it cannot allocate more then 64K at a time. Even if you can, the memory
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
@ -2318,6 +2328,7 @@ zlib.h for more information on what these mean.
png_set_compression_window_bits(png_ptr,
window_bits);
png_set_compression_method(png_ptr, method);
png_set_compression_buffer_size(png_ptr, size);
Controlling row filtering
@ -2346,7 +2357,13 @@ you intend to use so that libpng can initialize its internal
structures appropriately for all of the filter types.
filters = PNG_FILTER_NONE | PNG_FILTER_SUB
| PNG_FILTER_UP;
PNG_FILTER_UP | PNG_FILTER_AVE |
PNG_FILTER_PAETH | PNG_ALL_FILTERS;
or
filters = one of PNG_FILTER_VALUE_NONE,
PNG_FILTER_VALUE_SUB, PNG_FILTER_VALUE_UP,
PNG_FILTER_VALUE_AVE, PNG_FILTER_VALUE_PAETH
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
filters);
@ -2395,7 +2412,7 @@ you can turn off individual capabilities with defines that begin with
PNG_NO_.
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do
@ -2495,13 +2512,13 @@ the old method.
VII. Y2K Compliance in libpng
April 14, 2000
April 24, 2000
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.6f are Y2K compliant. It is my belief that earlier
upward through 1.0.6g 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 April 14, 2000
.TH LIBPNGPF 3 "April 24, 2000"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6g
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "April 14, 2000"
.TH PNG 5 "April 24, 2000"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

19
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* libpng version 1.0.6f - April 14, 2000
* libpng version 1.0.6g - April 24, 2000
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -14,14 +14,14 @@
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_6f Your_png_h_is_not_version_1_0_6f;
typedef version_1_0_6g Your_png_h_is_not_version_1_0_6g;
/* Version information for C files. This had better match the version
* string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
char png_libpng_ver[12] = "1.0.6f";
char png_libpng_ver[12] = "1.0.6g";
/* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */
@ -561,7 +561,7 @@ 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.6f - April 14, 2000\n\
return ("\n libpng version 1.0.6g - April 24, 2000\n\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\
Copyright (c) 1996, 1997 Andreas Dilger\n\
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\n");
@ -579,8 +579,8 @@ 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.6f");
return("1.0.6f");
return("1.0.6g");
return("1.0.6g");
}
png_charp
@ -617,3 +617,10 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
return 0;
}
#endif
/* This function, added to libpng-1.0.6g, is untested. */
int
png_reset_zstream(png_structp png_ptr)
{
return (inflateReset(&png_ptr->zstream));
}

80
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.0.6f - April 14, 2000
* libpng version 1.0.6g - April 24, 2000
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -9,7 +9,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.6f - April 14, 2000: Glenn
* libpng versions 0.97, January 1998, through 1.0.6g - April 24, 2000: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -47,7 +47,7 @@
* 1.0.5e-r 1.0.5e-r 10100 2.1.0.5e-r (not compatible)
* 1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-v (compatible)
* 1.0.6 (+ 3 patches) 1.0.6 10006 2.1.0.6
* 1.0.6d-f 1.0.6d-f 10007 2.1.0.6d-f
* 1.0.6d-g 1.0.6d-g 10007 2.1.0.6d-g
* 1.0.7 1.0.7 10007 2.1.0.7 (still compatible)
*
* Henceforth the source version will match the shared-library minor
@ -73,7 +73,7 @@
* Copyright (c) 1996, 1997 Andreas Dilger
* (libpng versions 0.89c, June 1996, through 0.96, May 1997)
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000)
* (libpng versions 0.97, January 1998, through 1.0.6g, April 24, 2000)
*
* For the purposes of this copyright and license, "Contributing Authors"
* is defined as the following set of individuals:
@ -148,13 +148,13 @@
* Y2K compliance in libpng:
* =========================
*
* April 14, 2000
* April 24, 2000
*
* 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.6f are Y2K compliant. It is my belief that earlier
* upward through 1.0.6g 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
@ -232,7 +232,7 @@ extern "C" {
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.6f"
#define PNG_LIBPNG_VER_STRING "1.0.6g"
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
@ -483,8 +483,6 @@ typedef struct png_info_struct
* and initialize the appropriate fields below.
*/
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#if defined(PNG_gAMA_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED)
/* The gAMA chunk describes the gamma characteristics of the system
* on which the image was created, normally in the range [1.0, 2.5].
@ -493,7 +491,6 @@ typedef struct png_info_struct
#ifdef PNG_FLOATING_POINT_SUPPORTED
float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
#endif
png_fixed_point int_gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
#endif
#if defined(PNG_sRGB_SUPPORTED)
@ -609,16 +606,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
float x_blue;
float y_blue;
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point int_x_white;
png_fixed_point int_y_white;
png_fixed_point int_x_red;
png_fixed_point int_y_red;
png_fixed_point int_x_green;
png_fixed_point int_y_green;
png_fixed_point int_x_blue;
png_fixed_point int_y_blue;
#endif
#endif
#if defined(PNG_pCAL_SUPPORTED)
@ -687,6 +674,24 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
png_bytepp row_pointers; /* the image bits */
#endif
#if defined(PNG_gAMA_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED)
png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
#endif
#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
png_fixed_point int_x_white;
png_fixed_point int_y_white;
png_fixed_point int_x_red;
png_fixed_point int_y_red;
png_fixed_point int_x_green;
png_fixed_point int_y_green;
png_fixed_point int_x_blue;
png_fixed_point int_y_blue;
#endif
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
} png_info;
typedef png_info FAR * png_infop;
@ -881,14 +886,8 @@ struct png_struct_def
png_byte user_transform_channels; /* channels in user transformed pixels */
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
png_uint_32 mode; /* tells us where we are in the PNG file */
png_uint_32 flags; /* flags indicating various things to libpng */
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
png_uint_32 transformations; /* which transformations to perform */
z_stream zstream; /* pointer to decompression structure (below) */
@ -962,7 +961,6 @@ struct png_struct_def
float gamma; /* file gamma value */
float screen_gamma; /* screen gamma value (display_exponent) */
#endif
png_fixed_point int_gamma;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
@ -1070,12 +1068,23 @@ struct png_struct_def
int num_chunk_list;
png_bytep chunk_list;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_fixed_point int_gamma;
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
};
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
and png.h are both at * version 1.0.6f
and png.h are both at * version 1.0.6g
*/
typedef png_structp version_1_0_6f;
typedef png_structp version_1_0_6g;
typedef png_struct FAR * FAR * png_structpp;
@ -1114,6 +1123,15 @@ extern PNG_EXPORT(png_structp,png_create_write_struct)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn));
extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_compression_buffer_size)
PNGARG((png_structp png_ptr, png_uint_32 size));
/* Reset the compression stream */
extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
#ifdef PNG_USER_MEM_SUPPORTED
extern PNG_EXPORT(png_structp,png_create_read_struct_2)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
@ -2003,6 +2021,8 @@ extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
png_ptr, int keep, png_bytep chunk_list, int num_chunks));
extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
extern PNG_EXPORT(void, png_set_unknown_chunk_location)
PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));
extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
#endif
@ -2058,7 +2078,7 @@ 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));
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.6f - April 14, 2000 (header)\n"
" libpng version 1.0.6g - April 24, 2000 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on

221
png_ptr.h Normal file
View File

@ -0,0 +1,221 @@
struct png_struct_def
{
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf jmpbuf; /* used in png_error */
#endif
png_error_ptr error_fn; /* function for printing errors and aborting */
png_error_ptr warning_fn; /* function for printing warnings */
png_voidp error_ptr; /* user supplied struct for error functions */
png_rw_ptr write_data_fn; /* function for writing output data */
png_rw_ptr read_data_fn; /* function for reading input data */
png_voidp io_ptr; /* ptr to application struct for I/O functions*/
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_user_transform_ptr read_user_transform_fn; /* user read transform */
#endif
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_user_transform_ptr write_user_transform_fn; /* user write transform */
#endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_voidp user_transform_ptr; /* user supplied struct for user transform */
png_byte user_transform_depth; /* bit depth of user transformed pixels */
png_byte user_transform_channels; /* channels in user transformed pixels */
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
png_uint_32 mode; /* tells us where we are in the PNG file */
png_uint_32 flags; /* flags indicating various things to libpng */
png_uint_32 transformations; /* which transformations to perform */
z_stream zstream; /* pointer to decompression structure (below) */
png_bytep zbuf; /* buffer for zlib */
png_size_t zbuf_size; /* size of zbuf */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
int zlib_window_bits; /* holds zlib compression window bits */
int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */
png_uint_32 width; /* width of image in pixels */
png_uint_32 height; /* height of image in pixels */
png_uint_32 num_rows; /* number of rows in current pass */
png_uint_32 usr_width; /* width of row at start of write */
png_uint_32 rowbytes; /* size of row in bytes */
png_uint_32 irowbytes; /* size of current interlaced row in bytes */
png_uint_32 iwidth; /* width of current interlaced row in pixels */
png_uint_32 row_number; /* current row in interlace pass */
png_bytep prev_row; /* buffer to save previous (unfiltered) row */
png_bytep row_buf; /* buffer to save current (unfiltered) row */
png_bytep sub_row; /* buffer to save "sub" row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
png_row_info row_info; /* used for transformation routines */
png_uint_32 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */
png_colorp palette; /* palette from the input file */
png_uint_16 num_palette; /* number of color entries in palette */
png_uint_16 num_trans; /* number of transparency values */
png_byte chunk_name[5]; /* null-terminated name of current chunk */
png_byte compression; /* file compression type (always 0) */
png_byte filter; /* file filter type (always 0) */
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
png_byte pass; /* current interlace pass (0 - 6) */
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
png_byte color_type; /* color type of file */
png_byte bit_depth; /* bit depth of file */
png_byte usr_bit_depth; /* bit depth of users row */
png_byte pixel_depth; /* number of bits per pixel */
png_byte channels; /* number of channels in file */
png_byte usr_channels; /* channels at start of write */
png_byte sig_bytes; /* magic bytes read/written from start of file */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler; /* filler bytes for pixel expansion */
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
png_byte background_gamma_type;
#ifdef PNG_FLOATING_POINT_SUPPORTED
float background_gamma;
#endif
png_color_16 background; /* background color in screen gamma space */
# if defined(PNG_READ_GAMMA_SUPPORTED)
png_color_16 background_1; /* background normalized to gamma 1.0 */
# endif /* PNG_READ_GAMMA && PNG_READ_bKGD_SUPPORTED */
#endif /* PNG_READ_bKGD_SUPPORTED */
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
png_flush_ptr output_flush_fn;/* Function for flushing output */
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
png_uint_32 flush_rows; /* number of rows written since last flush */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
int gamma_shift; /* number of "insignificant" bits 16-bit gamma */
#ifdef PNG_FLOATING_POINT_SUPPORTED
float gamma; /* file gamma value */
float screen_gamma; /* screen gamma value (display_exponent) */
#endif
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep gamma_table; /* gamma table for 8-bit depth files */
png_bytep gamma_from_1; /* converts from 1.0 to screen */
png_bytep gamma_to_1; /* converts from file to 1.0 */
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined (PNG_READ_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in each available channel */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8 shift; /* shift for significant bit tranformation */
#endif
#if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep trans; /* transparency values for paletted files */
png_color_16 trans_values; /* transparency values for non-paletted files */
#endif
png_read_status_ptr read_row_fn; /* called after each row is decoded */
png_write_status_ptr write_row_fn; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
png_progressive_info_ptr info_fn; /* called after header data fully read */
png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
png_progressive_end_ptr end_fn; /* called after image is complete */
png_bytep save_buffer_ptr; /* current location in save_buffer */
png_bytep save_buffer; /* buffer for previously read data */
png_bytep current_buffer_ptr; /* current location in current_buffer */
png_bytep current_buffer; /* buffer for recently used data */
png_uint_32 push_length; /* size of current input chunk */
png_uint_32 skip_length; /* bytes to skip in input data */
png_size_t save_buffer_size; /* amount of data now in save_buffer */
png_size_t save_buffer_max; /* total size of save_buffer */
png_size_t buffer_size; /* total amount of available input data */
png_size_t current_buffer_size; /* amount of data now in current_buffer */
int process_mode; /* what push library is currently doing */
int cur_palette; /* current push library palette index */
# if defined(PNG_READ_TEXT_SUPPORTED)
png_size_t current_text_size; /* current size of text input data */
png_size_t current_text_left; /* how much text left to read in input */
png_charp current_text; /* current text chunk buffer */
png_charp current_text_ptr; /* current location in current_text */
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_READ_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* for the Borland special 64K segment handler */
png_bytepp offset_table_ptr;
png_bytep offset_table;
png_uint_16 offset_table_number;
png_uint_16 offset_table_count;
png_uint_16 offset_table_count_free;
#endif
#if defined(PNG_READ_DITHER_SUPPORTED)
png_bytep palette_lookup; /* lookup table for dithering */
png_bytep dither_index; /* index translation for palette files */
#endif
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_READ_hIST_SUPPORTED)
png_uint_16p hist; /* histogram */
#endif
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
png_byte heuristic_method; /* heuristic for row filter selection */
png_byte num_prev_filters; /* number of weights for previous rows */
png_bytep prev_filters; /* filter type(s) of previous row(s) */
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
png_uint_16p filter_costs; /* relative filter calculation cost */
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
png_charp time_buffer; /* String to hold RFC 1123 time text */
#endif
#ifdef PNG_USER_MEM_SUPPORTED
png_voidp mem_ptr; /* user supplied struct for mem functions */
png_malloc_ptr malloc_fn; /* function for allocating memory */
png_free_ptr free_fn; /* function for freeing memory */
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
png_byte rgb_to_gray_status;
png_uint_16 rgb_to_gray_red_coeff;
png_uint_16 rgb_to_gray_green_coeff;
png_uint_16 rgb_to_gray_blue_coeff;
#endif
#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
png_byte empty_plte_permitted;
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
int num_chunk_list;
png_bytep chunk_list;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_fixed_point int_gamma;
#endif
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
};

View File

@ -1,6 +1,6 @@
/* pngasmrd.h - assembler version of utilities to read a PNG file
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1999, 2000 Glenn Randers-Pehrson
*

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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

@ -6,7 +6,7 @@
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code.
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998, Intel Corporation
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -137,6 +137,12 @@ int mmxsupport(void);
static int mmx_supported = 2;
#ifdef PNG_USE_LOCAL_ARRAYS
static const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
static const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
static const int png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
#endif
// djgpp adds its own underscores to global variables, so define them without:
#ifdef __DJGPP__
# define _unmask unmask
@ -4494,7 +4500,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
break;
default:
png_error(png_ptr, "Bad adaptive filter type");
png_error(png_ptr, "#103 Bad adaptive filter type");
break;
}
}

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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
@ -801,3 +801,9 @@ png_get_user_chunk_ptr(png_structp png_ptr)
}
#endif
png_uint_32
png_get_compression_buffer_size(png_structp png_ptr)
{
return(png_ptr->zbuf_size);
}

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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 @@
/* pngread.c - read a PNG file
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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
@ -641,7 +641,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.6f.
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6g.
*/
void
@ -690,7 +690,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 pass of a interlaced image, use png_read_rows() instead.
*
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6f.
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6g.
*/
void
png_read_image(png_structp png_ptr, png_bytepp image)

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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 @@
/* pngrutil.c - utilities to read a PNG file
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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 @@
/* pngset.c - storage of image information into info struct
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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
@ -693,6 +693,14 @@ png_set_unknown_chunks(png_structp png_ptr,
info_ptr->unknown_chunks_num += num_unknowns;
info_ptr->free_me |= PNG_FREE_UNKN;
}
void
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
int chunk, int location)
{
if(png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
(int)info_ptr->unknown_chunks_num)
info_ptr->unknown_chunks[chunk].location = (png_byte)location;
}
#endif
#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
@ -772,3 +780,14 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
}
#endif
void
png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
{
if(png_ptr->zbuf)
png_free(png_ptr, png_ptr->zbuf);
png_ptr->zbuf_size = (png_size_t)size;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
}

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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
@ -893,7 +893,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
generated locations in write_info_ptr are wrong because we
haven't written anything yet */
for (i = 0; i < (png_size_t)num_unknowns; i++)
write_info_ptr->unknown_chunks[i].location = unknowns[i].location;
png_set_unknown_chunk_location(write_ptr, write_info_ptr, i,
unknowns[i].location);
}
}
#endif
@ -1007,8 +1008,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
generated locations in write_end_info_ptr are wrong because we
haven't written the end_info yet */
for (i = 0; i < (png_size_t)num_unknowns; i++)
write_end_info_ptr->unknown_chunks[i].location =
unknowns[i].location;
png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i,
unknowns[i].location);
}
}
#endif
@ -1344,4 +1345,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_6f your_png_h_is_not_version_1_0_6f;
typedef version_1_0_6g your_png_h_is_not_version_1_0_6g;

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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

@ -2,7 +2,7 @@
*
* For Intel x86 CPU and Microsoft Visual C++ compiler
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998, Intel Corporation
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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 @@
/* pngwrite.c - general routines to write a PNG file
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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 @@
/* pngwutil.c - utilities to write a PNG file
*
* libpng 1.0.6f - April 14, 2000
* libpng 1.0.6g - April 24, 2000
* 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

@ -31,7 +31,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.6f
PNGMIN = 1.0.6g
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h

View File

@ -14,7 +14,7 @@ ZLIBINC=../zlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.6f
PNGMIN = 1.0.6g
PNGVER = $(PNGMAJ).$(PNGMIN)
CC=cc

View File

@ -34,7 +34,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.6f
PNGMIN = 1.0.6g
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include

View File

@ -34,7 +34,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.6f
PNGMIN = 1.0.6g
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include

View File

@ -25,7 +25,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.6f
PNGMIN = 1.0.6g
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include

View File

@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 # -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=gcc -shared
VER=1.0.6f
LIBS=libpng.so.1.0.6f
VER=1.0.6g
LIBS=libpng.so.1.0.6g
SHAREDLIB=libpng.so
libdir=$(prefix)/lib32

View File

@ -31,7 +31,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.6f
PNGMIN = 1.0.6g
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include

View File

@ -3,7 +3,7 @@ unit pngdef;
interface
const
PNG_LIBPNG_VER_STRING = '1.0.6f';
PNG_LIBPNG_VER_STRING = '1.0.6g';
PNG_LIBPNG_VER = 10007;
type