Imported from libpng-1.0.6f.tar

This commit is contained in:
Glenn Randers-Pehrson 2000-04-14 14:20:47 -05:00
parent 38e6e77419
commit 4accabb590
44 changed files with 446 additions and 200 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.0.6e - April 10, 2000 Libpng 1.0.6f - April 14, 2000
This is not intended to be a public release. It will be replaced 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. 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 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 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(). Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
version 1.0.6e [April 10, 2000] version 1.0.6f [April 14, 2000]
Added png_data_freer() function. Added png_data_freer() function.
In the code that checks for over-length tRNS chunks, added check of 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) info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)

View File

@ -669,7 +669,7 @@ version 1.0.6d [April 7, 2000]
Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file 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 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(). Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
version 1.0.6e [April 10, 2000] version 1.0.6e [April 9, 2000]
Added png_data_freer() function. Added png_data_freer() function.
In the code that checks for over-length tRNS chunks, added check of 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) info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)
@ -680,6 +680,13 @@ version 1.0.6e [April 10, 2000]
is defined. is defined.
Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c 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. and mentioned the purposes of the two macros in libpng.txt/libpng.3.
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.
Send comments/corrections/commendations to Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

12
INSTALL
View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.6e - April 10, 2000 Installing libpng version 1.0.6f - April 14, 2000
Before installing libpng, you must first install zlib. zlib Before installing libpng, you must first install zlib. zlib
can usually be found wherever you got libpng. zlib can be 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. version of zlib that's installed.
You can rename the directories that you downloaded (they You can rename the directories that you downloaded (they
might be called "libpng-1.0.6e" or "lpng106" and "zlib-1.1.3" might be called "libpng-1.0.6f" or "lpng106" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng". or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@ -47,8 +47,8 @@ The files that are presently available in the scripts directory
include include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6e) 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.6e, makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6f,
uses assembler code tuned for Intel MMX platform) uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with 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) 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 libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6e) makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6f)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6e) makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6f)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile makefile.mips => MIPS makefile
makefile.acorn => Acorn 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 Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.90, December 1996, through 0.96, May 1997) (libpng versions 0.90, December 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000) (libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000)
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: is defined as the following set of individuals:
@ -68,4 +68,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
randeg@alum.rpi.edu randeg@alum.rpi.edu
April 10, 2000 April 14, 2000

10
README
View File

@ -1,4 +1,4 @@
README for libpng 1.0.6e - April 10, 2000 (shared library 2.1) README for libpng 1.0.6f - April 14, 2000 (shared library 2.1)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. 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 descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.6e) (gcc, creates libpng.so.2.1.0.6f)
makefile.gcmmx => Linux/ELF makefile (gcc, creates makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng.so.2.1.0.6e, uses assembler code libpng.so.2.1.0.6f, uses assembler code
tuned for Intel MMX platform) tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with 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) 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 libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6e) makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6f)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.6e) (gcc, creates libpng.so.2.1.0.6f)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile makefile.acorn => Acorn makefile

View File

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

2
configure vendored
View File

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

104
contrib/gregbook/makefile Normal file
View File

@ -0,0 +1,104 @@
# 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)

BIN
contrib/gregbook/rpng-x Executable file

Binary file not shown.

BIN
contrib/gregbook/rpng2-x Executable file

Binary file not shown.

BIN
contrib/gregbook/wpng Executable file

Binary file not shown.

