Imported from libpng-1.0.6i.tar
This commit is contained in:
parent
326320e5a9
commit
6942d53c25
22
ANNOUNCE
22
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.0.6h - April 24, 2000
|
||||
Libpng 1.0.6i - May 1, 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.
|
||||
@ -33,13 +33,31 @@ 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.6h [April 24, 2000]
|
||||
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).
|
||||
version 1.0.6h [April 24, 2000]
|
||||
Changed shared library so-number pattern from 2.x.y.z to xy.z (this builds
|
||||
libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h)
|
||||
version 1.0.6i [May 1, 2000]
|
||||
Added documentation of user memory functions in libpng.txt/libpng.3
|
||||
Modified png_read_png so that it will use user_allocated row_pointers
|
||||
if present, unless free_me directs that it be freed, and added description
|
||||
of the use of png_set_rows() and png_get_rows() in libpng.txt/libpng.3.
|
||||
Added PNG_LEGACY_SUPPORTED macro, and #ifdef out all new (since version
|
||||
1.00) members of png_struct and png_info, to regain binary compatibility
|
||||
when you define this macro. Capabilities lost in this event
|
||||
are user transforms (new in version 1.0.0),the user transform pointer
|
||||
(new in version 1.0.2), rgb_to_gray (new in 1.0.5), iCCP, sCAL, sPLT,
|
||||
the high-level interface, and unknown chunks support (all new in 1.0.6).
|
||||
This was necessary because of old applications that allocate the structs
|
||||
directly instead of using png_create_*(), as authors were instructed to
|
||||
do in libpng-0.88 and earlier.
|
||||
Added makefile.intel and updated makefile.watcom (Pawel Mrochen)
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
25
CHANGES
25
CHANGES
@ -699,6 +699,31 @@ version 1.0.6g [April 24, 2000]
|
||||
version 1.0.6h [April 24, 2000]
|
||||
Changed shared library so-number pattern from 2.x.y.z to xy.z (this builds
|
||||
libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h)
|
||||
version 1.0.6i [May 1, 2000]
|
||||
Rearranged some members at the end of png_info and png_struct, to put
|
||||
unknown_chunks_num and free_me within the original size of the png_structs
|
||||
and free_me, png_read_user_fn, and png_free_fn within the original png_info,
|
||||
because some old applications allocate the structs directly instead of
|
||||
using png_create_*().
|
||||
Added documentation of user memory functions in libpng.txt/libpng.3
|
||||
Modified png_read_png so that it will use user_allocated row_pointers
|
||||
if present, unless free_me directs that it be freed, and added description
|
||||
of the use of png_set_rows() and png_get_rows() in libpng.txt/libpng.3.
|
||||
Added PNG_LEGACY_SUPPORTED macro, and #ifdef out all new (since version
|
||||
1.00) members of png_struct and png_info, to regain binary compatibility
|
||||
when you define this macro. Capabilities lost in this event
|
||||
are user transforms (new in version 1.0.0),the user transform pointer
|
||||
(new in version 1.0.2), rgb_to_gray (new in 1.0.5), iCCP, sCAL, sPLT,
|
||||
the high-level interface, and unknown chunks support (all new in 1.0.6).
|
||||
This was necessary because of old applications that allocate the structs
|
||||
directly instead of using png_create_*(), as authors were instructed to
|
||||
do in libpng-0.88 and earlier.
|
||||
Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which
|
||||
can be used to detect codes that directly allocate the structs, and
|
||||
code to check these modes in png_read_init() and png_write_init() and
|
||||
generate a libpng error if the modes aren't set and PNG_LEGACY_SUPPORTED
|
||||
was not defined.
|
||||
Added makefile.intel and updated makefile.watcom (Pawel Mrochen)
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
12
INSTALL
12
INSTALL
@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.0.6h - April 24, 2000
|
||||
Installing libpng version 1.0.6i - May 1, 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.6h" or "lpng106" and "zlib-1.1.3"
|
||||
might be called "libpng-1.0.6i" 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.6h)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6h,
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6i)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6i,
|
||||
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.6h)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6i)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6h)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6i)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mips => MIPS makefile
|
||||
makefile.acorn => Acorn makefile
|
||||
|
62
KNOWNBUG
62
KNOWNBUG
@ -1,21 +1,57 @@
|
||||
|
||||
Known bugs and suggested enhancements in libpng-1.0.6
|
||||
|
||||
1. April 23, 2000 -- BUG -- binary incompatibility
|
||||
1. April 24, 2000 -- BUG -- binary incompatibility
|
||||
|
||||
Libpng-1.0.6 is binary incompatible with old applications that
|
||||
allocate the png_struct and png_info structures themselves instead
|
||||
of using png_create_*(). They do not allocate enough space for
|
||||
the structures because they have an incorrect notion of
|
||||
sizeof(png_struct) and sizeof(png_info). Although such applications
|
||||
should be considered broken rather than considering libpng to be broken,
|
||||
they are numerous and include products of the PNG group, such
|
||||
as gif2png and pnmtopng-2.36 (pnmtopng-2.37 is OK), so libpng will
|
||||
be fixed in version 1.0.7 to work around this problem.
|
||||
|
||||
Applications that use png_create_*() instead of png_ptr=malloc(...)
|
||||
are immune to this problem.
|
||||
|
||||
STATUS: Fixed in libpng-1.0.6ad, libpng-1.0.6i, and patch-d
|
||||
which are currently being tested by the PNG group.
|
||||
The fix necessarily reintroduces a binary incompatibility with any
|
||||
application that makes direct access to the png_info and
|
||||
png_struct members that deal with the pCAL chunk, palette_lookup,
|
||||
dither_index, time_buffer, or weighted filtering, i.e., any members
|
||||
coming after the new "free_me" member of either structure. It
|
||||
is believed that applications affected by this reintroduced binary
|
||||
incompatibility are rare (none are known to the PNG group). An
|
||||
effective workaround for this and the next bug is to recompile the
|
||||
old applications with the installed version of libpng.
|
||||
|
||||
2. 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.
|
||||
make direct access to members of the png_struct and png_info structures,
|
||||
due to the insertion of the free_me member ahead of some previously
|
||||
existing members.
|
||||
|
||||
STATUS: Fixed in libpng-1.0.6g
|
||||
Applications that use png_set_*(), png_get_*() are immune to this
|
||||
problem, but people are still to this day writing applications that
|
||||
make ill-advised direct access to members of the png_struct and
|
||||
png_info structures, so libpng-1.0.6 will be patched to work around
|
||||
this problem.
|
||||
|
||||
2. April 15, 2000 -- BUG -- pnggccrd.c
|
||||
STATUS: Fixed in libpng-1.0.6g and patch-d, which are currently being
|
||||
tested by the PNG group. Users can work around the problem without
|
||||
patching libpng by recompiling their applications.
|
||||
|
||||
3. 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
|
||||
4. 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
|
||||
@ -25,21 +61,21 @@ Known bugs and suggested enhancements in libpng-1.0.6
|
||||
bit in info_ptr->free_me is now checked to make sure libpng is responsible
|
||||
for freeing the memory.
|
||||
|
||||
4. April 1, 2000 -- BUG
|
||||
5. 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-c and libpng-1.0.6d.
|
||||
|
||||
5. March 24, 2000 -- BUG
|
||||
6. 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-b and libpng-1.0.6d.
|
||||
|
||||
6. March 22, 2000 -- BUG
|
||||
7. 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.
|
||||
@ -47,7 +83,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
|
||||
STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d. The strcpy()
|
||||
function is used instead.
|
||||
|
||||
7. March 22, 2000 -- BUG
|
||||
8. March 22, 2000 -- BUG
|
||||
|
||||
The length of the iCCP chunk data is calculated incorrectly; because
|
||||
it can contain zeroes, strlen() doesn't work.
|
||||
@ -55,7 +91,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
|
||||
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.
|
||||
|
||||
8. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
|
||||
9. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
|
||||
|
||||
Loops need to be optimized everywhere
|
||||
|
||||
@ -70,7 +106,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.
|
||||
|
||||
9. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
|
||||
10. 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
|
||||
@ -82,7 +118,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
|
||||
|
||||
STATUS: under development.
|
||||
|
||||
10. September 1999 -- ENHANCEMENT --
|
||||
11. September 1999 -- ENHANCEMENT --
|
||||
|
||||
It should be possible to use libpng without floating-point aritmetic.
|
||||
|
||||
|
4
LICENSE
4
LICENSE
@ -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.6h, April 24, 2000)
|
||||
(libpng versions 0.97, January 1998, through 1.0.6i, May 1, 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 24, 2000
|
||||
May 1, 2000
|
||||
|
10
README
10
README
@ -1,4 +1,4 @@
|
||||
README for libpng 1.0.6h - April 24, 2000 (shared library 2.1)
|
||||
README for libpng 1.0.6i - May 1, 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.6h)
|
||||
(gcc, creates libpng.so.2.1.0.6i)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||
libpng.so.2.1.0.6h, uses assembler code
|
||||
libpng.so.2.1.0.6i, 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.6h)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6i)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng.so.2.1.0.6h)
|
||||
(gcc, creates libpng.so.2.1.0.6i)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mips => MIPS makefile
|
||||
makefile.acorn => Acorn makefile
|
||||
|
4
Y2KINFO
4
Y2KINFO
@ -1,13 +1,13 @@
|
||||
Y2K compliance in libpng:
|
||||
=========================
|
||||
|
||||
April 24, 2000
|
||||
May 1, 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.6h are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.6i 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
2
configure
vendored
@ -1,5 +1,5 @@
|
||||
echo "
|
||||
There is no \"configure\" script for Libpng-1.0.6h. Instead, please
|
||||
There is no \"configure\" script for Libpng-1.0.6i. Instead, please
|
||||
copy the appropriate makefile for your system from the \"scripts\"
|
||||
directory. Read the INSTALL file for more details.
|
||||
"
|
||||
|
@ -307,6 +307,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||
}
|
||||
|
||||
/* flip the RGB pixels to BGR (or RGBA to BGRA) */
|
||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||
png_set_bgr(png_ptr);
|
||||
|
||||
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
||||
|
138
libpng.3
138
libpng.3
@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "April 24, 2000"
|
||||
.TH LIBPNG 3 "May 1, 2000"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6i
|
||||
.SH SYNOPSIS
|
||||
\fI\fB
|
||||
|
||||
@ -725,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.6h - April 24, 2000
|
||||
libpng version 1.0.6i - May 1, 2000
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@ -1062,14 +1062,39 @@ dithering, and setting filler.) If this is the case, simply do this:
|
||||
|
||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||
|
||||
where png_transforms is an integer containing the logical-or of some set of
|
||||
transformation flags. This call is equivalent to png_read_info(),
|
||||
where png_transforms is an integer containing the logical OR of
|
||||
some set of transformation flags. This call is equivalent to png_read_info(),
|
||||
followed the set of transformations indicated by the transform mask,
|
||||
followed by png_update_info(), followed by a read of the image bytes
|
||||
to the info_ptr, followed by png_read_end().
|
||||
then png_read_image(), and finally png_read_end().
|
||||
|
||||
(The final parameter of this call is not yet used. Someday it
|
||||
will point to transformation parameters.)
|
||||
(The final parameter of this call is not yet used. Someday it might point
|
||||
to transformation parameters required by some future input transform.)
|
||||
|
||||
After you have called png_read_png(), you can retrieve the image data
|
||||
with
|
||||
|
||||
row_pointers = png_get_rows(png_ptr, info_ptr);
|
||||
|
||||
where row_pointers is an array of pointers to the pixel data for each row:
|
||||
|
||||
png_bytep row_pointers[height];
|
||||
|
||||
If you know your image size and pixel size ahead of time, you can allocate
|
||||
row_pointers prior to calling png_read_png() with
|
||||
|
||||
row_pointers = png_malloc(png_ptr, height*sizeof(png_bytep));
|
||||
for (int i=0; i<height, i++)
|
||||
row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
|
||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||
|
||||
Alternatively you could allocate your image in one big block and define
|
||||
row_pointers[i] to point into the proper places in your block.
|
||||
|
||||
If you use png_set_rows(), the application is responsible for freeing
|
||||
row_pointers (and row_pointers[i], if they were separately allocated).
|
||||
|
||||
If you don't allocate row_pointers ahead of time, png_read_png() will
|
||||
do it, and it'll be free'ed when you call png_destroy_*().
|
||||
|
||||
.SS The low-level read interface
|
||||
|
||||
@ -1124,8 +1149,8 @@ in until png_read_end() has read the chunk data following the image.
|
||||
interlace_type - (PNG_INTERLACE_NONE or
|
||||
PNG_INTERLACE_ADAM7)
|
||||
Any or all of interlace_type, compression_type, of
|
||||
filter_type can be
|
||||
NULL if you are not interested in their values.
|
||||
filter_type can be NULL if you are not
|
||||
interested in their values.
|
||||
|
||||
channels = png_get_channels(png_ptr, info_ptr);
|
||||
channels - number of channels of info for the
|
||||
@ -1872,7 +1897,7 @@ point to libpng-allocated storage with the following functions:
|
||||
|
||||
png_free_data(png_ptr, info_ptr, mask, n)
|
||||
mask - identifies data to be freed, a mask
|
||||
made up by the OR one or more of
|
||||
containing the logical OR of one or more of
|
||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||
PNG_FREE_SPLT, PNG_FREE_ROWS,
|
||||
@ -1887,12 +1912,12 @@ by the user and not by libpng, and will in those
|
||||
cases do nothing. The "n" parameter is ignored if only one item
|
||||
of the selected data type, such as PLTE, is allowed. If "n" is not
|
||||
-1, and multiple items are allowed for the data type identified in
|
||||
the mask, such as text or splt, only the n'th item is freed.
|
||||
the mask, such as text or sPLT, only the n'th item is freed.
|
||||
|
||||
The default behavior is only to free data that was allocated internally
|
||||
by libpng. This can be changed, so that libpng will not free the data,
|
||||
or so that it will also free data that was passed in via a png_set_*()
|
||||
function, with
|
||||
or so that it will free data that was allocated by the user with png_malloc()
|
||||
or png_zalloc() and passed in via a png_set_*() function, with
|
||||
|
||||
png_data_freer(png_ptr, info_ptr, freer, mask)
|
||||
mask - which data elements are affected
|
||||
@ -1907,7 +1932,14 @@ You can call this function after reading the PNG data but before calling
|
||||
any png_set_*() functions, to control whether the user or the png_set_*()
|
||||
function is responsible for freeing any existing data that might be present,
|
||||
and again after the png_set_*() functions to control whether the user
|
||||
or png_destroy_*() is supposed to free the data..
|
||||
or png_destroy_*() is supposed to free the data. When the user assumes
|
||||
responsibility for libpng-allocated data, the application must use
|
||||
png_free() to free it.
|
||||
|
||||
If you allocated your row_pointers in a single block, as suggested above in
|
||||
the description of the high level read interface, you must not transfer
|
||||
responsibility for freeing it to the png_set_rows or png_read_destroy function,
|
||||
because they would also try to free the individual row_pointers[i].
|
||||
|
||||
For a more compact example of reading a PNG image, see the file example.c.
|
||||
|
||||
@ -2200,7 +2232,7 @@ types.
|
||||
|
||||
/* turn on or off filtering, and/or choose
|
||||
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
|
||||
or the "OR" of one or more PNG_FILTER_NAME masks. */
|
||||
or the logical OR of one or more PNG_FILTER_NAME masks. */
|
||||
png_set_filter(png_ptr, 0,
|
||||
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
||||
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
|
||||
@ -2497,7 +2529,7 @@ Compressed pairs must have a text string, as only the text string
|
||||
is compressed anyway, so the compression would be meaningless.
|
||||
|
||||
PNG supports modification time via the png_time structure. Two
|
||||
conversion routines are proved, png_convert_from_time_t() for
|
||||
conversion routines are provided, png_convert_from_time_t() for
|
||||
time_t and png_convert_from_struct_tm() for struct tm. The
|
||||
time_t routine uses gmtime(). You don't have to use either of
|
||||
these, but if you wish to fill in the png_time structure directly,
|
||||
@ -2553,14 +2585,13 @@ If you have valid image data in the info structure, simply do this:
|
||||
|
||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||
|
||||
where png_transforms is an integer containing the logical-or of some set of
|
||||
where png_transforms is an integer containing the logical OR of some set of
|
||||
transformation flags. This call is equivalent to png_write_info(),
|
||||
followed by the set of transformations indicated by the transform
|
||||
mask, followed by followed by a write of the image bytes from the
|
||||
info_ptr, followed by png_write_end().
|
||||
followed the set of transformations indicated by the transform mask,
|
||||
then png_write_image(), and finally png_write_end().
|
||||
|
||||
(The final parameter of this call is not yet used. Someday it
|
||||
may point to output transformation parameters.)
|
||||
(The final parameter of this call is not yet used. Someday it might point
|
||||
to transformation parameters required by some future output transform.)
|
||||
|
||||
.SS The low-level write interface
|
||||
|
||||
@ -2811,7 +2842,7 @@ point to libpng-allocated storage with the following functions:
|
||||
|
||||
png_free_data(png_ptr, info_ptr, mask, n)
|
||||
mask - identifies data to be freed, a mask
|
||||
made up by the OR one or more of
|
||||
containing the logical OR of one or more of
|
||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||
PNG_FREE_SPLT, PNG_FREE_ROWS,
|
||||
@ -2821,20 +2852,21 @@ point to libpng-allocated storage with the following functions:
|
||||
(-1 for all items)
|
||||
|
||||
These functions may be safely called when the relevant storage has
|
||||
already been freed, or has not yet been allocated, and will in that
|
||||
case do nothing. The "n" parameter is ignored if only one item
|
||||
already been freed, or has not yet been allocated, or was allocated
|
||||
by the user and not by libpng, and will in those
|
||||
cases do nothing. The "n" parameter is ignored if only one item
|
||||
of the selected data type, such as PLTE, is allowed. If "n" is not
|
||||
-1, and multiple items are allowed for the data type identified in
|
||||
the mask, such as text or splt, only the n'th item is freed.
|
||||
the mask, such as text or sPLT, only the n'th item is freed.
|
||||
|
||||
If you allocated data such as a palette that you passed in to libpng with
|
||||
png_set_*, you must not free it until just before the call to
|
||||
If you allocated data such as a palette that you passed
|
||||
in to libpng with png_set_*, you must not free it until just before the call to
|
||||
png_destroy_write_struct().
|
||||
|
||||
The default behavior is only to free data that was allocated internally
|
||||
by libpng. This can be changed, so that libpng will not free the data,
|
||||
or so that it will free data that was passed in via a png_set_*() function,
|
||||
with
|
||||
or so that it will free data that was allocated by the user with png_malloc()
|
||||
or png_zalloc() and passed in via a png_set_*() function, with
|
||||
|
||||
png_data_freer(png_ptr, info_ptr, freer, mask)
|
||||
mask - which data elements are affected
|
||||
@ -2860,6 +2892,12 @@ 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
|
||||
structure.
|
||||
|
||||
This function only affects data that has already been allocated.
|
||||
You can call this function before calling after the png_set_*() functions
|
||||
to control whether the user or png_destroy_*() is supposed to free the data.
|
||||
When the user assumes responsibility for libpng-allocated data, the
|
||||
application must use png_free() to free it.
|
||||
|
||||
For a more compact example of writing a PNG image, see the file example.c.
|
||||
|
||||
.SH V. Modifying/Customizing libpng:
|
||||
@ -2874,20 +2912,32 @@ goes through callbacks that are user settable. The default routines are
|
||||
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_malloc() and png_free().
|
||||
These currently just call the standard C functions. If
|
||||
Memory allocation is done through the functions png_malloc(), png_zalloc(),
|
||||
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
|
||||
functions must be modified in the library at compile time.
|
||||
functions must be modified in the library at compile time. If you prefer
|
||||
to use a different method of allocating and freeing data, you can use
|
||||
|
||||
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
||||
malloc_fn, png_free_ptr free_fn)
|
||||
|
||||
This function also provides a void pointer that can be retrieved via
|
||||
|
||||
mem_ptr=png_get_mem_ptr(png_ptr);
|
||||
|
||||
Your replacement memory functions must have prototypes as follows:
|
||||
|
||||
png_voidp malloc_fn(png_structp png_ptr, png_uint_32 size);
|
||||
void free_fn(png_structp png_ptr, png_voidp ptr);
|
||||
|
||||
Input/Output in libpng is done through png_read() and png_write(),
|
||||
which currently just call fread() and fwrite(). The FILE * is stored in
|
||||
png_struct and is initialized via png_init_io(). If you wish to change
|
||||
the method of I/O, the library supplies callbacks that you can set
|
||||
through the function png_set_read_fn() and png_set_write_fn() at run
|
||||
time, instead of calling the png_init_io() function.
|
||||
These functions
|
||||
time, instead of calling the png_init_io() function. These functions
|
||||
also provide a void pointer that can be retrieved via the function
|
||||
png_get_io_ptr(). For example:
|
||||
|
||||
@ -2901,7 +2951,7 @@ png_get_io_ptr(). For example:
|
||||
voidp read_io_ptr = png_get_io_ptr(read_ptr);
|
||||
voidp write_io_ptr = png_get_io_ptr(write_ptr);
|
||||
|
||||
The replacement I/O functions should have prototypes as follows:
|
||||
The replacement I/O functions must have prototypes as follows:
|
||||
|
||||
void user_read_data(png_structp png_ptr,
|
||||
png_bytep data, png_uint_32 length);
|
||||
@ -3074,8 +3124,8 @@ to turn filtering on and off, respectively.
|
||||
|
||||
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
|
||||
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
|
||||
ORed together '|' to specify one or more filters to use. These
|
||||
filters are described in more detail in the PNG specification. If
|
||||
ORed together with '|' to specify one or more filters to use.
|
||||
These filters are described in more detail in the PNG specification. If
|
||||
you intend to change the filter type during the course of writing
|
||||
the image, you should start with flags set for all of the filters
|
||||
you intend to use so that libpng can initialize its internal
|
||||
@ -3237,13 +3287,13 @@ the old method.
|
||||
|
||||
.SH VII. Y2K Compliance in libpng
|
||||
|
||||
April 24, 2000
|
||||
May 1, 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.6h are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.6i 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
|
||||
@ -3384,7 +3434,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.0.6h - April 24, 2000:
|
||||
Libpng version 1.0.6i - May 1, 2000:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
|
||||
|
||||
@ -3399,7 +3449,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.6h, April 24, 2000)
|
||||
(libpng versions 0.97, January 1998, through 1.0.6i, May 1, 2000)
|
||||
|
||||
For the purposes of this copyright and license, "Contributing Authors"
|
||||
is defined as the following set of individuals:
|
||||
|
130
libpng.txt
130
libpng.txt
@ -1,6 +1,6 @@
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.0.6h - April 24, 2000
|
||||
libpng version 1.0.6i - May 1, 2000
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@ -337,14 +337,39 @@ dithering, and setting filler.) If this is the case, simply do this:
|
||||
|
||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||
|
||||
where png_transforms is an integer containing the logical-or of some set of
|
||||
transformation flags. This call is equivalent to png_read_info(),
|
||||
where png_transforms is an integer containing the logical OR of
|
||||
some set of transformation flags. This call is equivalent to png_read_info(),
|
||||
followed the set of transformations indicated by the transform mask,
|
||||
followed by png_update_info(), followed by a read of the image bytes
|
||||
to the info_ptr, followed by png_read_end().
|
||||
then png_read_image(), and finally png_read_end().
|
||||
|
||||
(The final parameter of this call is not yet used. Someday it
|
||||
will point to transformation parameters.)
|
||||
(The final parameter of this call is not yet used. Someday it might point
|
||||
to transformation parameters required by some future input transform.)
|
||||
|
||||
After you have called png_read_png(), you can retrieve the image data
|
||||
with
|
||||
|
||||
row_pointers = png_get_rows(png_ptr, info_ptr);
|
||||
|
||||
where row_pointers is an array of pointers to the pixel data for each row:
|
||||
|
||||
png_bytep row_pointers[height];
|
||||
|
||||
If you know your image size and pixel size ahead of time, you can allocate
|
||||
row_pointers prior to calling png_read_png() with
|
||||
|
||||
row_pointers = png_malloc(png_ptr, height*sizeof(png_bytep));
|
||||
for (int i=0; i<height, i++)
|
||||
row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
|
||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||
|
||||
Alternatively you could allocate your image in one big block and define
|
||||
row_pointers[i] to point into the proper places in your block.
|
||||
|
||||
If you use png_set_rows(), the application is responsible for freeing
|
||||
row_pointers (and row_pointers[i], if they were separately allocated).
|
||||
|
||||
If you don't allocate row_pointers ahead of time, png_read_png() will
|
||||
do it, and it'll be free'ed when you call png_destroy_*().
|
||||
|
||||
The low-level read interface
|
||||
|
||||
@ -399,8 +424,8 @@ in until png_read_end() has read the chunk data following the image.
|
||||
interlace_type - (PNG_INTERLACE_NONE or
|
||||
PNG_INTERLACE_ADAM7)
|
||||
Any or all of interlace_type, compression_type, of
|
||||
filter_type can be
|
||||
NULL if you are not interested in their values.
|
||||
filter_type can be NULL if you are not
|
||||
interested in their values.
|
||||
|
||||
channels = png_get_channels(png_ptr, info_ptr);
|
||||
channels - number of channels of info for the
|
||||
@ -1147,7 +1172,7 @@ point to libpng-allocated storage with the following functions:
|
||||
|
||||
png_free_data(png_ptr, info_ptr, mask, n)
|
||||
mask - identifies data to be freed, a mask
|
||||
made up by the OR one or more of
|
||||
containing the logical OR of one or more of
|
||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||
PNG_FREE_SPLT, PNG_FREE_ROWS,
|
||||
@ -1162,12 +1187,12 @@ by the user and not by libpng, and will in those
|
||||
cases do nothing. The "n" parameter is ignored if only one item
|
||||
of the selected data type, such as PLTE, is allowed. If "n" is not
|
||||
-1, and multiple items are allowed for the data type identified in
|
||||
the mask, such as text or splt, only the n'th item is freed.
|
||||
the mask, such as text or sPLT, only the n'th item is freed.
|
||||
|
||||
The default behavior is only to free data that was allocated internally
|
||||
by libpng. This can be changed, so that libpng will not free the data,
|
||||
or so that it will also free data that was passed in via a png_set_*()
|
||||
function, with
|
||||
or so that it will free data that was allocated by the user with png_malloc()
|
||||
or png_zalloc() and passed in via a png_set_*() function, with
|
||||
|
||||
png_data_freer(png_ptr, info_ptr, freer, mask)
|
||||
mask - which data elements are affected
|
||||
@ -1182,7 +1207,14 @@ You can call this function after reading the PNG data but before calling
|
||||
any png_set_*() functions, to control whether the user or the png_set_*()
|
||||
function is responsible for freeing any existing data that might be present,
|
||||
and again after the png_set_*() functions to control whether the user
|
||||
or png_destroy_*() is supposed to free the data..
|
||||
or png_destroy_*() is supposed to free the data. When the user assumes
|
||||
responsibility for libpng-allocated data, the application must use
|
||||
png_free() to free it.
|
||||
|
||||
If you allocated your row_pointers in a single block, as suggested above in
|
||||
the description of the high level read interface, you must not transfer
|
||||
responsibility for freeing it to the png_set_rows or png_read_destroy function,
|
||||
because they would also try to free the individual row_pointers[i].
|
||||
|
||||
For a more compact example of reading a PNG image, see the file example.c.
|
||||
|
||||
@ -1475,7 +1507,7 @@ types.
|
||||
|
||||
/* turn on or off filtering, and/or choose
|
||||
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
|
||||
or the "OR" of one or more PNG_FILTER_NAME masks. */
|
||||
or the logical OR of one or more PNG_FILTER_NAME masks. */
|
||||
png_set_filter(png_ptr, 0,
|
||||
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
||||
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
|
||||
@ -1772,7 +1804,7 @@ Compressed pairs must have a text string, as only the text string
|
||||
is compressed anyway, so the compression would be meaningless.
|
||||
|
||||
PNG supports modification time via the png_time structure. Two
|
||||
conversion routines are proved, png_convert_from_time_t() for
|
||||
conversion routines are provided, png_convert_from_time_t() for
|
||||
time_t and png_convert_from_struct_tm() for struct tm. The
|
||||
time_t routine uses gmtime(). You don't have to use either of
|
||||
these, but if you wish to fill in the png_time structure directly,
|
||||
@ -1828,14 +1860,13 @@ If you have valid image data in the info structure, simply do this:
|
||||
|
||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||
|
||||
where png_transforms is an integer containing the logical-or of some set of
|
||||
where png_transforms is an integer containing the logical OR of some set of
|
||||
transformation flags. This call is equivalent to png_write_info(),
|
||||
followed by the set of transformations indicated by the transform
|
||||
mask, followed by followed by a write of the image bytes from the
|
||||
info_ptr, followed by png_write_end().
|
||||
followed the set of transformations indicated by the transform mask,
|
||||
then png_write_image(), and finally png_write_end().
|
||||
|
||||
(The final parameter of this call is not yet used. Someday it
|
||||
may point to output transformation parameters.)
|
||||
(The final parameter of this call is not yet used. Someday it might point
|
||||
to transformation parameters required by some future output transform.)
|
||||
|
||||
The low-level write interface
|
||||
|
||||
@ -2086,7 +2117,7 @@ point to libpng-allocated storage with the following functions:
|
||||
|
||||
png_free_data(png_ptr, info_ptr, mask, n)
|
||||
mask - identifies data to be freed, a mask
|
||||
made up by the OR one or more of
|
||||
containing the logical OR of one or more of
|
||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||
PNG_FREE_SPLT, PNG_FREE_ROWS,
|
||||
@ -2096,20 +2127,21 @@ point to libpng-allocated storage with the following functions:
|
||||
(-1 for all items)
|
||||
|
||||
These functions may be safely called when the relevant storage has
|
||||
already been freed, or has not yet been allocated, and will in that
|
||||
case do nothing. The "n" parameter is ignored if only one item
|
||||
already been freed, or has not yet been allocated, or was allocated
|
||||
by the user and not by libpng, and will in those
|
||||
cases do nothing. The "n" parameter is ignored if only one item
|
||||
of the selected data type, such as PLTE, is allowed. If "n" is not
|
||||
-1, and multiple items are allowed for the data type identified in
|
||||
the mask, such as text or splt, only the n'th item is freed.
|
||||
the mask, such as text or sPLT, only the n'th item is freed.
|
||||
|
||||
If you allocated data such as a palette that you passed in to libpng with
|
||||
png_set_*, you must not free it until just before the call to
|
||||
If you allocated data such as a palette that you passed
|
||||
in to libpng with png_set_*, you must not free it until just before the call to
|
||||
png_destroy_write_struct().
|
||||
|
||||
The default behavior is only to free data that was allocated internally
|
||||
by libpng. This can be changed, so that libpng will not free the data,
|
||||
or so that it will free data that was passed in via a png_set_*() function,
|
||||
with
|
||||
or so that it will free data that was allocated by the user with png_malloc()
|
||||
or png_zalloc() and passed in via a png_set_*() function, with
|
||||
|
||||
png_data_freer(png_ptr, info_ptr, freer, mask)
|
||||
mask - which data elements are affected
|
||||
@ -2135,6 +2167,12 @@ 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
|
||||
structure.
|
||||
|
||||
This function only affects data that has already been allocated.
|
||||
You can call this function before calling after the png_set_*() functions
|
||||
to control whether the user or png_destroy_*() is supposed to free the data.
|
||||
When the user assumes responsibility for libpng-allocated data, the
|
||||
application must use png_free() to free it.
|
||||
|
||||
For a more compact example of writing a PNG image, see the file example.c.
|
||||
|
||||
V. Modifying/Customizing libpng:
|
||||
@ -2149,20 +2187,32 @@ goes through callbacks that are user settable. The default routines are
|
||||
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_malloc() and png_free().
|
||||
These currently just call the standard C functions. If
|
||||
Memory allocation is done through the functions png_malloc(), png_zalloc(),
|
||||
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
|
||||
functions must be modified in the library at compile time.
|
||||
functions must be modified in the library at compile time. If you prefer
|
||||
to use a different method of allocating and freeing data, you can use
|
||||
|
||||
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
||||
malloc_fn, png_free_ptr free_fn)
|
||||
|
||||
This function also provides a void pointer that can be retrieved via
|
||||
|
||||
mem_ptr=png_get_mem_ptr(png_ptr);
|
||||
|
||||
Your replacement memory functions must have prototypes as follows:
|
||||
|
||||
png_voidp malloc_fn(png_structp png_ptr, png_uint_32 size);
|
||||
void free_fn(png_structp png_ptr, png_voidp ptr);
|
||||
|
||||
Input/Output in libpng is done through png_read() and png_write(),
|
||||
which currently just call fread() and fwrite(). The FILE * is stored in
|
||||
png_struct and is initialized via png_init_io(). If you wish to change
|
||||
the method of I/O, the library supplies callbacks that you can set
|
||||
through the function png_set_read_fn() and png_set_write_fn() at run
|
||||
time, instead of calling the png_init_io() function.
|
||||
These functions
|
||||
time, instead of calling the png_init_io() function. These functions
|
||||
also provide a void pointer that can be retrieved via the function
|
||||
png_get_io_ptr(). For example:
|
||||
|
||||
@ -2176,7 +2226,7 @@ png_get_io_ptr(). For example:
|
||||
voidp read_io_ptr = png_get_io_ptr(read_ptr);
|
||||
voidp write_io_ptr = png_get_io_ptr(write_ptr);
|
||||
|
||||
The replacement I/O functions should have prototypes as follows:
|
||||
The replacement I/O functions must have prototypes as follows:
|
||||
|
||||
void user_read_data(png_structp png_ptr,
|
||||
png_bytep data, png_uint_32 length);
|
||||
@ -2349,8 +2399,8 @@ to turn filtering on and off, respectively.
|
||||
|
||||
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
|
||||
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
|
||||
ORed together '|' to specify one or more filters to use. These
|
||||
filters are described in more detail in the PNG specification. If
|
||||
ORed together with '|' to specify one or more filters to use.
|
||||
These filters are described in more detail in the PNG specification. If
|
||||
you intend to change the filter type during the course of writing
|
||||
the image, you should start with flags set for all of the filters
|
||||
you intend to use so that libpng can initialize its internal
|
||||
@ -2512,13 +2562,13 @@ the old method.
|
||||
|
||||
VII. Y2K Compliance in libpng
|
||||
|
||||
April 24, 2000
|
||||
May 1, 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.6h are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.6i 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "April 24, 2000"
|
||||
.TH LIBPNGPF 3 "May 1, 2000"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6i
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include <png.h>\fP
|
||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "April 24, 2000"
|
||||
.TH PNG 5 "May 1, 2000"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
38
png.c
38
png.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* libpng version 1.0.6h - April 24, 2000
|
||||
* libpng version 1.0.6i - May 1, 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_6h Your_png_h_is_not_version_1_0_6h;
|
||||
typedef version_1_0_6i Your_png_h_is_not_version_1_0_6i;
|
||||
|
||||
/* 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.6h";
|
||||
char png_libpng_ver[12] = "1.0.6i";
|
||||
|
||||
/* png_sig was changed to a function in version 1.0.5c */
|
||||
/* Place to hold the signature string for a PNG file. */
|
||||
@ -134,7 +134,7 @@ png_check_sig(png_bytep sig, int num)
|
||||
return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
|
||||
}
|
||||
|
||||
/* Function to allocate memory for zlib. */
|
||||
/* Function to allocate memory for zlib and clear it to 0. */
|
||||
voidpf
|
||||
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||
{
|
||||
@ -261,6 +261,7 @@ png_info_init(png_infop info_ptr)
|
||||
png_memset(info_ptr, 0, sizeof (png_info));
|
||||
}
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
void
|
||||
png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
||||
int freer, png_uint_32 mask)
|
||||
@ -276,6 +277,7 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
||||
png_warning(png_ptr,
|
||||
"Unknown freer parameter in png_data_freer.");
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num)
|
||||
@ -286,7 +288,9 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num
|
||||
|
||||
#if defined(PNG_TEXT_SUPPORTED)
|
||||
/* free text item num or (if num == -1) all text items */
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (mask & info_ptr->free_me & PNG_FREE_TEXT)
|
||||
#endif
|
||||
{
|
||||
if (num != -1)
|
||||
{
|
||||
@ -314,7 +318,11 @@ if (mask & PNG_FREE_TRNS)
|
||||
{
|
||||
if (info_ptr->valid & PNG_INFO_tRNS)
|
||||
{
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (info_ptr->free_me & PNG_FREE_TRNS)
|
||||
#else
|
||||
if (png_ptr->flags & PNG_FLAG_FREE_TRNS)
|
||||
#endif
|
||||
png_free(png_ptr, info_ptr->trans);
|
||||
info_ptr->valid &= ~PNG_INFO_tRNS;
|
||||
}
|
||||
@ -362,7 +370,9 @@ if (mask & PNG_FREE_ICCP)
|
||||
{
|
||||
if (info_ptr->valid & PNG_INFO_iCCP)
|
||||
{
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (info_ptr->free_me & PNG_FREE_ICCP)
|
||||
#endif
|
||||
{
|
||||
png_free(png_ptr, info_ptr->iccp_name);
|
||||
png_free(png_ptr, info_ptr->iccp_profile);
|
||||
@ -427,7 +437,11 @@ if (mask & PNG_FREE_HIST)
|
||||
{
|
||||
if (info_ptr->valid & PNG_INFO_hIST)
|
||||
{
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (info_ptr->free_me & PNG_FREE_HIST)
|
||||
#else
|
||||
if (png_ptr->flags & PNG_FLAG_FREE_HIST)
|
||||
#endif
|
||||
png_free(png_ptr, info_ptr->hist);
|
||||
info_ptr->valid &= ~PNG_INFO_hIST;
|
||||
}
|
||||
@ -439,7 +453,11 @@ if (mask & PNG_FREE_PLTE)
|
||||
{
|
||||
if (info_ptr->valid & PNG_INFO_PLTE)
|
||||
{
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (info_ptr->free_me & PNG_FREE_PLTE)
|
||||
#else
|
||||
if (png_ptr->flags & PNG_FLAG_FREE_PLTE)
|
||||
#endif
|
||||
png_zfree(png_ptr, info_ptr->palette);
|
||||
info_ptr->valid &= ~(PNG_INFO_PLTE);
|
||||
info_ptr->num_palette = 0;
|
||||
@ -450,7 +468,9 @@ if (mask & PNG_FREE_PLTE)
|
||||
/* free any image bits attached to the info structure */
|
||||
if (mask & PNG_FREE_ROWS)
|
||||
{
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (info_ptr->free_me & PNG_FREE_ROWS)
|
||||
#endif
|
||||
{
|
||||
int row;
|
||||
|
||||
@ -460,8 +480,10 @@ if (mask & PNG_FREE_ROWS)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if(num == -1)
|
||||
info_ptr->free_me &= ~mask;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This is an internal routine to free any memory that the info struct is
|
||||
@ -475,7 +497,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if (png_ptr->num_chunk_list)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunk_list);
|
||||
@ -561,7 +583,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.6h - April 24, 2000\n\
|
||||
return ("\n libpng version 1.0.6i - May 1, 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 +601,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.6h");
|
||||
return("1.0.6h");
|
||||
return("1.0.6i");
|
||||
return("1.0.6i");
|
||||
}
|
||||
|
||||
png_charp
|
||||
|
121
png.h
121
png.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.0.6h - April 24, 2000
|
||||
* libpng version 1.0.6i - May 1, 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.6h - April 24, 2000: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.0.6i - May 1, 2000: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@ -48,9 +48,11 @@
|
||||
* 1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-v (not binary compatible)
|
||||
* 1.0.6 (+ 3 patches) 1.0.6 10006 2.1.0.6 (still binary incompat)
|
||||
* 1.0.6d-f 1.0.6d-f 10007 2.1.0.6d-f (still binary incompat)
|
||||
* 1.0.6g 1.0.6g 10007 2.1.0.6g (compatible with 1.0.5)
|
||||
* 1.0.6h 1.0.6h 10007 10.6h (compatible with 1.0.5)
|
||||
* 1.0.7 1.0.7 10007 10.7 (still compatible)
|
||||
* 1.0.6g 1.0.6g 10007 2.1.0.6g
|
||||
* 1.0.6h 1.0.6h 10007 10.6h
|
||||
* 1.0.6 (+ 4 patches) 1.0.6 10006 2.1.0.6ad (compatible with 1.0.0)
|
||||
* 1.0.6i 1.0.6i 10007 10.6i (can be compatible w/ 1.0.0)
|
||||
* 1.0.7 1.0.7 10007 10.7 (still can be compatible)
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -79,7 +81,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.6h, April 24, 2000)
|
||||
* (libpng versions 0.97, January 1998, through 1.0.6i, May 1, 2000)
|
||||
*
|
||||
* For the purposes of this copyright and license, "Contributing Authors"
|
||||
* is defined as the following set of individuals:
|
||||
@ -154,13 +156,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* April 24, 2000
|
||||
* May 1, 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.6h are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.0.6i 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
|
||||
@ -238,7 +240,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.0.6h"
|
||||
#define PNG_LIBPNG_VER_STRING "1.0.6i"
|
||||
|
||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||
* We must not include leading zeros.
|
||||
@ -489,15 +491,13 @@ typedef struct png_info_struct
|
||||
* and initialize the appropriate fields below.
|
||||
*/
|
||||
|
||||
#if defined(PNG_gAMA_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED)
|
||||
#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_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].
|
||||
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
|
||||
*/
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_sRGB_SUPPORTED)
|
||||
/* GR-P, 0.96a */
|
||||
@ -517,9 +517,6 @@ typedef struct png_info_struct
|
||||
int num_text; /* number of comments read/to write */
|
||||
int max_text; /* current size of text array */
|
||||
png_textp text; /* array of comments read/to write */
|
||||
int num_text_old; /* number of comments read/to write */
|
||||
png_textp text_old; /* array of comments read/to write, backward
|
||||
compatible with libpng-1.0.5 and earlier */
|
||||
#endif /* PNG_TEXT_SUPPORTED */
|
||||
|
||||
#if defined(PNG_tIME_SUPPORTED)
|
||||
@ -595,7 +592,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
png_uint_16p hist;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_cHRM_SUPPORTED)
|
||||
#ifdef PNG_cHRM_SUPPORTED
|
||||
/* The cHRM chunk describes the CIE color characteristics of the monitor
|
||||
* on which the PNG was created. This data allows the viewer to do gamut
|
||||
* mapping of the input image to ensure that the viewer sees the same
|
||||
@ -636,6 +633,16 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
png_byte pcal_nparams; /* number of parameters given in pcal_params */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
/* storage for unknown chunks that the library doesn't recognize. */
|
||||
png_unknown_chunkp unknown_chunks;
|
||||
png_size_t unknown_chunks_num;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_iCCP_SUPPORTED)
|
||||
/* iCCP chunk data. */
|
||||
png_charp iccp_name; /* profile name */
|
||||
@ -669,19 +676,13 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
/* storage for unknown chunks that the library doesn't recognize. */
|
||||
png_unknown_chunkp unknown_chunks;
|
||||
png_size_t unknown_chunks_num;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
||||
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
|
||||
/* 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)
|
||||
#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
|
||||
png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
|
||||
#endif
|
||||
|
||||
@ -696,8 +697,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
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;
|
||||
@ -828,7 +827,8 @@ typedef void (*png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_LEGACY_SUPPORTED)
|
||||
typedef void (*png_user_transform_ptr) PNGARG((png_structp,
|
||||
png_row_infop, png_bytep));
|
||||
#endif
|
||||
@ -885,11 +885,14 @@ struct png_struct_def
|
||||
png_user_transform_ptr write_user_transform_fn; /* user write transform */
|
||||
#endif
|
||||
|
||||
/* These were added in libpng-1.0.2 */
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
#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
|
||||
#endif
|
||||
|
||||
png_uint_32 mode; /* tells us where we are in the PNG file */
|
||||
@ -941,8 +944,12 @@ struct png_struct_def
|
||||
png_byte sig_bytes; /* magic bytes read/written from start of file */
|
||||
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
#ifdef PNG_LEGACY_SUPPORTED
|
||||
png_byte filler; /* filler byte for pixel expansion */
|
||||
#else
|
||||
png_uint_16 filler; /* filler bytes for pixel expansion */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
||||
png_byte background_gamma_type;
|
||||
@ -1058,6 +1065,22 @@ struct png_struct_def
|
||||
png_free_ptr free_fn; /* function for freeing memory */
|
||||
#endif
|
||||
|
||||
/* New members added in libpng-1.0.6 */
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||
#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
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
int num_chunk_list;
|
||||
png_bytep chunk_list;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||
png_byte rgb_to_gray_status;
|
||||
png_uint_16 rgb_to_gray_red_coeff;
|
||||
@ -1070,27 +1093,16 @@ struct png_struct_def
|
||||
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
|
||||
|
||||
#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.6h
|
||||
and png.h are both at * version 1.0.6i
|
||||
*/
|
||||
typedef png_structp version_1_0_6h;
|
||||
typedef png_structp version_1_0_6i;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
@ -1574,18 +1586,21 @@ extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
|
||||
extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_LEGACY_SUPPORTED)
|
||||
extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
|
||||
png_ptr, png_user_transform_ptr read_user_transform_fn));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_LEGACY_SUPPORTED)
|
||||
extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
|
||||
png_ptr, png_user_transform_ptr write_user_transform_fn));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_LEGACY_SUPPORTED)
|
||||
extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
|
||||
png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
|
||||
int user_transform_channels));
|
||||
@ -1634,18 +1649,17 @@ extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
|
||||
/* Free data that was allocated internally */
|
||||
extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
|
||||
png_infop info_ptr, png_uint_32 free_me, int num));
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
/* Reassign responsibility for freeing existing data, whether allocated
|
||||
* by libpng or by the application */
|
||||
extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
|
||||
png_infop info_ptr, int freer, png_uint_32 mask));
|
||||
#endif
|
||||
/* assignments for png_data_freer */
|
||||
#define PNG_DESTROY_WILL_FREE_DATA 1
|
||||
#define PNG_SET_WILL_FREE_DATA 1
|
||||
#define PNG_USER_WILL_FREE_DATA 2
|
||||
/* Flags for png_ptr->free_me and info_ptr->free_me */
|
||||
#define PNG_FREE_PLTE 0x0001
|
||||
#define PNG_FREE_TRNS 0x0002
|
||||
#define PNG_FREE_TEXT 0x0004
|
||||
#define PNG_FREE_HIST 0x0008
|
||||
#define PNG_FREE_ICCP 0x0010
|
||||
#define PNG_FREE_SPLT 0x0020
|
||||
@ -1654,7 +1668,10 @@ extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
|
||||
#define PNG_FREE_SCAL 0x0100 /* not used any more */
|
||||
#define PNG_FREE_UNKN 0x0200
|
||||
#define PNG_FREE_LIST 0x0400
|
||||
#define PNG_FREE_ALL 0x07ff
|
||||
#define PNG_FREE_PLTE 0x1000
|
||||
#define PNG_FREE_TRNS 0x2000
|
||||
#define PNG_FREE_TEXT 0x4000
|
||||
#define PNG_FREE_ALL 0x3fff
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
|
||||
@ -2034,6 +2051,7 @@ extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
|
||||
#endif
|
||||
|
||||
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
||||
/* The "params" pointer is currently not used and is for future expansion. */
|
||||
extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
|
||||
png_infop info_ptr,
|
||||
int transforms,
|
||||
@ -2084,7 +2102,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.6h - April 24, 2000 (header)\n"
|
||||
" libpng version 1.0.6i - May 1, 2000 (header)\n"
|
||||
|
||||
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||
/* With these routines we avoid an integer divide, which will be slower on
|
||||
@ -2150,6 +2168,8 @@ extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
|
||||
#define PNG_WROTE_tIME 0x200
|
||||
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
|
||||
#define PNG_BACKGROUND_IS_GRAY 0x800
|
||||
#define PNG_CREATED_READ_STRUCT 0x1000
|
||||
#define PNG_CREATED_WRITE_STRUCT 0x2000
|
||||
|
||||
/* flags for the transformations the PNG library does on the image data */
|
||||
#define PNG_BGR 0x0001
|
||||
@ -2200,8 +2220,11 @@ extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
|
||||
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
|
||||
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
|
||||
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
|
||||
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x1000
|
||||
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x2000
|
||||
#define PNG_FLAG_FREE_PLTE 0x1000
|
||||
#define PNG_FLAG_FREE_TRNS 0x2000
|
||||
#define PNG_FLAG_FREE_HIST 0x4000
|
||||
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
|
||||
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
|
||||
|
||||
/* For use in png_set_keep_unknown, png_handle_as_unknown */
|
||||
#define HANDLE_CHUNK_AS_DEFAULT 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1999, 2000 Glenn Randers-Pehrson
|
||||
*
|
||||
|
63
pngconf.h
63
pngconf.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -17,6 +17,37 @@
|
||||
#ifndef PNGCONF_H
|
||||
#define PNGCONF_H
|
||||
|
||||
/* The following support, added at version 1.0.6, will be turned on by
|
||||
* default in version 2.0.0.
|
||||
* They have been turned off here in case you need binary compatibility
|
||||
* with old applications that require the length of png_struct and
|
||||
* png_info to remain at the old length.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PNG_LEGACY_SUPPORTED
|
||||
#define PNG_NO_FREE_ME
|
||||
#define PNG_NO_READ_UNKNOWN_CHUNKS
|
||||
#define PNG_NO_WRITE_UNKNOWN_CHUNKS
|
||||
#define PNG_NO_READ_USER_CHUNKS
|
||||
#define PNG_NO_READ_iCCP
|
||||
#define PNG_NO_WRITE_iCCP
|
||||
#define PNG_NO_READ_sCAL
|
||||
#define PNG_NO_WRITE_sCAL
|
||||
#define PNG_NO_READ_sPLT
|
||||
#define PNG_NO_WRITE_sPLT
|
||||
#define PNG_NO_INFO_IMAGE
|
||||
#define PNG_NO_READ_RGB_TO_GRAY
|
||||
#define PNG_NO_READ_USER_TRANSFORM
|
||||
#define PNG_NO_WRITE_USER_TRANSFORM
|
||||
#define PNG_NO_USER_MEM
|
||||
#define PNG_NO_READ_EMPTY_PLTE
|
||||
#endif
|
||||
|
||||
#ifndef PNG_NO_FREE_ME
|
||||
#define PNG_FREE_ME_SUPPORTED
|
||||
#endif
|
||||
|
||||
/* This is the size of the compression buffer, and thus the size of
|
||||
* an IDAT chunk. Make this whatever size you feel is best for your
|
||||
* machine. One of these will be allocated per png_struct. When this
|
||||
@ -271,7 +302,9 @@
|
||||
#define PNG_FLOATING_POINT_SUPPORTED
|
||||
#endif
|
||||
|
||||
#ifndef PNG_NO_FIXED_POINT_SUPPORTED
|
||||
/* Ignore attempt to turn off both floating and fixed point support */
|
||||
|
||||
#ifndef PNG_FLOATING_POINT_SUPPORTED
|
||||
#define PNG_FIXED_POINT_SUPPORTED
|
||||
#endif
|
||||
|
||||
@ -389,6 +422,13 @@
|
||||
#endif
|
||||
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
#ifndef PNG_NO_USER_TRANSFORM_PTR
|
||||
#define PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
|
||||
encoders, but can cause trouble
|
||||
if left undefined */
|
||||
@ -455,7 +495,9 @@
|
||||
/* very little testing */
|
||||
/*
|
||||
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||
#ifndef PNG_NO_USER_MEM
|
||||
#define PNG_USER_MEM_SUPPORTED
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* This is only for PowerPC big-endian and 680x0 systems */
|
||||
@ -560,7 +602,15 @@
|
||||
# define PNG_READ_zTXt_SUPPORTED
|
||||
# define PNG_zTXt_SUPPORTED
|
||||
#endif
|
||||
#ifndef PNG_NO_READ_USER_CHUNKS
|
||||
#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
|
||||
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# ifndef PNG_NO_HANDLE_AS_UNKNOWN
|
||||
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
#if !defined (PNG_NO_READ_USER_CHUNKS) && \
|
||||
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
# define PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
# define PNG_USER_CHUNKS_SUPPORTED
|
||||
# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
|
||||
@ -570,13 +620,6 @@
|
||||
# undef PNG_NO_HANDLE_AS_UNKNOWN
|
||||
# endif
|
||||
#endif
|
||||
#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
|
||||
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# ifndef PNG_NO_HANDLE_AS_UNKNOWN
|
||||
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
#ifndef PNG_NO_READ_OPT_PLTE
|
||||
# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
|
||||
#endif /* optional PLTE chunk in RGB and RGBA images */
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
|
@ -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.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
|
4
pngget.c
4
pngget.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -434,6 +434,7 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
png_uint_32
|
||||
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||
png_fixed_point *int_file_gamma)
|
||||
@ -448,6 +449,7 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||
png_uint_32
|
||||
|
2
pngmem.c
2
pngmem.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -1336,12 +1336,14 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
|
||||
|
||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||
{
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
HANDLE_CHUNK_ALWAYS
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
&& png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
|
||||
/* to quiet compiler warnings about unused info_ptr */
|
||||
|
51
pngread.c
51
pngread.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -108,6 +108,8 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
|
||||
png_set_read_fn(png_ptr, NULL, NULL);
|
||||
|
||||
png_ptr->mode |= PNG_CREATED_READ_STRUCT;
|
||||
|
||||
return (png_ptr);
|
||||
}
|
||||
|
||||
@ -136,6 +138,15 @@ png_read_init(png_structp png_ptr)
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
|
||||
#endif
|
||||
|
||||
#ifndef PNG_LEGACY_SUPPORTED
|
||||
if(!(png_ptr->mode & PNG_CREATED_READ_STRUCT))
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
png_error(png_ptr,
|
||||
"Read struct not properly created; use a legacy-supporting libpng.");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* initialize zbuf - compression buffer */
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
@ -641,7 +652,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.6h.
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6i.
|
||||
*/
|
||||
|
||||
void
|
||||
@ -690,7 +701,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.6h.
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6i.
|
||||
*/
|
||||
void
|
||||
png_read_image(png_structp png_ptr, png_bytepp image)
|
||||
@ -1013,19 +1024,37 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
||||
png_free(png_ptr, png_ptr->gamma_from_1);
|
||||
png_free(png_ptr, png_ptr->gamma_to_1);
|
||||
#endif
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (png_ptr->free_me & PNG_FREE_PLTE)
|
||||
png_zfree(png_ptr, png_ptr->palette);
|
||||
png_ptr->free_me &= ~PNG_FREE_PLTE;
|
||||
#else
|
||||
if (png_ptr->flags & PNG_FLAG_FREE_PLTE)
|
||||
png_zfree(png_ptr, png_ptr->palette);
|
||||
png_ptr->flags &= ~PNG_FLAG_FREE_PLTE;
|
||||
#endif
|
||||
#if defined(PNG_tRNS_SUPPORTED) || \
|
||||
defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (png_ptr->free_me & PNG_FREE_TRNS)
|
||||
png_free(png_ptr, png_ptr->trans);
|
||||
png_ptr->free_me &= ~PNG_FREE_TRNS;
|
||||
#else
|
||||
if (png_ptr->flags & PNG_FLAG_FREE_TRNS)
|
||||
png_free(png_ptr, png_ptr->trans);
|
||||
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
|
||||
#endif
|
||||
#endif
|
||||
#if defined(PNG_READ_hIST_SUPPORTED)
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if (png_ptr->free_me & PNG_FREE_HIST)
|
||||
png_free(png_ptr, png_ptr->hist);
|
||||
png_ptr->free_me &= ~PNG_FREE_HIST;
|
||||
#else
|
||||
if (png_ptr->flags & PNG_FLAG_FREE_HIST)
|
||||
png_free(png_ptr, png_ptr->hist);
|
||||
png_ptr->flags &= ~PNG_FLAG_FREE_HIST;
|
||||
#endif
|
||||
#endif
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||
if (png_ptr->gamma_16_table != NULL)
|
||||
@ -1218,15 +1247,29 @@ void png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
|
||||
/* -------------- image transformations end here ------------------- */
|
||||
|
||||
if(info_ptr->row_pointers)
|
||||
{
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if(info_ptr->free_me & PNG_FREE_ROWS)
|
||||
{
|
||||
for (row = 0; row < (int)info_ptr->height; row++)
|
||||
png_free(png_ptr, info_ptr->row_pointers[row]);
|
||||
png_free(png_ptr, info_ptr->row_pointers);
|
||||
info_ptr->row_pointers = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(info_ptr->row_pointers == NULL)
|
||||
{
|
||||
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
|
||||
info_ptr->height * sizeof(png_bytep));
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_ROWS;
|
||||
}
|
||||
#endif
|
||||
for (row = 0; row < (int)info_ptr->height; row++)
|
||||
info_ptr->row_pointers[row] = png_malloc(png_ptr,
|
||||
png_get_rowbytes(png_ptr, info_ptr));
|
||||
}
|
||||
|
||||
png_read_image(png_ptr, info_ptr->row_pointers);
|
||||
info_ptr->valid |= PNG_INFO_IDAT;
|
||||
|
2
pngrio.c
2
pngrio.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
|
18
pngrtran.c
18
pngrtran.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -645,14 +645,23 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_LEGACY_SUPPORTED)
|
||||
void
|
||||
png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
|
||||
read_user_transform_fn)
|
||||
{
|
||||
png_debug(1, "in png_set_read_user_transform_fn\n");
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
png_ptr->transformations |= PNG_USER_TRANSFORM;
|
||||
png_ptr->read_user_transform_fn = read_user_transform_fn;
|
||||
#endif
|
||||
#ifdef PNG_LEGACY_SUPPORTED
|
||||
if(read_user_transform_fn)
|
||||
png_warning(png_ptr,
|
||||
"This version of libpng does not support user transforms");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1079,7 +1088,8 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
|
||||
info_ptr->channels++;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \
|
||||
defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
if(png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||
{
|
||||
if(info_ptr->bit_depth < png_ptr->user_transform_depth)
|
||||
@ -1307,10 +1317,12 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
if(png_ptr->user_transform_depth)
|
||||
png_ptr->row_info.bit_depth = png_ptr->user_transform_depth;
|
||||
if(png_ptr->user_transform_channels)
|
||||
png_ptr->row_info.channels = png_ptr->user_transform_channels;
|
||||
#endif
|
||||
png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
|
||||
png_ptr->row_info.channels);
|
||||
png_ptr->row_info.rowbytes = (png_ptr->row_info.width *
|
||||
|
34
pngrutil.c
34
pngrutil.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -446,8 +446,12 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_ptr->palette = palette;
|
||||
png_ptr->num_palette = (png_uint_16)num;
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
|
||||
png_ptr->free_me |= PNG_FREE_PLTE;
|
||||
#else
|
||||
png_ptr->flags |= PNG_FLAG_FREE_PLTE;
|
||||
#endif
|
||||
png_set_PLTE(png_ptr, info_ptr, palette, num);
|
||||
|
||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||
@ -849,8 +853,19 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
igamma=(int)info_ptr->int_gamma;
|
||||
#else
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
igamma=info_ptr->gamma * 100000.;
|
||||
igamma=(int)(info_ptr->gamma * 100000.);
|
||||
# endif
|
||||
#endif
|
||||
#if 0 && defined(PNG_cHRM_SUPPORTED) && !defined(PNG_FIXED_POINT_SUPPORTED)
|
||||
/* We need to define these here because they aren't in png.h */
|
||||
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
|
||||
if(igamma < 45000L || igamma > 46000L)
|
||||
{
|
||||
@ -870,6 +885,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#endif /* PNG_READ_gAMA_SUPPORTED */
|
||||
|
||||
#ifdef PNG_READ_cHRM_SUPPORTED
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
if (info_ptr->valid & PNG_INFO_cHRM)
|
||||
if (abs(info_ptr->int_x_white - 31270L) > 1000 ||
|
||||
abs(info_ptr->int_y_white - 32900L) > 1000 ||
|
||||
@ -883,6 +899,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_warning(png_ptr,
|
||||
"Ignoring incorrect cHRM value when sRGB is also present");
|
||||
}
|
||||
#endif /* PNG_FIXED_POINT_SUPPORTED */
|
||||
#endif /* PNG_READ_cHRM_SUPPORTED */
|
||||
|
||||
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent);
|
||||
@ -1157,8 +1174,12 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
if (png_crc_finish(png_ptr, 0))
|
||||
return;
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
|
||||
png_ptr->free_me |= PNG_FREE_TRNS;
|
||||
#else
|
||||
png_ptr->flags |= PNG_FLAG_FREE_TRNS;
|
||||
#endif
|
||||
png_set_tRNS(png_ptr, info_ptr, png_ptr->trans, png_ptr->num_trans,
|
||||
&(png_ptr->trans_values));
|
||||
}
|
||||
@ -1304,8 +1325,12 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
if (png_crc_finish(png_ptr, 0))
|
||||
return;
|
||||
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
|
||||
png_ptr->free_me |= PNG_FREE_HIST;
|
||||
#else
|
||||
png_ptr->flags |= PNG_FLAG_FREE_HIST;
|
||||
#endif
|
||||
png_set_hIST(png_ptr, info_ptr, png_ptr->hist);
|
||||
}
|
||||
#endif
|
||||
@ -1924,12 +1949,14 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||
{
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
HANDLE_CHUNK_ALWAYS
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
&& png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
}
|
||||
|
||||
@ -2831,7 +2858,8 @@ png_read_start_row(png_structp png_ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) && \
|
||||
defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
if(png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||
{
|
||||
int user_pixel_depth=png_ptr->user_transform_depth*
|
||||
|
15
pngset.c
15
pngset.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -123,7 +123,9 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
info_ptr->gamma = (float)(int_gamma/100000.);
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
info_ptr->int_gamma = int_gamma;
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_gAMA;
|
||||
}
|
||||
|
||||
@ -441,7 +443,9 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||
/* Compression is always zero but is here so the API and info structure
|
||||
* does not have to change if we introduce multiple compression types */
|
||||
info_ptr->iccp_compression = (png_byte)compression_type;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_ICCP;
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_iCCP;
|
||||
}
|
||||
#endif
|
||||
@ -574,7 +578,9 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
|
||||
info_ptr->text[info_ptr->num_text]= *textp;
|
||||
info_ptr->num_text++;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_TEXT;
|
||||
#endif
|
||||
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
|
||||
}
|
||||
}
|
||||
@ -652,7 +658,9 @@ png_set_sPLT(png_structp png_ptr,
|
||||
info_ptr->splt_palettes = np;
|
||||
info_ptr->splt_palettes_num += nentries;
|
||||
info_ptr->valid |= PNG_INFO_sPLT;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_SPLT;
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_sPLT_SUPPORTED */
|
||||
|
||||
@ -691,7 +699,9 @@ png_set_unknown_chunks(png_structp png_ptr,
|
||||
|
||||
info_ptr->unknown_chunks = np;
|
||||
info_ptr->unknown_chunks_num += num_unknowns;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_UNKN;
|
||||
#endif
|
||||
}
|
||||
void
|
||||
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
||||
@ -749,7 +759,9 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
|
||||
*p=(png_byte)keep;
|
||||
png_ptr->num_chunk_list=old_num_chunks+num_chunks;
|
||||
png_ptr->chunk_list=new_list;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
png_ptr->free_me |= PNG_FREE_LIST;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -780,7 +792,6 @@ 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)
|
||||
{
|
||||
|
41
pngtest.c
41
pngtest.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -687,11 +687,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if defined(PNG_FIXED_POINT_SUPPORTED)
|
||||
#if defined(PNG_cHRM_SUPPORTED)
|
||||
{
|
||||
png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
|
||||
blue_y;
|
||||
|
||||
if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y, &red_x,
|
||||
&red_y, &green_x, &green_y, &blue_x, &blue_y))
|
||||
{
|
||||
@ -710,6 +710,32 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else /* Use floating point versions */
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
#if defined(PNG_cHRM_SUPPORTED)
|
||||
{
|
||||
double white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
|
||||
blue_y;
|
||||
if (png_get_cHRM(read_ptr, read_info_ptr, &white_x, &white_y, &red_x,
|
||||
&red_y, &green_x, &green_y, &blue_x, &blue_y))
|
||||
{
|
||||
png_set_cHRM(write_ptr, write_info_ptr, white_x, white_y, red_x,
|
||||
red_y, green_x, green_y, blue_x, blue_y);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(PNG_gAMA_SUPPORTED)
|
||||
{
|
||||
double gamma;
|
||||
|
||||
if (png_get_gAMA(read_ptr, read_info_ptr, &gamma))
|
||||
{
|
||||
png_set_gAMA(write_ptr, write_info_ptr, gamma);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* floating point */
|
||||
#endif /* fixed point */
|
||||
#if defined(PNG_iCCP_SUPPORTED)
|
||||
{
|
||||
png_charp name;
|
||||
@ -1129,6 +1155,8 @@ main(int argc, char *argv[])
|
||||
fprintf(STDERR," library:%s",png_get_header_version(NULL));
|
||||
/* Show the version of libpng used in building the application */
|
||||
fprintf(STDERR," pngtest:%s",PNG_HEADER_VERSION_STRING);
|
||||
fprintf(STDERR," sizeof(png_struct)=%d, sizeof(png_info)=%d\n",
|
||||
sizeof(png_struct), sizeof(png_info));
|
||||
|
||||
/* Do some consistency checking on the memory allocation settings, I'm
|
||||
not sure this matters, but it is nice to know, the first of these
|
||||
@ -1201,7 +1229,10 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
for (i=2; i<argc; ++i)
|
||||
{
|
||||
int k, kerror;
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
int k;
|
||||
#endif
|
||||
int kerror;
|
||||
fprintf(STDERR, "Testing %s:",argv[i]);
|
||||
kerror = test_one_file(argv[i], outname);
|
||||
if (kerror == 0)
|
||||
@ -1271,7 +1302,9 @@ main(int argc, char *argv[])
|
||||
{
|
||||
if(verbose == 1 || i == 2)
|
||||
{
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
int k;
|
||||
#endif
|
||||
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
fprintf(STDERR, "\n PASS (%lu zero samples)\n",zero_samples);
|
||||
#else
|
||||
@ -1345,4 +1378,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_6h your_png_h_is_not_version_1_0_6h;
|
||||
typedef version_1_0_6i your_png_h_is_not_version_1_0_6i;
|
||||
|
19
pngtrans.c
19
pngtrans.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -571,16 +571,24 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_LEGACY_SUPPORTED)
|
||||
void
|
||||
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
||||
{
|
||||
png_debug(1, "in png_set_user_transform_info\n");
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||
#else
|
||||
if(user_transform_ptr || user_transform_depth || user_transform_channels)
|
||||
png_warning(png_ptr,
|
||||
"This version of libpng does not support user transform info");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function returns a pointer to the user_transform_ptr associated with
|
||||
* the user transform functions. The application should free any memory
|
||||
@ -590,6 +598,11 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||
png_voidp
|
||||
png_get_user_transform_ptr(png_structp png_ptr)
|
||||
{
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
return ((png_voidp)png_ptr->user_transform_ptr);
|
||||
}
|
||||
#else
|
||||
if(png_ptr)
|
||||
return (NULL);
|
||||
return (NULL);
|
||||
#endif
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* For Intel x86 CPU and Microsoft Visual C++ compiler
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
|
2
pngwio.c
2
pngwio.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
|
15
pngwrite.c
15
pngwrite.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -480,6 +480,8 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
1, NULL, NULL);
|
||||
#endif
|
||||
|
||||
png_ptr->mode |= PNG_CREATED_WRITE_STRUCT;
|
||||
|
||||
return ((png_structp)png_ptr);
|
||||
}
|
||||
|
||||
@ -505,6 +507,15 @@ png_write_init(png_structp png_ptr)
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
|
||||
#endif
|
||||
|
||||
#ifndef PNG_LEGACY_SUPPORTED
|
||||
if(!(png_ptr->mode & PNG_CREATED_WRITE_STRUCT))
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
png_error(png_ptr,
|
||||
"Write struct not properly created; use a legacy-supporting libpng.");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* initialize zbuf - compression buffer */
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
@ -804,11 +815,13 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
|
||||
{
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if (png_ptr->num_chunk_list)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunk_list);
|
||||
png_ptr->num_chunk_list=0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
png_destroy_struct_2((png_voidp)info_ptr, free_fn);
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
|
14
pngwutil.c
14
pngwutil.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 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
|
||||
@ -167,7 +167,7 @@ png_text_compress(png_structp png_ptr,
|
||||
{
|
||||
comp->input = text;
|
||||
comp->input_len = text_len;
|
||||
return(text_len);
|
||||
return((int)text_len);
|
||||
}
|
||||
|
||||
if (compression >= PNG_TEXT_COMPRESSION_LAST)
|
||||
@ -314,7 +314,7 @@ png_text_compress(png_structp png_ptr,
|
||||
if (png_ptr->zstream.avail_out < png_ptr->zbuf_size)
|
||||
text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out;
|
||||
|
||||
return(text_len);
|
||||
return((int)text_len);
|
||||
}
|
||||
|
||||
/* ship the compressed text out via chunk writes */
|
||||
@ -647,7 +647,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
|
||||
profile_len = 0;
|
||||
|
||||
if (profile_len)
|
||||
profile_len = png_text_compress(png_ptr, profile, profile_len,
|
||||
profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len,
|
||||
PNG_TEXT_COMPRESSION_zTXt, &comp);
|
||||
|
||||
/* make sure we include the NULL after the name and the compression type */
|
||||
@ -1204,7 +1204,8 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
|
||||
png_free(png_ptr, new_key);
|
||||
|
||||
/* compute the compressed data; do it now for the length */
|
||||
text_len = png_text_compress(png_ptr, text, text_len, compression, &comp);
|
||||
text_len = png_text_compress(png_ptr, text, text_len, compression,
|
||||
&comp);
|
||||
|
||||
/* write start of chunk */
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32)
|
||||
@ -1256,7 +1257,8 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
||||
text_len = 0;
|
||||
|
||||
/* compute the compressed data; do it now for the length */
|
||||
text_len = png_text_compress(png_ptr, text, text_len, compression-2, &comp);
|
||||
text_len = png_text_compress(png_ptr, text, text_len, compression-2,
|
||||
&comp);
|
||||
|
||||
/* make sure we include the compression flag, the compression byte,
|
||||
* and the NULs after the key, lang, and lang_key parts */
|
||||
|
@ -7,7 +7,7 @@
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 10
|
||||
PNGMIN = 6h
|
||||
PNGMIN = 6i
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
CC=gcc
|
||||
|
||||
|
@ -14,7 +14,7 @@ ZLIBINC=../zlib
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 10
|
||||
PNGMIN = 6h
|
||||
PNGMIN = 6i
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
CC=cc
|
||||
|
@ -34,7 +34,7 @@ RANLIB=ranlib
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 10
|
||||
PNGMIN = 6h
|
||||
PNGMIN = 6i
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
114
scripts/makefile.intel
Normal file
114
scripts/makefile.intel
Normal file
@ -0,0 +1,114 @@
|
||||
# Makefile for libpng
|
||||
# Microsoft Visual C++ with Intel C/C++ Compiler 4.0 and later
|
||||
|
||||
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
|
||||
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
# For conditions of distribution and use, see copyright notice in png.h
|
||||
|
||||
# To use, do "nmake /f scripts\makefile.intel"
|
||||
|
||||
|
||||
# ------------------- Intel C/C++ Compiler 4.0 and later -------------------
|
||||
|
||||
# Caution: the assembler code was introduced at libpng version 1.0.4 and has
|
||||
# not yet been thoroughly tested.
|
||||
|
||||
# Use assembler code
|
||||
ASMCODE=-DPNG_USE_PNGVCRD
|
||||
|
||||
# Where the zlib library and include files are located
|
||||
ZLIBLIB=..\zlib
|
||||
ZLIBINC=..\zlib
|
||||
|
||||
# Target CPU
|
||||
CPU=6 # Pentium II
|
||||
#CPU=5 # Pentium
|
||||
|
||||
# Calling convention
|
||||
CALLING=r # __fastcall
|
||||
#CALLING=z # __stdcall
|
||||
#CALLING=d # __cdecl
|
||||
|
||||
# Uncomment next to put error messages in a file
|
||||
#ERRFILE=>>pngerrs
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
|
||||
CC=icl -c
|
||||
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) $(ASMCODE) -nologo
|
||||
LD=link
|
||||
LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO
|
||||
|
||||
O=.obj
|
||||
|
||||
OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)\
|
||||
pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)\
|
||||
pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O)
|
||||
|
||||
|
||||
all: test
|
||||
|
||||
png$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngset$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngget$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngread$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngpread$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrtran$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrutil$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngvcrd$(O): png.h pngconf.h pngasmrd.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngerror$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngmem$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrio$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwio$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngtest$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngtrans$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwrite$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwtran$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwutil$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
libpng.lib: $(OBJS)
|
||||
if exist libpng.lib del libpng.lib
|
||||
lib /NOLOGO /OUT:libpng.lib $(OBJS)
|
||||
|
||||
pngtest.exe: pngtest.obj libpng.lib
|
||||
$(LD) $(LDFLAGS) /OUT:pngtest.exe pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib
|
||||
|
||||
test: pngtest.exe
|
||||
pngtest.exe
|
||||
|
||||
|
||||
# End of makefile for libpng
|
@ -34,7 +34,7 @@ RANLIB=ranlib
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 10
|
||||
PNGMIN = 6h
|
||||
PNGMIN = 6i
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
@ -25,7 +25,7 @@ RANLIB=echo
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 10
|
||||
PNGMIN = 6h
|
||||
PNGMIN = 6i
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
@ -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.6h
|
||||
LIBS=libpng.so.1.0.6h
|
||||
VER=1.0.6i
|
||||
LIBS=libpng.so.1.0.6i
|
||||
SHAREDLIB=libpng.so
|
||||
libdir=$(prefix)/lib32
|
||||
|
||||
|
@ -31,7 +31,7 @@ RANLIB=echo
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 10
|
||||
PNGMIN = 6h
|
||||
PNGMIN = 6i
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
@ -1,29 +1,49 @@
|
||||
# Makefile for libpng
|
||||
# Watcom 10.0 and later 32-bit protected mode flat memory model
|
||||
# Watcom C/C++ 10.0 and later, 32-bit protected mode, flat memory model
|
||||
|
||||
# Adapted by Pawel Mrochen, based on makefile.msc
|
||||
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
|
||||
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
# For conditions of distribution and use, see copyright notice in png.h
|
||||
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
|
||||
|
||||
# To use, do "wmake /f scripts\makefile.watcom"
|
||||
|
||||
# ------------- Watcom 10.0 and later -------------
|
||||
MODEL=-mf
|
||||
CFLAGS= $(MODEL) -5r -fp5 -fpi87 -oneatx -i=..\zlib
|
||||
CC=wcc386
|
||||
LD=wcl386
|
||||
LIB=wlib -b -c
|
||||
LDFLAGS=
|
||||
O=.obj
|
||||
|
||||
#uncomment next to put error messages in a file
|
||||
# ---------------------- Watcom C/C++ 10.0 and later -----------------------
|
||||
|
||||
# Where the zlib library and include files are located
|
||||
ZLIBLIB=..\zlib
|
||||
ZLIBINC=..\zlib
|
||||
|
||||
# Target OS
|
||||
OS=DOS
|
||||
#OS=NT
|
||||
|
||||
# Target CPU
|
||||
CPU=6 # Pentium Pro
|
||||
#CPU=5 # Pentium
|
||||
|
||||
# Calling convention
|
||||
CALLING=r # registers
|
||||
#CALLING=s # stack
|
||||
|
||||
# Uncomment next to put error messages in a file
|
||||
#ERRFILE=>>pngerrs
|
||||
|
||||
# variables
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
|
||||
CC=wcc386
|
||||
CFLAGS=-$(CPU)$(CALLING) -fp$(CPU) -fpi87 -oneatx -mf -bt=$(OS) -i=$(ZLIBINC) -zq
|
||||
LD=wcl386
|
||||
LDFLAGS=-zq
|
||||
|
||||
O=.obj
|
||||
|
||||
OBJS1=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)
|
||||
OBJS2=pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)
|
||||
OBJS3=pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
|
||||
|
||||
|
||||
all: test
|
||||
|
||||
png$(O): png.h pngconf.h
|
||||
@ -75,14 +95,15 @@ pngwutil$(O): png.h pngconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
|
||||
$(LIB) -n libpng.lib $(OBJS1)
|
||||
$(LIB) libpng.lib $(OBJS2)
|
||||
$(LIB) libpng.lib $(OBJS3)
|
||||
wlib -b -c -n -q libpng.lib $(OBJS1)
|
||||
wlib -b -c -q libpng.lib $(OBJS2)
|
||||
wlib -b -c -q libpng.lib $(OBJS3)
|
||||
|
||||
pngtest.exe: pngtest.obj libpng.lib
|
||||
$(LD) $(LDFLAGS) pngtest.obj libpng.lib ..\zlib\zlib.lib
|
||||
$(LD) $(LDFLAGS) pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib
|
||||
|
||||
test: pngtest.exe .symbolic
|
||||
pngtest
|
||||
pngtest.exe
|
||||
|
||||
|
||||
# End of makefile for libpng
|
||||
|
@ -3,7 +3,7 @@ unit pngdef;
|
||||
interface
|
||||
|
||||
const
|
||||
PNG_LIBPNG_VER_STRING = '1.0.6h';
|
||||
PNG_LIBPNG_VER_STRING = '1.0.6i';
|
||||
PNG_LIBPNG_VER = 10007;
|
||||
|
||||
type
|
||||
|
Reference in New Issue
Block a user