143
libpng.3
View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "April 10, 2000" .TH LIBPNG 3 "April 14, 2000"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6e libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f
.SH SYNOPSIS .SH SYNOPSIS
\fI\fB \fI\fB
@ -713,7 +713,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.6e - April 10, 2000 libpng version 1.0.6f - April 14, 2000
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu> <randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -831,10 +831,10 @@ You will want to do the I/O initialization(*) before you get into libpng,
so if it doesn't work, you don't have much to undo. Of course, you so if it doesn't work, you don't have much to undo. Of course, you
will also want to insure that you are, in fact, dealing with a PNG will also want to insure that you are, in fact, dealing with a PNG
file. Libpng provides a simple check to see if a file is a PNG file. file. Libpng provides a simple check to see if a file is a PNG file.
To use it, pass in the first 1 to 8 bytes of the file, and it will To use it, pass in the first 1 to 8 bytes of the file to the function
return true or false (1 or 0) depending on whether the bytes could be png_sig_cmp(), and it will return 0 if the bytes match the corresponding
part of a PNG file. Of course, the more bytes you pass in, the bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes
greater the accuracy of the prediction. you pass in, the greater the accuracy of the prediction.
If you are intending to keep the file pointer open for use in libpng, If you are intending to keep the file pointer open for use in libpng,
you must ensure you don't read more than 8 bytes from the beginning you must ensure you don't read more than 8 bytes from the beginning
@ -1205,7 +1205,7 @@ into the info_ptr is returned for any complex types.
png_get_hIST(png_ptr, info_ptr, &hist); png_get_hIST(png_ptr, info_ptr, &hist);
(PNG_INFO_hIST) (PNG_INFO_hIST)
hist - histogram of palette (array of hist - histogram of palette (array of
png_color_16) png_uint_16)
png_get_tIME(png_ptr, info_ptr, &mod_time); png_get_tIME(png_ptr, info_ptr, &mod_time);
mod_time - time image was last modified mod_time - time image was last modified
@ -1221,26 +1221,34 @@ into the info_ptr is returned for any complex types.
num_comments - number of comments num_comments - number of comments
text_ptr - array of png_text holding image text_ptr - array of png_text holding image
comments comments
text_ptr[i]->compression - type of compression used text_ptr[i].compression - type of compression used
on "text" PNG_TEXT_COMPRESSION_NONE on "text" PNG_TEXT_COMPRESSION_NONE
PNG_TEXT_COMPRESSION_zTXt PNG_TEXT_COMPRESSION_zTXt
PNG_ITXT_COMPRESSION_NONE PNG_ITXT_COMPRESSION_NONE
PNG_ITXT_COMPRESSION_zTXt PNG_ITXT_COMPRESSION_zTXt
text_ptr[i]->key - keyword for comment. text_ptr[i].key - keyword for comment. Must contain
text_ptr[i]->text - text comments for current 1-79 characters.
keyword. text_ptr[i].text - text comments for current
text_ptr[i]->text_length - length of text string, keyword. Can empty.
text_ptr[i].text_length - length of text string,
after decompression, 0 for iTXt after decompression, 0 for iTXt
text_ptr[i]->itxt_length - length of itxt string, text_ptr[i].itxt_length - length of itxt string,
after decompression, 0 for tEXt/zTXt after decompression, 0 for tEXt/zTXt
text_ptr[i]->lang - language of comment (NULL for unknown). text_ptr[i].lang - language of comment (empty
text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL string for unknown).
for unknown). text_ptr[i].translated_keyword - keyword in UTF-8
(empty string for unknown).
num_text - number of comments (same as num_comments; num_text - number of comments (same as num_comments;
you can put NULL here to avoid the duplication) you can put NULL here to avoid the duplication)
num_spalettes = png_get_spalettes(png_ptr, info_ptr, &palette_ptr); Note while png_set_text() will accept text, language, and
palette_ptr - array of png_spalette structures holding contents translated keywords that can be NULL pointers, the structure
of one or more sPLT chunks read. returned by png_get_text will always contain regular
zero-terminated C strings. They might be empty strings but
they will never be NULL pointers.
num_spalettes = png_get_sPLT(png_ptr, info_ptr, &palette_ptr);
palette_ptr - array of palette structures holding
contents of one or more sPLT chunks read.
num_spalettes - number of sPLT chunks read. num_spalettes - number of sPLT chunks read.
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
@ -1261,9 +1269,16 @@ into the info_ptr is returned for any complex types.
PNG_RESOLUTION_METER PNG_RESOLUTION_METER
png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height) png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height)
unit - physical scale units (a string) unit - physical scale units (an integer)
width - width of a pixel in physical scale units width - width of a pixel in physical scale units
height - height of a pixel in physical scale units height - height of a pixel in physical scale units
(width and height are doubles)
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, &height)
unit - physical scale units (an integer)
width - width of a pixel in physical scale units
height - height of a pixel in physical scale units
(width and height are strings like "2.54")
num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr, num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr,
&unknowns) &unknowns)
@ -1271,9 +1286,12 @@ into the info_ptr is returned for any complex types.
unknown chunks unknown chunks
unknowns[i].name - name of unknown chunk unknowns[i].name - name of unknown chunk
unknowns[i].data - data of unknown chunk unknowns[i].data - data of unknown chunk
unknowns[i].size - size of unknown chunk unknowns[i].size - size of unknown chunk's data
unknowns[i].location - position of chunk in file unknowns[i].location - position of chunk in file
The value of "i" corresponds to the order in which the chunks were read
from the PNG file or inserted with the png_set_unknown_chunks() function.
The data from the pHYs chunk can be retrieved in several convenient The data from the pHYs chunk can be retrieved in several convenient
forms: forms:
@ -1283,6 +1301,12 @@ forms:
info_ptr) info_ptr)
res_x_and_y = png_get_pixels_per_meter(png_ptr, res_x_and_y = png_get_pixels_per_meter(png_ptr,
info_ptr) info_ptr)
res_x = png_get_x_pixels_per_inch(png_ptr,
info_ptr)
res_y = png_get_y_pixels_per_inch(png_ptr,
info_ptr)
res_x_and_y = png_get_pixels_per_inch(png_ptr,
info_ptr)
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr, aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
info_ptr) info_ptr)
@ -1290,6 +1314,18 @@ forms:
the data is not present or if res_x is 0; the data is not present or if res_x is 0;
res_x_and_y is 0 if res_x != res_y) res_x_and_y is 0 if res_x != res_y)
The data from the oFFs chunk can be retrieved in several convenient
forms:
x_offset = png_get_x_offset_microns(png_ptr, info_ptr);
y_offset = png_get_y_offset_microns(png_ptr, info_ptr);
x_offset = png_get_x_offset_inches(png_ptr, info_ptr);
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
(Each of these returns 0 [signifying "unknown" if both
x and y are 0] if the data is not present or if the chunk
is present but the unit is the pixel)
For more information, see the png_info definition in png.h and the For more information, see the png_info definition in png.h and the
PNG specification for chunk contents. Be careful with trusting PNG specification for chunk contents. Be careful with trusting
rowbytes, as some of the transformations could increase the space rowbytes, as some of the transformations could increase the space
@ -1310,7 +1346,8 @@ trailing spaces, but non-consecutive spaces are allowed within the
keyword. It is possible to have the same keyword any number of times. keyword. It is possible to have the same keyword any number of times.
The text_ptr is an array of png_text structures, each holding a The text_ptr is an array of png_text structures, each holding a
pointer to a language string, a pointer to a keyword and a pointer to pointer to a language string, a pointer to a keyword and a pointer to
a text string. Only the text string may be null. The keyword/text a text string. The text string, language code, and translated
keyword may be empty or NULL pointers. The keyword/text
pairs are put into the array in the order that they are received. pairs are put into the array in the order that they are received.
However, some or all of the text chunks may be after the image, so, to However, some or all of the text chunks may be after the image, so, to
make sure you have read all the text chunks, don't mess with these make sure you have read all the text chunks, don't mess with these
@ -1728,8 +1765,8 @@ a single row_pointer instead of an array of row_pointers:
png_bytep row_pointer = row; png_bytep row_pointer = row;
png_read_row(png_ptr, row_pointers, NULL); png_read_row(png_ptr, row_pointers, NULL);
If the file is interlaced (info_ptr->interlace_type != 0), things get If the file is interlaced (interlace_type != 0 in the IHDR chunk), things
somewhat harder. The only current (PNG Specification version 1.2) get somewhat harder. The only current (PNG Specification version 1.2)
interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7) interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7)
is a somewhat complicated 2D interlace scheme, known as Adam7, that is a somewhat complicated 2D interlace scheme, known as Adam7, that
breaks down an image into seven smaller images of varying size, based breaks down an image into seven smaller images of varying size, based
@ -2076,7 +2113,7 @@ both "png_ptr"; you can call them anything you like, such as
If you want to use your own memory allocation routines, If you want to use your own memory allocation routines,
define PNG_USER_MEM_SUPPORTED and use define PNG_USER_MEM_SUPPORTED and use
png_create_write_struct_2() instead of png_create_read_struct(): png_create_write_struct_2() instead of png_create_write_struct():
png_structp png_ptr = png_create_write_struct_2 png_structp png_ptr = png_create_write_struct_2
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
@ -2291,7 +2328,7 @@ Some of the more important parts of the png_info are:
png_set_hIST(png_ptr, info_ptr, hist); png_set_hIST(png_ptr, info_ptr, hist);
(PNG_INFO_hIST) (PNG_INFO_hIST)
hist - histogram of palette (array of hist - histogram of palette (array of
png_color_16) png_uint_16)
png_set_tIME(png_ptr, info_ptr, mod_time); png_set_tIME(png_ptr, info_ptr, mod_time);
mod_time - time image was last modified mod_time - time image was last modified
@ -2303,26 +2340,29 @@ Some of the more important parts of the png_info are:
png_set_text(png_ptr, info_ptr, text_ptr, num_text); png_set_text(png_ptr, info_ptr, text_ptr, num_text);
text_ptr - array of png_text holding image text_ptr - array of png_text holding image
comments comments
text_ptr[i]->compression - type of compression used text_ptr[i].compression - type of compression used
on "text" PNG_TEXT_COMPRESSION_NONE on "text" PNG_TEXT_COMPRESSION_NONE
PNG_TEXT_COMPRESSION_zTXt PNG_TEXT_COMPRESSION_zTXt
PNG_ITXT_COMPRESSION_NONE PNG_ITXT_COMPRESSION_NONE
PNG_ITXT_COMPRESSION_zTXt PNG_ITXT_COMPRESSION_zTXt
text_ptr[i]->key - keyword for comment. text_ptr[i].key - keyword for comment. Must contain
text_ptr[i]->text - text comments for current 1-79 characters.
keyword. text_ptr[i].text - text comments for current
text_ptr[i]->text_length - length of text string, keyword. Can be NULL or empty.
text_ptr[i].text_length - length of text string,
after decompression, 0 for iTXt after decompression, 0 for iTXt
text_ptr[i]->itxt_length - length of itxt string, text_ptr[i].itxt_length - length of itxt string,
after decompression, 0 for tEXt/zTXt after decompression, 0 for tEXt/zTXt
text_ptr[i]->lang - language of comment (NULL for unknown). text_ptr[i].lang - language of comment (NULL or
text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL empty for unknown).
for unknown). text_ptr[i].translated_keyword - keyword in UTF-8 (NULL
or empty for unknown).
num_text - number of comments num_text - number of comments
png_set_spalettes(png_ptr, info_ptr, &palette_ptr, num_spalettes); png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes);
palette_ptr - array of png_spalette structures to be added to palette_ptr - array of png_sPLT_struct structures to be
the list of palettes in the info structure. added to the list of palettes in the info
structure.
num_spalettes - number of palette structures to be added. num_spalettes - number of palette structures to be added.
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
@ -2343,16 +2383,23 @@ Some of the more important parts of the png_info are:
PNG_RESOLUTION_METER PNG_RESOLUTION_METER
png_set_sCAL(png_ptr, info_ptr, unit, width, height) png_set_sCAL(png_ptr, info_ptr, unit, width, height)
unit - physical scale units (a string) unit - physical scale units (an integer)
width - width of a pixel in physical scale units width - width of a pixel in physical scale units
height - height of a pixel in physical scale units height - height of a pixel in physical scale units
(width and height are doubles)
png_set_sCAL_s(png_ptr, info_ptr, unit, width, height)
unit - physical scale units (an integer)
width - width of a pixel in physical scale units
height - height of a pixel in physical scale units
(width and height are strings like "2.54")
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns) png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns)
unknowns - array of png_unknown_chunk structures holding unknowns - array of png_unknown_chunk structures holding
unknown chunks unknown chunks
unknowns[i].name - name of unknown chunk unknowns[i].name - name of unknown chunk
unknowns[i].data - data of unknown chunk unknowns[i].data - data of unknown chunk
unknowns[i].size - size of unknown chunk unknowns[i].size - size of unknown chunk's data
unknowns[i].location - position to write chunk in file unknowns[i].location - position to write chunk in file
0: do not write chunk 0: do not write chunk
PNG_HAVE_IHDR: before PLTE PNG_HAVE_IHDR: before PLTE
@ -2361,7 +2408,11 @@ Some of the more important parts of the png_info are:
The "location" member is set automatically according to The "location" member is set automatically according to
what part of the output file has already been written. what part of the output file has already been written.
You can change its value after calling png_set_unknown_chunks() You can change its value after calling png_set_unknown_chunks()
as demonstrated in pngtest.c. as demonstrated in pngtest.c. Within each of the "locations",
the chunks are sequenced according to their position in the
structure (that is, the value of "i", which is the order in which
the chunk was either read from the input file or defined with
png_set_unknown_chunks).
A quick word about text and num_text. text is an array of png_text 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. structures. num_text is the number of valid structures in the array.
@ -3157,13 +3208,13 @@ the old method.
.SH VII. Y2K Compliance in libpng .SH VII. Y2K Compliance in libpng
April 10, 2000 April 14, 2000
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.6e are Y2K compliant. It is my belief that earlier upward through 1.0.6f are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that
@ -3304,7 +3355,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.6e - April 10, 2000: Libpng version 1.0.6f - April 14, 2000:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu). Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
@ -3319,7 +3370,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.89c, May 1996, through 0.96, May 1997) (libpng versions 0.89c, May 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000) (libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000)
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: 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.txt - A description on how to use and modify libpng
libpng version 1.0.6e - April 10, 2000 libpng version 1.0.6f - April 14, 2000
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu> <randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -118,10 +118,10 @@ You will want to do the I/O initialization(*) before you get into libpng,
so if it doesn't work, you don't have much to undo. Of course, you so if it doesn't work, you don't have much to undo. Of course, you
will also want to insure that you are, in fact, dealing with a PNG will also want to insure that you are, in fact, dealing with a PNG
file. Libpng provides a simple check to see if a file is a PNG file. file. Libpng provides a simple check to see if a file is a PNG file.
To use it, pass in the first 1 to 8 bytes of the file, and it will To use it, pass in the first 1 to 8 bytes of the file to the function
return true or false (1 or 0) depending on whether the bytes could be png_sig_cmp(), and it will return 0 if the bytes match the corresponding
part of a PNG file. Of course, the more bytes you pass in, the bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes
greater the accuracy of the prediction. you pass in, the greater the accuracy of the prediction.
If you are intending to keep the file pointer open for use in libpng, If you are intending to keep the file pointer open for use in libpng,
you must ensure you don't read more than 8 bytes from the beginning you must ensure you don't read more than 8 bytes from the beginning
@ -492,7 +492,7 @@ into the info_ptr is returned for any complex types.
png_get_hIST(png_ptr, info_ptr, &hist); png_get_hIST(png_ptr, info_ptr, &hist);
(PNG_INFO_hIST) (PNG_INFO_hIST)
hist - histogram of palette (array of hist - histogram of palette (array of
png_color_16) png_uint_16)
png_get_tIME(png_ptr, info_ptr, &mod_time); png_get_tIME(png_ptr, info_ptr, &mod_time);
mod_time - time image was last modified mod_time - time image was last modified
@ -508,26 +508,34 @@ into the info_ptr is returned for any complex types.
num_comments - number of comments num_comments - number of comments
text_ptr - array of png_text holding image text_ptr - array of png_text holding image
comments comments
text_ptr[i]->compression - type of compression used text_ptr[i].compression - type of compression used
on "text" PNG_TEXT_COMPRESSION_NONE on "text" PNG_TEXT_COMPRESSION_NONE
PNG_TEXT_COMPRESSION_zTXt PNG_TEXT_COMPRESSION_zTXt
PNG_ITXT_COMPRESSION_NONE PNG_ITXT_COMPRESSION_NONE
PNG_ITXT_COMPRESSION_zTXt PNG_ITXT_COMPRESSION_zTXt
text_ptr[i]->key - keyword for comment. text_ptr[i].key - keyword for comment. Must contain
text_ptr[i]->text - text comments for current 1-79 characters.
keyword. text_ptr[i].text - text comments for current
text_ptr[i]->text_length - length of text string, keyword. Can empty.
text_ptr[i].text_length - length of text string,
after decompression, 0 for iTXt after decompression, 0 for iTXt
text_ptr[i]->itxt_length - length of itxt string, text_ptr[i].itxt_length - length of itxt string,
after decompression, 0 for tEXt/zTXt after decompression, 0 for tEXt/zTXt
text_ptr[i]->lang - language of comment (NULL for unknown). text_ptr[i].lang - language of comment (empty
text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL string for unknown).
for unknown). text_ptr[i].translated_keyword - keyword in UTF-8
(empty string for unknown).
num_text - number of comments (same as num_comments; num_text - number of comments (same as num_comments;
you can put NULL here to avoid the duplication) you can put NULL here to avoid the duplication)
num_spalettes = png_get_spalettes(png_ptr, info_ptr, &palette_ptr); Note while png_set_text() will accept text, language, and
palette_ptr - array of png_spalette structures holding contents translated keywords that can be NULL pointers, the structure
of one or more sPLT chunks read. returned by png_get_text will always contain regular
zero-terminated C strings. They might be empty strings but
they will never be NULL pointers.
num_spalettes = png_get_sPLT(png_ptr, info_ptr, &palette_ptr);
palette_ptr - array of palette structures holding
contents of one or more sPLT chunks read.
num_spalettes - number of sPLT chunks read. num_spalettes - number of sPLT chunks read.
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
@ -548,9 +556,16 @@ into the info_ptr is returned for any complex types.
PNG_RESOLUTION_METER PNG_RESOLUTION_METER
png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height) png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height)
unit - physical scale units (a string) unit - physical scale units (an integer)
width - width of a pixel in physical scale units width - width of a pixel in physical scale units
height - height of a pixel in physical scale units height - height of a pixel in physical scale units
(width and height are doubles)
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, &height)
unit - physical scale units (an integer)
width - width of a pixel in physical scale units
height - height of a pixel in physical scale units
(width and height are strings like "2.54")
num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr, num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr,
&unknowns) &unknowns)
@ -558,9 +573,12 @@ into the info_ptr is returned for any complex types.
unknown chunks unknown chunks
unknowns[i].name - name of unknown chunk unknowns[i].name - name of unknown chunk
unknowns[i].data - data of unknown chunk unknowns[i].data - data of unknown chunk
unknowns[i].size - size of unknown chunk unknowns[i].size - size of unknown chunk's data
unknowns[i].location - position of chunk in file unknowns[i].location - position of chunk in file
The value of "i" corresponds to the order in which the chunks were read
from the PNG file or inserted with the png_set_unknown_chunks() function.
The data from the pHYs chunk can be retrieved in several convenient The data from the pHYs chunk can be retrieved in several convenient
forms: forms:
@ -570,6 +588,12 @@ forms:
info_ptr) info_ptr)
res_x_and_y = png_get_pixels_per_meter(png_ptr, res_x_and_y = png_get_pixels_per_meter(png_ptr,
info_ptr) info_ptr)
res_x = png_get_x_pixels_per_inch(png_ptr,
info_ptr)
res_y = png_get_y_pixels_per_inch(png_ptr,
info_ptr)
res_x_and_y = png_get_pixels_per_inch(png_ptr,
info_ptr)
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr, aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
info_ptr) info_ptr)
@ -577,6 +601,18 @@ forms:
the data is not present or if res_x is 0; the data is not present or if res_x is 0;
res_x_and_y is 0 if res_x != res_y) res_x_and_y is 0 if res_x != res_y)
The data from the oFFs chunk can be retrieved in several convenient
forms:
x_offset = png_get_x_offset_microns(png_ptr, info_ptr);
y_offset = png_get_y_offset_microns(png_ptr, info_ptr);
x_offset = png_get_x_offset_inches(png_ptr, info_ptr);
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
(Each of these returns 0 [signifying "unknown" if both
x and y are 0] if the data is not present or if the chunk
is present but the unit is the pixel)
For more information, see the png_info definition in png.h and the For more information, see the png_info definition in png.h and the
PNG specification for chunk contents. Be careful with trusting PNG specification for chunk contents. Be careful with trusting
rowbytes, as some of the transformations could increase the space rowbytes, as some of the transformations could increase the space
@ -597,7 +633,8 @@ trailing spaces, but non-consecutive spaces are allowed within the
keyword. It is possible to have the same keyword any number of times. keyword. It is possible to have the same keyword any number of times.
The text_ptr is an array of png_text structures, each holding a The text_ptr is an array of png_text structures, each holding a
pointer to a language string, a pointer to a keyword and a pointer to pointer to a language string, a pointer to a keyword and a pointer to
a text string. Only the text string may be null. The keyword/text a text string. The text string, language code, and translated
keyword may be empty or NULL pointers. The keyword/text
pairs are put into the array in the order that they are received. pairs are put into the array in the order that they are received.
However, some or all of the text chunks may be after the image, so, to However, some or all of the text chunks may be after the image, so, to
make sure you have read all the text chunks, don't mess with these make sure you have read all the text chunks, don't mess with these
@ -1015,8 +1052,8 @@ a single row_pointer instead of an array of row_pointers:
png_bytep row_pointer = row; png_bytep row_pointer = row;
png_read_row(png_ptr, row_pointers, NULL); png_read_row(png_ptr, row_pointers, NULL);
If the file is interlaced (info_ptr->interlace_type != 0), things get If the file is interlaced (interlace_type != 0 in the IHDR chunk), things
somewhat harder. The only current (PNG Specification version 1.2) get somewhat harder. The only current (PNG Specification version 1.2)
interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7) interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7)
is a somewhat complicated 2D interlace scheme, known as Adam7, that is a somewhat complicated 2D interlace scheme, known as Adam7, that
breaks down an image into seven smaller images of varying size, based breaks down an image into seven smaller images of varying size, based
@ -1363,7 +1400,7 @@ both "png_ptr"; you can call them anything you like, such as
If you want to use your own memory allocation routines, If you want to use your own memory allocation routines,
define PNG_USER_MEM_SUPPORTED and use define PNG_USER_MEM_SUPPORTED and use
png_create_write_struct_2() instead of png_create_read_struct(): png_create_write_struct_2() instead of png_create_write_struct():
png_structp png_ptr = png_create_write_struct_2 png_structp png_ptr = png_create_write_struct_2
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
@ -1578,7 +1615,7 @@ Some of the more important parts of the png_info are:
png_set_hIST(png_ptr, info_ptr, hist); png_set_hIST(png_ptr, info_ptr, hist);
(PNG_INFO_hIST) (PNG_INFO_hIST)
hist - histogram of palette (array of hist - histogram of palette (array of
png_color_16) png_uint_16)
png_set_tIME(png_ptr, info_ptr, mod_time); png_set_tIME(png_ptr, info_ptr, mod_time);
mod_time - time image was last modified mod_time - time image was last modified
@ -1590,26 +1627,29 @@ Some of the more important parts of the png_info are:
png_set_text(png_ptr, info_ptr, text_ptr, num_text); png_set_text(png_ptr, info_ptr, text_ptr, num_text);
text_ptr - array of png_text holding image text_ptr - array of png_text holding image
comments comments
text_ptr[i]->compression - type of compression used text_ptr[i].compression - type of compression used
on "text" PNG_TEXT_COMPRESSION_NONE on "text" PNG_TEXT_COMPRESSION_NONE
PNG_TEXT_COMPRESSION_zTXt PNG_TEXT_COMPRESSION_zTXt
PNG_ITXT_COMPRESSION_NONE PNG_ITXT_COMPRESSION_NONE
PNG_ITXT_COMPRESSION_zTXt PNG_ITXT_COMPRESSION_zTXt
text_ptr[i]->key - keyword for comment. text_ptr[i].key - keyword for comment. Must contain
text_ptr[i]->text - text comments for current 1-79 characters.
keyword. text_ptr[i].text - text comments for current
text_ptr[i]->text_length - length of text string, keyword. Can be NULL or empty.
text_ptr[i].text_length - length of text string,
after decompression, 0 for iTXt after decompression, 0 for iTXt
text_ptr[i]->itxt_length - length of itxt string, text_ptr[i].itxt_length - length of itxt string,
after decompression, 0 for tEXt/zTXt after decompression, 0 for tEXt/zTXt
text_ptr[i]->lang - language of comment (NULL for unknown). text_ptr[i].lang - language of comment (NULL or
text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL empty for unknown).
for unknown). text_ptr[i].translated_keyword - keyword in UTF-8 (NULL
or empty for unknown).
num_text - number of comments num_text - number of comments
png_set_spalettes(png_ptr, info_ptr, &palette_ptr, num_spalettes); png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes);
palette_ptr - array of png_spalette structures to be added to palette_ptr - array of png_sPLT_struct structures to be
the list of palettes in the info structure. added to the list of palettes in the info
structure.
num_spalettes - number of palette structures to be added. num_spalettes - number of palette structures to be added.
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
@ -1630,16 +1670,23 @@ Some of the more important parts of the png_info are:
PNG_RESOLUTION_METER PNG_RESOLUTION_METER
png_set_sCAL(png_ptr, info_ptr, unit, width, height) png_set_sCAL(png_ptr, info_ptr, unit, width, height)
unit - physical scale units (a string) unit - physical scale units (an integer)
width - width of a pixel in physical scale units width - width of a pixel in physical scale units
height - height of a pixel in physical scale units height - height of a pixel in physical scale units
(width and height are doubles)
png_set_sCAL_s(png_ptr, info_ptr, unit, width, height)
unit - physical scale units (an integer)
width - width of a pixel in physical scale units
height - height of a pixel in physical scale units
(width and height are strings like "2.54")
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns) png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns)
unknowns - array of png_unknown_chunk structures holding unknowns - array of png_unknown_chunk structures holding
unknown chunks unknown chunks
unknowns[i].name - name of unknown chunk unknowns[i].name - name of unknown chunk
unknowns[i].data - data of unknown chunk unknowns[i].data - data of unknown chunk
unknowns[i].size - size of unknown chunk unknowns[i].size - size of unknown chunk's data
unknowns[i].location - position to write chunk in file unknowns[i].location - position to write chunk in file
0: do not write chunk 0: do not write chunk
PNG_HAVE_IHDR: before PLTE PNG_HAVE_IHDR: before PLTE
@ -1648,7 +1695,11 @@ Some of the more important parts of the png_info are:
The "location" member is set automatically according to The "location" member is set automatically according to
what part of the output file has already been written. what part of the output file has already been written.
You can change its value after calling png_set_unknown_chunks() You can change its value after calling png_set_unknown_chunks()
as demonstrated in pngtest.c. as demonstrated in pngtest.c. Within each of the "locations",
the chunks are sequenced according to their position in the
structure (that is, the value of "i", which is the order in which
the chunk was either read from the input file or defined with
png_set_unknown_chunks).
A quick word about text and num_text. text is an array of png_text 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. structures. num_text is the number of valid structures in the array.
@ -2444,13 +2495,13 @@ the old method.
VII. Y2K Compliance in libpng VII. Y2K Compliance in libpng
April 10, 2000 April 14, 2000
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.6e are Y2K compliant. It is my belief that earlier upward through 1.0.6f are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 April 10, 2000 .TH LIBPNGPF 3 April 14, 2000
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6e libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP \fB#include <png.h>\fP

2
png.5
View File

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

12
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* libpng version 1.0.6e - April 10, 2000 * libpng version 1.0.6f - April 14, 2000
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -14,14 +14,14 @@
#include "png.h" #include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_6e Your_png_h_is_not_version_1_0_6e; typedef version_1_0_6f Your_png_h_is_not_version_1_0_6f;
/* Version information for C files. This had better match the version /* Version information for C files. This had better match the version
* string defined in png.h. */ * string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */ /* png_libpng_ver was changed to a function in version 1.0.5c */
char png_libpng_ver[12] = "1.0.6e"; char png_libpng_ver[12] = "1.0.6f";
/* png_sig was changed to a function in version 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. */ /* Place to hold the signature string for a PNG file. */
@ -561,7 +561,7 @@ png_charp
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */ if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
return ("\n libpng version 1.0.6e - April 10, 2000\n\ return ("\n libpng version 1.0.6f - April 14, 2000\n\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\
Copyright (c) 1996, 1997 Andreas Dilger\n\ Copyright (c) 1996, 1997 Andreas Dilger\n\
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\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 */ /* Version of *.c files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return("1.0.6e"); return("1.0.6f");
return("1.0.6e"); return("1.0.6f");
} }
png_charp png_charp

54
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.0.6e - April 10, 2000 * libpng version 1.0.6f - April 14, 2000
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -9,7 +9,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * 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.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.6e - April 10, 2000: Glenn * libpng versions 0.97, January 1998, through 1.0.6f - April 14, 2000: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * 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.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.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.6 (+ 3 patches) 1.0.6 10006 2.1.0.6
* 1.0.6d-e 1.0.6d-e 10007 2.1.0.6d-e * 1.0.6d-f 1.0.6d-f 10007 2.1.0.6d-f
* 1.0.7 1.0.7 10007 2.1.0.7 (still compatible) * 1.0.7 1.0.7 10007 2.1.0.7 (still compatible)
* *
* Henceforth the source version will match the shared-library minor * Henceforth the source version will match the shared-library minor
@ -73,7 +73,7 @@
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* (libpng versions 0.89c, June 1996, through 0.96, May 1997) * (libpng versions 0.89c, June 1996, through 0.96, May 1997)
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000) * (libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000)
* *
* For the purposes of this copyright and license, "Contributing Authors" * For the purposes of this copyright and license, "Contributing Authors"
* is defined as the following set of individuals: * is defined as the following set of individuals:
@ -148,13 +148,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* April 10, 2000 * April 14, 2000
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.0.6e are Y2K compliant. It is my belief that earlier * upward through 1.0.6f are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant. * versions were also Y2K compliant.
* *
* Libpng only has three year fields. One is a 2-byte unsigned integer * 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 */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.6e" #define PNG_LIBPNG_VER_STRING "1.0.6f"
/* Careful here. At one time, Guy wanted to use 082, but that would be octal. /* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros. * We must not include leading zeros.
@ -323,6 +323,11 @@ typedef struct png_sPLT_entry_struct
typedef png_sPLT_entry FAR * png_sPLT_entryp; typedef png_sPLT_entry FAR * png_sPLT_entryp;
typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp; typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
/* When the depth of the sPLT palette is 8 bits, the color and alpha samples
* occupy the LSB of their respective members, and the MSB of each member
* is zero-filled. The frequency member always occupies the full 16 bits.
*/
typedef struct png_sPLT_struct typedef struct png_sPLT_struct
{ {
png_charp name; /* palette name */ png_charp name; /* palette name */
@ -336,7 +341,12 @@ typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
#ifdef PNG_TEXT_SUPPORTED #ifdef PNG_TEXT_SUPPORTED
/* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
* and whether that contents is compressed or not. The "key" field * and whether that contents is compressed or not. The "key" field
* points to a regular C string. */ * points to a regular zero-terminated C string. The "text", "lang", and
* "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
* However, the * structure returned by png_get_text() will always contain
* regular zero-terminated C strings (possibly empty), never NULL pointers,
* so they can be safely used in printf() and other string-handling functions.
*/
typedef struct png_text_struct typedef struct png_text_struct
{ {
int compression; /* compression value: int compression; /* compression value:
@ -345,12 +355,14 @@ typedef struct png_text_struct
1: iTXt, none 1: iTXt, none
2: iTXt, deflate */ 2: iTXt, deflate */
png_charp key; /* keyword, 1-79 character description of "text" */ png_charp key; /* keyword, 1-79 character description of "text" */
png_charp text; /* comment, may be an empty string (ie "") */ png_charp text; /* comment, may be an empty string (ie "")
or a NULL pointer */
png_size_t text_length; /* length of the text string */ png_size_t text_length; /* length of the text string */
png_size_t itxt_length; /* length of the itxt string */ png_size_t itxt_length; /* length of the itxt string */
png_charp lang; /* language code, 1-79 characters */ png_charp lang; /* language code, 0-79 characters
or a NULL pointer */
png_charp lang_key; /* keyword translated UTF-8 string, 0 or more png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
chars */ chars or a NULL pointer */
} png_text; } png_text;
typedef png_text FAR * png_textp; typedef png_text FAR * png_textp;
typedef png_text FAR * FAR * png_textpp; typedef png_text FAR * FAR * png_textpp;
@ -1061,9 +1073,9 @@ struct png_struct_def
}; };
/* This prevents a compiler error in png_get_copyright() in png.c if png.c /* This prevents a compiler error in png_get_copyright() in png.c if png.c
and png.h are both at * version 1.0.6e and png.h are both at * version 1.0.6f
*/ */
typedef png_structp version_1_0_6e; typedef png_structp version_1_0_6f;
typedef png_struct FAR * FAR * png_structpp; typedef png_struct FAR * FAR * png_structpp;
@ -1910,18 +1922,20 @@ extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries)); png_infop info_ptr, png_sPLT_tp entries, int nentries));
#endif #endif
#if defined(PNG_TEXT_SUPPORTED)
extern PNG_EXPORT(void,png_set_itxt) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
#if defined(PNG_READ_TEXT_SUPPORTED) #if defined(PNG_READ_TEXT_SUPPORTED)
/* Old interface; apps should use png_get_itxt instead */
/* png_get_text also returns the number of text chunks in *num_text */ /* png_get_text also returns the number of text chunks in *num_text */
extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp *text_ptr, int *num_text)); png_infop info_ptr, png_textp *text_ptr, int *num_text));
#endif #endif
/*
* Note while png_set_text() will accept a structure whose text,
* language, and translated keywords are NULL pointers, the structure
* returned by png_get_text will always contain regular
* zero-terminated C strings. They might be empty strings but
* they will never be NULL pointers.
*/
#if defined(PNG_TEXT_SUPPORTED) #if defined(PNG_TEXT_SUPPORTED)
extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text)); png_infop info_ptr, png_textp text_ptr, int num_text));
@ -2044,7 +2058,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)); extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.6e - April 10, 2000 (header)\n" " libpng version 1.0.6f - April 14, 2000 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on /* With these routines we avoid an integer divide, which will be slower on

View File

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

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -6,7 +6,7 @@
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code. * for Intel's performance analysis of the MMX vs. non-MMX code.
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, Intel Corporation
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * 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 * not called png_set_interlace_handling(), the display_row buffer will
* be ignored, so pass NULL to it. * be ignored, so pass NULL to it.
* *
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6e. * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6f.
*/ */
void 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 * only call this function once. If you desire to have an image for
* each pass of a interlaced image, use png_read_rows() instead. * each pass of a interlaced image, use png_read_rows() instead.
* *
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6e. * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6f.
*/ */
void void
png_read_image(png_structp png_ptr, png_bytepp image) png_read_image(png_structp png_ptr, png_bytepp image)
@ -834,8 +834,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
*/ */
if (length > 0 || png_ptr->mode & PNG_AFTER_IDAT) if (length > 0 || png_ptr->mode & PNG_AFTER_IDAT)
png_error(png_ptr, "Too many IDAT's found"); png_error(png_ptr, "Too many IDAT's found");
else png_crc_finish(png_ptr, length);
png_crc_finish(png_ptr, 0);
} }
else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4))
png_handle_PLTE(png_ptr, info_ptr, length); png_handle_PLTE(png_ptr, info_ptr, length);

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@ -133,7 +133,7 @@ png_crc_error(png_structp png_ptr)
} }
#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \ #if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \
defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_sPLT_SUPPORTED) defined(PNG_READ_iCCP_SUPPORTED)
/* /*
* Decompress trailing data in a chunk. The assumption is that chunkdata * Decompress trailing data in a chunk. The assumption is that chunkdata
* points at an allocated area holding the contents of a chunk with a * points at an allocated area holding the contents of a chunk with a
@ -951,7 +951,8 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (profile >= chunkdata + slength) if (profile >= chunkdata + slength)
{ {
png_free(png_ptr, chunkdata); png_free(png_ptr, chunkdata);
png_error(png_ptr, "malformed iCCP chunk"); png_warning(png_ptr, "malformed iCCP chunk");
return;
} }
/* compression should always be zero */ /* compression should always be zero */
@ -1019,7 +1020,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (entry_start > chunkdata + slength) if (entry_start > chunkdata + slength)
{ {
png_free(png_ptr, chunkdata); png_free(png_ptr, chunkdata);
png_error(png_ptr, "malformed sPLT chunk"); png_warning(png_ptr, "malformed sPLT chunk");
return;
} }
new_palette.depth = *entry_start++; new_palette.depth = *entry_start++;
@ -1563,7 +1565,10 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
width = strtod(ep, &vp); width = strtod(ep, &vp);
if (*vp) if (*vp)
png_error(png_ptr, "malformed width string in sCAL chunk"); {
png_warning(png_ptr, "malformed width string in sCAL chunk");
return;
}
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
swidth = (png_charp)png_malloc(png_ptr, strlen(ep) + 1); swidth = (png_charp)png_malloc(png_ptr, strlen(ep) + 1);
@ -1578,7 +1583,10 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
height = strtod(ep, &vp); height = strtod(ep, &vp);
if (*vp) if (*vp)
png_error(png_ptr, "malformed height string in sCAL chunk"); {
png_warning(png_ptr, "malformed height string in sCAL chunk");
return;
}
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
sheight = (png_charp)png_malloc(png_ptr, strlen(ep) + 1); sheight = (png_charp)png_malloc(png_ptr, strlen(ep) + 1);

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@ -421,18 +421,25 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp name, int compression_type, png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen) png_charp profile, png_uint_32 proflen)
{ {
png_charp new_iccp_name;
png_charp new_iccp_profile;
png_debug1(1, "in %s storage function\n", "iCCP"); png_debug1(1, "in %s storage function\n", "iCCP");
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
return; return;
new_iccp_name = png_malloc(png_ptr, png_strlen(name)+1);
strcpy(new_iccp_name, name);
new_iccp_profile = png_malloc(png_ptr, proflen);
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
info_ptr->iccp_name = png_malloc(png_ptr, png_strlen(name)+1);
strcpy(info_ptr->iccp_name, name);
info_ptr->iccp_profile = png_malloc(png_ptr, proflen);
png_memcpy(info_ptr->iccp_profile, profile, (png_size_t)proflen);
info_ptr->iccp_proflen = proflen; info_ptr->iccp_proflen = proflen;
info_ptr->iccp_name = new_iccp_name;
info_ptr->iccp_profile = new_iccp_profile;
/* Compression is always zero but is here so the API and info structure /* Compression is always zero but is here so the API and info structure
* does not have to change * if we introduce multiple compression types */ * does not have to change if we introduce multiple compression types */
info_ptr->iccp_compression = (png_byte)compression_type; info_ptr->iccp_compression = (png_byte)compression_type;
info_ptr->free_me |= PNG_FREE_ICCP; info_ptr->free_me |= PNG_FREE_ICCP;
info_ptr->valid |= PNG_INFO_iCCP; info_ptr->valid |= PNG_INFO_iCCP;
@ -495,8 +502,14 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
if(text_ptr[i].compression > 0) if(text_ptr[i].compression > 0)
{ {
/* set iTXt data */ /* set iTXt data */
if (text_ptr[i].key != (png_charp)NULL)
lang_len = png_strlen(text_ptr[i].lang); lang_len = png_strlen(text_ptr[i].lang);
else
lang_len = 0;
if (text_ptr[i].lang_key != (png_charp)NULL)
lang_key_len = png_strlen(text_ptr[i].lang_key); lang_key_len = png_strlen(text_ptr[i].lang_key);
else
lang_key_len = 0;
} }
else else
{ {
@ -504,7 +517,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
lang_key_len = 0; lang_key_len = 0;
} }
if (text_ptr[i].text[0] == '\0') if (text_ptr[i].text == (png_charp)NULL || text_ptr[i].text[0] == '\0')
{ {
text_length = 0; text_length = 0;
if(text_ptr[i].compression > 0) if(text_ptr[i].compression > 0)
@ -538,19 +551,15 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
} }
else else
{ {
textp->lang=NULL; textp->lang=(png_charp)NULL;
textp->lang_key=NULL; textp->lang_key=(png_charp)NULL;
textp->text=textp->key + key_len + 1; textp->text=textp->key + key_len + 1;
} }
if(text_length) if(text_length)
{
png_memcpy(textp->text, text_ptr[i].text, png_memcpy(textp->text, text_ptr[i].text,
(png_size_t)(text_length)); (png_size_t)(text_length));
*(textp->text+text_length) = '\0'; *(textp->text+text_length) = '\0';
}
else
textp->text--;
if(textp->compression > 0) if(textp->compression > 0)
{ {
@ -755,8 +764,11 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
if(info_ptr->row_pointers != row_pointers)
{
png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
info_ptr->row_pointers = row_pointers; info_ptr->row_pointers = row_pointers;
}
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@ -1344,4 +1344,4 @@ main(int argc, char *argv[])
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_6e your_png_h_is_not_version_1_0_6e; typedef version_1_0_6f your_png_h_is_not_version_1_0_6f;

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

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

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* libpng 1.0.6e - April 10, 2000 * libpng 1.0.6f - April 14, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * 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 # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.6e PNGMIN = 1.0.6f
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h # 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 # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.6e PNGMIN = 1.0.6f
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
CC=cc 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 # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.6e PNGMIN = 1.0.6f
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include 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 # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.6e PNGMIN = 1.0.6f
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include 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 # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.6e PNGMIN = 1.0.6f
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include 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 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=gcc -shared LDSHARED=gcc -shared
VER=1.0.6e VER=1.0.6f
LIBS=libpng.so.1.0.6e LIBS=libpng.so.1.0.6f
SHAREDLIB=libpng.so SHAREDLIB=libpng.so
libdir=$(prefix)/lib32 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 # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.6e PNGMIN = 1.0.6f
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

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