Imported from libpng-1.0.5s.tar
This commit is contained in:
parent
61c32d9e66
commit
a77ef625a6
27
ANNOUNCE
27
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.0.5q - February 5, 2000
|
||||
Libpng 1.0.5s - February 18, 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.
|
||||
@ -139,6 +139,31 @@ version 1.0.5q [February 5, 2000]
|
||||
Relocated the makefile.solaris warning about PATH problems.
|
||||
Fixed pngvcrd.c bug by pushing/popping registers in mmxsupport (Bruce Oberg)
|
||||
Revised makefile.gcmmx
|
||||
Added PNG_SETJMP_SUPPORTED, PNG_SETJMP_NOT_SUPPORTED, and PNG_ABORT() macros
|
||||
version 1.0.5r [February 7, 2000]
|
||||
Removed superfluous prototype for png_get_itxt from png.h
|
||||
Fixed a bug in pngrtran.c that improperly expanded the background color.
|
||||
Return *num_text=0 from png_get_text() when appropriate, and fix documentation
|
||||
of png_get_text() in libpng.txt/libpng.3.
|
||||
version 1.0.5s [February 18, 2000]
|
||||
Added "png_jmpbuf()" macro to pngconf.h, to help people migrate to the
|
||||
new error handler that's planned for the next libpng release, and changed
|
||||
example.c, pngtest.c, and contrib programs to use this macro.
|
||||
Revised some of the DLL-export macros in pngconf.h (Greg Roelofs)
|
||||
Fixed a bug in png_read_png() that caused it to fail to expand some images
|
||||
that it should have expanded.
|
||||
Fixed some mistakes in the unused and undocumented INCH_CONVERSIONS functions
|
||||
in pngget.c
|
||||
Changed the allocation of palette, history, and trans arrays back to
|
||||
the version 1.0.5 method (linking instead of copying) which restores
|
||||
backward compatibility with version 1.0.5. Added some remarks about
|
||||
that in example.c
|
||||
Updated makefile.linux and makefile.gccmmx to make directories conditionally.
|
||||
Made cosmetic changes to pngasmrd.h
|
||||
Added png_set_rows() and png_get_rows(), for use with png_read|write_png().
|
||||
Modified png_read_png() to allocate info_ptr->row_pointers only if it
|
||||
hasn't already been allocated.
|
||||
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
23
CHANGES
23
CHANGES
@ -611,3 +611,26 @@ version 1.0.5q [February 5, 2000]
|
||||
Fixed pngvcrd.c bug by pushing/popping registers in mmxsupport (Bruce Oberg)
|
||||
Revised makefile.gcmmx
|
||||
Added PNG_SETJMP_SUPPORTED, PNG_SETJMP_NOT_SUPPORTED, and PNG_ABORT() macros
|
||||
version 1.0.5r [February 7, 2000]
|
||||
Removed superfluous prototype for png_get_itxt from png.h
|
||||
Fixed a bug in pngrtran.c that improperly expanded the background color.
|
||||
Return *num_text=0 from png_get_text() when appropriate, and fix documentation
|
||||
of png_get_text() in libpng.txt/libpng.3.
|
||||
version 1.0.5s [February 18, 2000]
|
||||
Added "png_jmp_env()" macro to pngconf.h, to help people migrate to the
|
||||
new error handler that's planned for the next libpng release, and changed
|
||||
example.c, pngtest.c, and contrib programs to use this macro.
|
||||
Revised some of the DLL-export macros in pngconf.h (Greg Roelofs)
|
||||
Fixed a bug in png_read_png() that caused it to fail to expand some images
|
||||
that it should have expanded.
|
||||
Fixed some mistakes in the unused and undocumented INCH_CONVERSIONS functions
|
||||
in pngget.c
|
||||
Changed the allocation of palette, history, and trans arrays back to
|
||||
the version 1.0.5 method (linking instead of copying) which restores
|
||||
backward compatibility with version 1.0.5. Added some remarks about
|
||||
that in example.c. Added "free_me" member to info_ptr and png_ptr.
|
||||
Updated makefile.linux and makefile.gccmmx to make directories conditionally.
|
||||
Made cosmetic changes to pngasmrd.h
|
||||
Added png_set_rows() and png_get_rows(), for use with png_read|write_png().
|
||||
Modified png_read_png() to allocate info_ptr->row_pointers only if it
|
||||
hasn't already been allocated.
|
||||
|
10
INSTALL
10
INSTALL
@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.0.5q - February 5, 2000
|
||||
Installing libpng version 1.0.5s - February 18, 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.5q" or "lpng103" and "zlib-1.1.3"
|
||||
might be called "libpng-1.0.5s" or "lpng103" and "zlib-1.1.3"
|
||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
@ -55,9 +55,9 @@ include
|
||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||
makefile.sgi => Silicon Graphics IRIX makefile
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.5q)
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5q)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5q,
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.5s)
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5s)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5s,
|
||||
uses assembler code tuned for Intel MMX platform)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mips => MIPS makefile
|
||||
|
7
KNOWNBUG
7
KNOWNBUG
@ -74,3 +74,10 @@ Known bugs and suggested enhancements in libpng-1.0.5
|
||||
The new pnggccrd.c has syntax errors when compiled with gcc.
|
||||
|
||||
STATUS: Under investigation.
|
||||
|
||||
8. February 2000 -- BUG
|
||||
|
||||
When an RGBA file is expanded, only 24 or 48 bits per pixel are reserved
|
||||
in rowbytes.
|
||||
|
||||
STATUS: Fixed in libpng-1.0.5s
|
||||
|
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.5q, February 5, 2000)
|
||||
(libpng versions 0.97, January 1998, through 1.0.5s, February 18, 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
|
||||
February 5, 2000
|
||||
February 18, 2000
|
||||
|
8
README
8
README
@ -1,4 +1,4 @@
|
||||
README for libpng 1.0.5q - February 5, 2000 (shared library 2.1)
|
||||
README for libpng 1.0.5s - February 18, 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.
|
||||
@ -175,11 +175,11 @@ Files in this distribution:
|
||||
makefile.sgi => Silicon Graphics IRIX makefile
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng.so.2.1.0.5q)
|
||||
(gcc, creates libpng.so.2.1.0.5s)
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng.so.2.1.0.5q)
|
||||
(gcc, creates libpng.so.2.1.0.5s)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||
libpng.so.2.1.0.5q, uses assembler code
|
||||
libpng.so.2.1.0.5s, uses assembler code
|
||||
tuned for Intel MMX platform)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mips => MIPS makefile
|
||||
|
4
Y2KINFO
4
Y2KINFO
@ -1,13 +1,13 @@
|
||||
Y2K compliance in libpng:
|
||||
=========================
|
||||
|
||||
February 5, 2000
|
||||
February 18, 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.5q are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.5s 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
|
||||
|
@ -89,7 +89,7 @@ int readpng_init(FILE *infile, long *pWidth, long *pHeight)
|
||||
/* setjmp() must be called in every function that calls a PNG-reading
|
||||
* libpng function */
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(png_ptr))) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return 2;
|
||||
}
|
||||
@ -130,7 +130,7 @@ int readpng_get_bgcolor(uch *red, uch *green, uch *blue)
|
||||
/* setjmp() must be called in every function that calls a PNG-reading
|
||||
* libpng function */
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(png_ptr))) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return 2;
|
||||
}
|
||||
@ -184,7 +184,7 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
||||
/* setjmp() must be called in every function that calls a PNG-reading
|
||||
* libpng function */
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(png_ptr))) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
||||
* but compatible error handlers must either use longjmp() themselves
|
||||
* (as in this program) or exit immediately, so here we are: */
|
||||
|
||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(mainprog_ptr))) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return 2;
|
||||
}
|
||||
@ -136,7 +136,7 @@ int readpng2_decode_data(mainprog_info *mainprog_ptr, uch *rawbuf, ulg length)
|
||||
/* setjmp() must be called in every function that calls a PNG-reading
|
||||
* libpng function */
|
||||
|
||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(mainprog_ptr))) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
mainprog_ptr->png_ptr = NULL;
|
||||
mainprog_ptr->info_ptr = NULL;
|
||||
|
@ -82,7 +82,7 @@ int writepng_init(mainprog_info *mainprog_ptr)
|
||||
* but compatible error handlers must either use longjmp() themselves
|
||||
* (as in this program) or exit immediately, so here we go: */
|
||||
|
||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(mainprog_ptr))) {
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
return 2;
|
||||
}
|
||||
@ -239,7 +239,7 @@ int writepng_encode_image(mainprog_info *mainprog_ptr)
|
||||
/* as always, setjmp() must be called in every function that calls a
|
||||
* PNG-writing libpng function */
|
||||
|
||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(mainprog_ptr))) {
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
mainprog_ptr->png_ptr = NULL;
|
||||
mainprog_ptr->info_ptr = NULL;
|
||||
@ -277,7 +277,7 @@ int writepng_encode_row(mainprog_info *mainprog_ptr) /* NON-interlaced only! */
|
||||
/* as always, setjmp() must be called in every function that calls a
|
||||
* PNG-writing libpng function */
|
||||
|
||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(mainprog_ptr))) {
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
mainprog_ptr->png_ptr = NULL;
|
||||
mainprog_ptr->info_ptr = NULL;
|
||||
@ -307,7 +307,7 @@ int writepng_encode_finish(mainprog_info *mainprog_ptr) /* NON-interlaced! */
|
||||
/* as always, setjmp() must be called in every function that calls a
|
||||
* PNG-writing libpng function */
|
||||
|
||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||
if (setjmp(png_jmp_env(mainprog_ptr))) {
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
mainprog_ptr->png_ptr = NULL;
|
||||
mainprog_ptr->info_ptr = NULL;
|
||||
|
@ -223,7 +223,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
||||
return FALSE; /* out of memory */
|
||||
}
|
||||
|
||||
if (setjmp (png_ptr->jmpbuf))
|
||||
if (setjmp (png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
return FALSE;
|
||||
|
@ -386,7 +386,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
}
|
||||
|
||||
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
|
||||
if (setjmp (png_ptr->jmpbuf))
|
||||
if (setjmp (png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
||||
return FALSE;
|
||||
|
35
example.c
35
example.c
@ -111,7 +111,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||
* the normal method of doing things with libpng). REQUIRED unless you
|
||||
* set up your own error handlers in the png_create_read_struct() earlier.
|
||||
*/
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
/* Free all of the memory associated with the png_ptr and info_ptr */
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
@ -405,7 +405,7 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (setjmp((*png_ptr)->jmpbuf))
|
||||
if (setjmp(png_jmp_env((*png_ptr))))
|
||||
{
|
||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
||||
return ERROR;
|
||||
@ -433,7 +433,7 @@ int
|
||||
process_data(png_structp *png_ptr, png_infop *info_ptr,
|
||||
png_bytep buffer, png_uint_32 length)
|
||||
{
|
||||
if (setjmp((*png_ptr)->jmpbuf))
|
||||
if (setjmp(png_jmp_env((*png_ptr))))
|
||||
{
|
||||
/* Free the png_ptr and info_ptr memory on error */
|
||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
||||
@ -515,6 +515,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
FILE *fp;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_colorp palette;
|
||||
|
||||
/* open the file */
|
||||
fp = fopen(file_name, "wb");
|
||||
@ -592,11 +593,9 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
palette = (png_colorp)png_malloc(png_ptr, 256 * sizeof (png_color));
|
||||
/* ... set palette colors ... */
|
||||
png_set_PLTE(png_ptr, info_ptr, palette, 256);
|
||||
/* You can free the palette here if you like, since libpng has made its
|
||||
own copy. In versions of libpng earlier than version 1.0.5n, it was
|
||||
necessary to keep the palette until after png_write_end(), because
|
||||
libpng was using the caller's copy. */
|
||||
free(palette);
|
||||
/* You must not free palette here, because png_set_PLTE only makes a link to
|
||||
the palette that you malloced. Wait until you are about to destroy
|
||||
the png structure. */
|
||||
|
||||
/* optional significant bit chunk */
|
||||
/* if we are dealing with a grayscale image then */
|
||||
@ -699,10 +698,10 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
* use the first method if you aren't handling interlacing yourself.
|
||||
*/
|
||||
png_uint_32 k, height, width;
|
||||
png_byte image[height][width];
|
||||
png_byte image[height][width*bytes_per_pixel];
|
||||
png_bytep row_pointers[height];
|
||||
for (k = 0; k < height; k++)
|
||||
row_pointers[k] = image + k*width;
|
||||
row_pointers[k] = image + k*width*bytes_per_pixel;
|
||||
|
||||
/* One of the following output methods is REQUIRED */
|
||||
#ifdef entire /* write out the entire image data in one call */
|
||||
@ -737,11 +736,17 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
png_write_end(png_ptr, info_ptr);
|
||||
#endif hilevel
|
||||
|
||||
/* if you malloced a palette and have not already freed it, free it
|
||||
here (do *not* free libpng's copy of the palette in info_ptr->palette,
|
||||
as recommended in versions 1.0.5m and earlier of this example; libpng
|
||||
now takes care of that automatically). */
|
||||
free(palette);
|
||||
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
|
||||
as recommended in versions 1.0.5m and earlier of this example; if
|
||||
libpng mallocs info_ptr->palette, libpng will free it). If you
|
||||
allocated it with malloc() instead of png_malloc(), use free() instead
|
||||
of png_free(). */
|
||||
png_free(png_ptr, palette);
|
||||
|
||||
/* Similarly, if you png_malloced any data that you passed in with
|
||||
png_set_something(), such as a hist or trans array, free it here,
|
||||
when you can be sure that libpng is through with it. */
|
||||
png_free(png_ptr, trans);
|
||||
|
||||
/* clean up after the write, and free any memory allocated */
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
||||
|
152
libpng.3
152
libpng.3
@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "February 5, 2000"
|
||||
.TH LIBPNG 3 "February 18, 2000"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5q
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5s
|
||||
.SH SYNOPSIS
|
||||
\fI\fB
|
||||
|
||||
@ -92,47 +92,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5q
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fI\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fI\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_pixels (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_spalettes (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fInum_text\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_text (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fInum_text\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_free_unknown_chunks (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fInum_unknowns\fP\fB);\fP
|
||||
\fBvoid png_free_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fInum\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
@ -262,6 +222,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5q
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBpng_bytepp png_get_rows (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBpng_uint_32 png_get_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_8p \fI*sig_bit\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
@ -270,7 +234,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5q
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBpng_uint_32 png_get_spalettes (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fP\fI*splt_ptr\fP\fB, int \fInum\fP\fB);\fP
|
||||
\fBpng_uint_32 png_get_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fP\fI*splt_ptr\fP\fB, int \fInum\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
@ -578,6 +542,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5q
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_set_rows (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytepp \fIrow_pointers\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_set_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_8p \fIsig_bit\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
@ -594,7 +562,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5q
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_set_spalettes (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fP\fIsplt_ptr\fP\fB, int \fInum_spalettes\fP\fB);\fP
|
||||
\fBvoid png_set_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fP\fIsplt_ptr\fP\fB, int \fInum_spalettes\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
@ -741,7 +709,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.5q - February 5, 2000
|
||||
libpng version 1.0.5s - February 18, 2000
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@ -931,17 +899,18 @@ handling and memory alloc/free functions.
|
||||
|
||||
When libpng encounters an error, it expects to longjmp back
|
||||
to your routine. Therefore, you will need to call setjmp and pass
|
||||
your png_ptr->jmpbuf. If you read the file from different
|
||||
your png_jmp_env(png_ptr). If you read the file from different
|
||||
routines, you will need to update the jmpbuf field every time you enter
|
||||
a new routine that will call a png_ function.
|
||||
|
||||
See your documentation of setjmp/longjmp for your compiler for more
|
||||
handling in the Customizing Libpng section below for more information on
|
||||
the libpng error handling. If an error occurs, and libpng longjmp's
|
||||
information on setjmp/longjmp. See the discussion on libpng error
|
||||
handling in the Customizing Libpng section below for more information
|
||||
on the libpng error handling. If an error occurs, and libpng longjmp's
|
||||
back to your setjmp, you will want to call png_destroy_read_struct() to
|
||||
free any memory.
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
&end_info);
|
||||
@ -1289,7 +1258,9 @@ into the info_ptr is returned for any complex types.
|
||||
valid 16-bit red, green and blue
|
||||
values, regardless of color_type
|
||||
|
||||
num_text = png_get_text(png_ptr, info_ptr, &text_ptr);
|
||||
num_comments = png_get_text(png_ptr, info_ptr,
|
||||
&text_ptr, &num_text);
|
||||
num_comments - number of comments
|
||||
text_ptr - array of png_text holding image
|
||||
comments
|
||||
text_ptr[i]->compression - type of compression used
|
||||
@ -1307,7 +1278,8 @@ into the info_ptr is returned for any complex types.
|
||||
text_ptr[i]->lang - language of comment (NULL for unknown).
|
||||
text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL
|
||||
for unknown).
|
||||
num_text - number of comments
|
||||
num_text - number of comments (same as num_comments;
|
||||
you can put NULL here to avoid the duplication)
|
||||
num_spalettes = png_get_spalettes(png_ptr, info_ptr, &palette_ptr);
|
||||
palette_ptr - array of png_spalette structures holding contents
|
||||
of one or more sPLT chunks read.
|
||||
@ -1850,32 +1822,26 @@ When you are done, you can free all memory allocated by libpng like this:
|
||||
&end_info);
|
||||
|
||||
It is also possible to individually free the info_ptr members that
|
||||
point to allocated storage with the following functions:
|
||||
point to libpng-allocated storage with the following functions:
|
||||
|
||||
png_free_text(png_ptr, info_ptr, num)
|
||||
num - number of text item to be freed (-1 for all items)
|
||||
|
||||
png_free_hIST(png_ptr, info_ptr)
|
||||
|
||||
png_free_iCCP(png_ptr, info_ptr)
|
||||
|
||||
png_free_pCAL(png_ptr, info_ptr)
|
||||
|
||||
png_free_sCAL(png_ptr, info_ptr)
|
||||
|
||||
png_free_spalettes(png_ptr, info_ptr, num)
|
||||
num - number of suggested-paletted entry to be freed
|
||||
(-1 for all suggested palettes)
|
||||
|
||||
png_free_pixels(png_ptr, info_ptr)
|
||||
|
||||
png_free_unknown_chunk(png_ptr, info_ptr, num)
|
||||
num - number of unknown chunk to be freed
|
||||
(-1 for all suggested palettes)
|
||||
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
|
||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||
PNG_FREE_SPLT, PNG_FREE_ROWS,
|
||||
PNG_FREE_PCAL, PNG_FREE_SCAL,
|
||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||
or simply PNG_FREE_ALL
|
||||
n - sequence number of item to be freed
|
||||
(-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.
|
||||
case 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.
|
||||
|
||||
For a more compact example of reading a PNG image, see the file example.c.
|
||||
|
||||
@ -1914,7 +1880,7 @@ png_infop info_ptr;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
@ -1948,7 +1914,7 @@ png_infop info_ptr;
|
||||
int
|
||||
process_data(png_bytep buffer, png_uint_32 length)
|
||||
{
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
@ -2103,15 +2069,15 @@ png_create_write_struct_2() instead of png_create_read_struct():
|
||||
After you have these structures, you will need to set up the
|
||||
error handling. When libpng encounters an error, it expects to
|
||||
longjmp() back to your routine. Therefore, you will need to call
|
||||
setjmp() and pass the png_ptr->jmpbuf. If you
|
||||
setjmp() and pass the png_jmp_env(png_ptr). If you
|
||||
write the file from different routines, you will need to update
|
||||
the jmpbuf field every time you enter a new routine that will
|
||||
the png_jmp_env(png_ptr) every time you enter a new routine that will
|
||||
call a png_ function. See your documentation of setjmp/longjmp
|
||||
for your compiler for more information on setjmp/longjmp. See
|
||||
the discussion on libpng error handling in the Customizing Libpng
|
||||
section below for more information on the libpng error handling.
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
fclose(fp);
|
||||
@ -2172,7 +2138,7 @@ types.
|
||||
PNG_FILTER_NONE | PNG_FILTER_SUB |
|
||||
PNG_FILTER_PAETH);
|
||||
|
||||
The png_set_compression_???() functions interface to the zlib compression
|
||||
The png_set_compression_*() functions interface to the zlib compression
|
||||
library, and should mostly be ignored unless you really know what you are
|
||||
doing. The only generally useful call is png_set_compression_level()
|
||||
which changes how much time zlib spends on trying to compress the image
|
||||
@ -2476,7 +2442,7 @@ At this point there are two ways to proceed; through the high-level
|
||||
write interface, or through a sequence of low-level write operations.
|
||||
You can use the high-level interface if your image data is present
|
||||
on the rowpointers member of the info structure. All defined output
|
||||
transformations are pernmitted, enabled by the following masks.
|
||||
transformations are permitted, enabled by the following masks.
|
||||
|
||||
PNG_TRANSFORM_IDENTITY No transformation
|
||||
PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples
|
||||
@ -2496,7 +2462,7 @@ If you have valid image data on the rowpointers member, simply do this:
|
||||
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 to the info
|
||||
mask, followed by followed by a write of the image bytes from the info
|
||||
member `rowpointers', followed by png_write_end().
|
||||
|
||||
(The final parameter of this call is not yet used. Someday it
|
||||
@ -2746,7 +2712,7 @@ When you are done, you can free all memory used by libpng like this:
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
||||
It is also possible to individually free the info_ptr members that
|
||||
point to allocated storage with the following functions:
|
||||
point to libpng-allocated storage with the following functions:
|
||||
|
||||
png_free_text(png_ptr, info_ptr, num)
|
||||
num - number of text item to be freed (-1 for all items)
|
||||
@ -2759,7 +2725,7 @@ point to allocated storage with the following functions:
|
||||
|
||||
png_free_sCAL(png_ptr, info_ptr)
|
||||
|
||||
png_free_spalettes(png_ptr, info_ptr, num)
|
||||
png_free_sPLT(png_ptr, info_ptr, num)
|
||||
num - number of suggested-paletted entry to be freed
|
||||
(-1 for all suggested palettes)
|
||||
|
||||
@ -2773,7 +2739,9 @@ 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.
|
||||
|
||||
If you allocated palette data, you must free it before the call to png_destroy_write_struct();
|
||||
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().
|
||||
|
||||
For a more compact example of writing a PNG image, see the file example.c.
|
||||
|
||||
@ -2787,7 +2755,7 @@ adding new transformations, and generally changing how libpng works.
|
||||
All of the memory allocation, input/output, and error handling in libpng
|
||||
goes through callbacks that are user settable. The default routines are
|
||||
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
|
||||
these functions, call the appropriate png_set_???_fn() function.
|
||||
these functions, call the appropriate png_set_*_fn() function.
|
||||
|
||||
Memory allocation is done through the functions png_large_malloc(),
|
||||
png_malloc(), png_realloc(), png_large_free(), and png_free(). These
|
||||
@ -2844,7 +2812,7 @@ fprintf() unless the library is compiled with PNG_NO_STDIO defined. If
|
||||
you wish to change the behavior of the error functions, you will need to
|
||||
set up your own message callbacks. These functions are normally supplied
|
||||
at the time that the png_struct is created. It is also possible to change
|
||||
these functions after png_create_???_struct() has been called by calling:
|
||||
these functions after png_create_*_struct() has been called by calling:
|
||||
|
||||
png_set_error_fn(png_structp png_ptr,
|
||||
png_voidp error_ptr, png_error_ptr error_fn,
|
||||
@ -2926,7 +2894,7 @@ unsigned char far * far *.
|
||||
|
||||
You will need to write new error and warning functions that use the GUI
|
||||
interface, as described previously, and set them to be the error and
|
||||
warning functions at the time that png_create_???_struct() is called,
|
||||
warning functions at the time that png_create_*_struct() is called,
|
||||
in order to have them available during the structure initialization.
|
||||
They can be changed later via png_set_error_fn(). On some compilers,
|
||||
you may also have to change the memory allocators (png_malloc, etc.).
|
||||
@ -3147,13 +3115,13 @@ the old method.
|
||||
|
||||
.SH VII. Y2K Compliance in libpng
|
||||
|
||||
February 5, 2000
|
||||
February 18, 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.5q are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.5s 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
|
||||
@ -3279,7 +3247,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.0.5q - February 5, 2000:
|
||||
Libpng version 1.0.5s - February 18, 2000:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
|
||||
|
||||
@ -3294,7 +3262,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.5q, February 5, 2000)
|
||||
(libpng versions 0.97, January 1998, through 1.0.5s, February 18, 2000)
|
||||
|
||||
For the purposes of this copyright and license, "Contributing Authors"
|
||||
is defined as the following set of individuals:
|
||||
|
90
libpng.txt
90
libpng.txt
@ -1,6 +1,6 @@
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.0.5q - February 5, 2000
|
||||
libpng version 1.0.5s - February 18, 2000
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@ -190,17 +190,18 @@ handling and memory alloc/free functions.
|
||||
|
||||
When libpng encounters an error, it expects to longjmp back
|
||||
to your routine. Therefore, you will need to call setjmp and pass
|
||||
your png_ptr->jmpbuf. If you read the file from different
|
||||
your png_jmp_env(png_ptr). If you read the file from different
|
||||
routines, you will need to update the jmpbuf field every time you enter
|
||||
a new routine that will call a png_ function.
|
||||
|
||||
See your documentation of setjmp/longjmp for your compiler for more
|
||||
handling in the Customizing Libpng section below for more information on
|
||||
the libpng error handling. If an error occurs, and libpng longjmp's
|
||||
information on setjmp/longjmp. See the discussion on libpng error
|
||||
handling in the Customizing Libpng section below for more information
|
||||
on the libpng error handling. If an error occurs, and libpng longjmp's
|
||||
back to your setjmp, you will want to call png_destroy_read_struct() to
|
||||
free any memory.
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
&end_info);
|
||||
@ -548,7 +549,9 @@ into the info_ptr is returned for any complex types.
|
||||
valid 16-bit red, green and blue
|
||||
values, regardless of color_type
|
||||
|
||||
num_text = png_get_text(png_ptr, info_ptr, &text_ptr);
|
||||
num_comments = png_get_text(png_ptr, info_ptr,
|
||||
&text_ptr, &num_text);
|
||||
num_comments - number of comments
|
||||
text_ptr - array of png_text holding image
|
||||
comments
|
||||
text_ptr[i]->compression - type of compression used
|
||||
@ -566,7 +569,8 @@ into the info_ptr is returned for any complex types.
|
||||
text_ptr[i]->lang - language of comment (NULL for unknown).
|
||||
text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL
|
||||
for unknown).
|
||||
num_text - number of comments
|
||||
num_text - number of comments (same as num_comments;
|
||||
you can put NULL here to avoid the duplication)
|
||||
num_spalettes = png_get_spalettes(png_ptr, info_ptr, &palette_ptr);
|
||||
palette_ptr - array of png_spalette structures holding contents
|
||||
of one or more sPLT chunks read.
|
||||
@ -1109,32 +1113,26 @@ When you are done, you can free all memory allocated by libpng like this:
|
||||
&end_info);
|
||||
|
||||
It is also possible to individually free the info_ptr members that
|
||||
point to allocated storage with the following functions:
|
||||
point to libpng-allocated storage with the following functions:
|
||||
|
||||
png_free_text(png_ptr, info_ptr, num)
|
||||
num - number of text item to be freed (-1 for all items)
|
||||
|
||||
png_free_hIST(png_ptr, info_ptr)
|
||||
|
||||
png_free_iCCP(png_ptr, info_ptr)
|
||||
|
||||
png_free_pCAL(png_ptr, info_ptr)
|
||||
|
||||
png_free_sCAL(png_ptr, info_ptr)
|
||||
|
||||
png_free_spalettes(png_ptr, info_ptr, num)
|
||||
num - number of suggested-paletted entry to be freed
|
||||
(-1 for all suggested palettes)
|
||||
|
||||
png_free_pixels(png_ptr, info_ptr)
|
||||
|
||||
png_free_unknown_chunk(png_ptr, info_ptr, num)
|
||||
num - number of unknown chunk to be freed
|
||||
(-1 for all suggested palettes)
|
||||
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
|
||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||
PNG_FREE_SPLT, PNG_FREE_ROWS,
|
||||
PNG_FREE_PCAL, PNG_FREE_SCAL,
|
||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||
or simply PNG_FREE_ALL
|
||||
n - sequence number of item to be freed
|
||||
(-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.
|
||||
case 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.
|
||||
|
||||
For a more compact example of reading a PNG image, see the file example.c.
|
||||
|
||||
@ -1173,7 +1171,7 @@ png_infop info_ptr;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
@ -1207,7 +1205,7 @@ png_infop info_ptr;
|
||||
int
|
||||
process_data(png_bytep buffer, png_uint_32 length)
|
||||
{
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
@ -1362,15 +1360,15 @@ png_create_write_struct_2() instead of png_create_read_struct():
|
||||
After you have these structures, you will need to set up the
|
||||
error handling. When libpng encounters an error, it expects to
|
||||
longjmp() back to your routine. Therefore, you will need to call
|
||||
setjmp() and pass the png_ptr->jmpbuf. If you
|
||||
setjmp() and pass the png_jmp_env(png_ptr). If you
|
||||
write the file from different routines, you will need to update
|
||||
the jmpbuf field every time you enter a new routine that will
|
||||
the png_jmp_env(png_ptr) every time you enter a new routine that will
|
||||
call a png_ function. See your documentation of setjmp/longjmp
|
||||
for your compiler for more information on setjmp/longjmp. See
|
||||
the discussion on libpng error handling in the Customizing Libpng
|
||||
section below for more information on the libpng error handling.
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmp_env(png_ptr)))
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
fclose(fp);
|
||||
@ -1431,7 +1429,7 @@ types.
|
||||
PNG_FILTER_NONE | PNG_FILTER_SUB |
|
||||
PNG_FILTER_PAETH);
|
||||
|
||||
The png_set_compression_???() functions interface to the zlib compression
|
||||
The png_set_compression_*() functions interface to the zlib compression
|
||||
library, and should mostly be ignored unless you really know what you are
|
||||
doing. The only generally useful call is png_set_compression_level()
|
||||
which changes how much time zlib spends on trying to compress the image
|
||||
@ -1735,7 +1733,7 @@ At this point there are two ways to proceed; through the high-level
|
||||
write interface, or through a sequence of low-level write operations.
|
||||
You can use the high-level interface if your image data is present
|
||||
on the rowpointers member of the info structure. All defined output
|
||||
transformations are pernmitted, enabled by the following masks.
|
||||
transformations are permitted, enabled by the following masks.
|
||||
|
||||
PNG_TRANSFORM_IDENTITY No transformation
|
||||
PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples
|
||||
@ -1755,7 +1753,7 @@ If you have valid image data on the rowpointers member, simply do this:
|
||||
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 to the info
|
||||
mask, followed by followed by a write of the image bytes from the info
|
||||
member `rowpointers', followed by png_write_end().
|
||||
|
||||
(The final parameter of this call is not yet used. Someday it
|
||||
@ -2005,7 +2003,7 @@ When you are done, you can free all memory used by libpng like this:
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
||||
It is also possible to individually free the info_ptr members that
|
||||
point to allocated storage with the following functions:
|
||||
point to libpng-allocated storage with the following functions:
|
||||
|
||||
png_free_text(png_ptr, info_ptr, num)
|
||||
num - number of text item to be freed (-1 for all items)
|
||||
@ -2018,7 +2016,7 @@ point to allocated storage with the following functions:
|
||||
|
||||
png_free_sCAL(png_ptr, info_ptr)
|
||||
|
||||
png_free_spalettes(png_ptr, info_ptr, num)
|
||||
png_free_sPLT(png_ptr, info_ptr, num)
|
||||
num - number of suggested-paletted entry to be freed
|
||||
(-1 for all suggested palettes)
|
||||
|
||||
@ -2032,7 +2030,9 @@ 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.
|
||||
|
||||
If you allocated palette data, you must free it before the call to png_destroy_write_struct();
|
||||
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().
|
||||
|
||||
For a more compact example of writing a PNG image, see the file example.c.
|
||||
|
||||
@ -2046,7 +2046,7 @@ adding new transformations, and generally changing how libpng works.
|
||||
All of the memory allocation, input/output, and error handling in libpng
|
||||
goes through callbacks that are user settable. The default routines are
|
||||
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
|
||||
these functions, call the appropriate png_set_???_fn() function.
|
||||
these functions, call the appropriate png_set_*_fn() function.
|
||||
|
||||
Memory allocation is done through the functions png_large_malloc(),
|
||||
png_malloc(), png_realloc(), png_large_free(), and png_free(). These
|
||||
@ -2103,7 +2103,7 @@ fprintf() unless the library is compiled with PNG_NO_STDIO defined. If
|
||||
you wish to change the behavior of the error functions, you will need to
|
||||
set up your own message callbacks. These functions are normally supplied
|
||||
at the time that the png_struct is created. It is also possible to change
|
||||
these functions after png_create_???_struct() has been called by calling:
|
||||
these functions after png_create_*_struct() has been called by calling:
|
||||
|
||||
png_set_error_fn(png_structp png_ptr,
|
||||
png_voidp error_ptr, png_error_ptr error_fn,
|
||||
@ -2185,7 +2185,7 @@ Configuring for gui/windowing platforms:
|
||||
|
||||
You will need to write new error and warning functions that use the GUI
|
||||
interface, as described previously, and set them to be the error and
|
||||
warning functions at the time that png_create_???_struct() is called,
|
||||
warning functions at the time that png_create_*_struct() is called,
|
||||
in order to have them available during the structure initialization.
|
||||
They can be changed later via png_set_error_fn(). On some compilers,
|
||||
you may also have to change the memory allocators (png_malloc, etc.).
|
||||
@ -2406,13 +2406,13 @@ the old method.
|
||||
|
||||
VII. Y2K Compliance in libpng
|
||||
|
||||
February 5, 2000
|
||||
February 18, 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.5q are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.5s 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 February 5, 2000
|
||||
.TH LIBPNGPF 3 February 18, 2000
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5q
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5s
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include <png.h>\fP
|
||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "February 5, 2000"
|
||||
.TH PNG 5 "February 18, 2000"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
189
png.c
189
png.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* libpng version 1.0.5q - February 5, 2000
|
||||
* libpng version 1.0.5s - February 18, 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
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
#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.5q";
|
||||
char png_libpng_ver[12] = "1.0.5s";
|
||||
|
||||
/* png_sig was changed to a function in version 1.0.5c */
|
||||
/* Place to hold the signature string for a PNG file. */
|
||||
@ -62,10 +62,10 @@ int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||
/* offset to next interlace block in the y direction */
|
||||
int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* Width of interlace block. This is not currently used - if you need
|
||||
* it, uncomment it here and in png.h
|
||||
/* width of interlace block (used in assembler routines only) */
|
||||
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* Height of interlace block. This is not currently used - if you need
|
||||
* it, uncomment it here and in png.h
|
||||
@ -259,13 +259,16 @@ png_info_init(png_infop info_ptr)
|
||||
png_memset(info_ptr, 0, sizeof (png_info));
|
||||
}
|
||||
|
||||
#if defined(PNG_TEXT_SUPPORTED)
|
||||
/* free text item num or (if num == -1) all text items */
|
||||
void
|
||||
png_free_text(png_structp png_ptr, png_infop info_ptr, int num)
|
||||
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
#if defined(PNG_TEXT_SUPPORTED)
|
||||
/* free text item num or (if num == -1) all text items */
|
||||
if (mask & PNG_FREE_TEXT)
|
||||
{
|
||||
if (num != -1)
|
||||
{
|
||||
if (info_ptr->text[num].key)
|
||||
@ -277,13 +280,10 @@ png_free_text(png_structp png_ptr, png_infop info_ptr, int num)
|
||||
else if (info_ptr->text != NULL)
|
||||
{
|
||||
int i;
|
||||
if(info_ptr->text != NULL)
|
||||
{
|
||||
for (i = 0; i < info_ptr->num_text; i++)
|
||||
png_free_text(png_ptr, info_ptr, i);
|
||||
png_free(png_ptr, info_ptr->text);
|
||||
info_ptr->text = NULL;
|
||||
}
|
||||
for (i = 0; i < info_ptr->num_text; i++)
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i);
|
||||
png_free(png_ptr, info_ptr->text);
|
||||
info_ptr->text = NULL;
|
||||
info_ptr->num_text=0;
|
||||
}
|
||||
}
|
||||
@ -291,14 +291,12 @@ png_free_text(png_structp png_ptr, png_infop info_ptr, int num)
|
||||
|
||||
#if defined(PNG_tRNS_SUPPORTED)
|
||||
/* free any tRNS entry */
|
||||
void
|
||||
png_free_tRNS(png_structp png_ptr, png_infop info_ptr)
|
||||
if (mask & PNG_FREE_TRNS)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->valid & PNG_INFO_tRNS)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->trans);
|
||||
if (info_ptr->free_me & PNG_FREE_TRNS)
|
||||
png_free(png_ptr, info_ptr->trans);
|
||||
info_ptr->valid &= ~PNG_INFO_tRNS;
|
||||
}
|
||||
}
|
||||
@ -306,19 +304,13 @@ png_free_tRNS(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
#if defined(PNG_sCAL_SUPPORTED)
|
||||
/* free any sCAL entry */
|
||||
void
|
||||
png_free_sCAL(png_structp png_ptr, png_infop info_ptr)
|
||||
if (mask & PNG_FREE_SCAL)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->valid & PNG_INFO_sCAL)
|
||||
{
|
||||
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
png_free(png_ptr, info_ptr->scal_s_width);
|
||||
png_free(png_ptr, info_ptr->scal_s_height);
|
||||
#else
|
||||
if(png_ptr != NULL)
|
||||
/* silence a compiler warning */ ;
|
||||
#endif
|
||||
info_ptr->valid &= ~PNG_INFO_sCAL;
|
||||
}
|
||||
@ -327,11 +319,8 @@ png_free_sCAL(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
#if defined(PNG_pCAL_SUPPORTED)
|
||||
/* free any pCAL entry */
|
||||
void
|
||||
png_free_pCAL(png_structp png_ptr, png_infop info_ptr)
|
||||
if (mask & PNG_FREE_PCAL)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->valid & PNG_INFO_pCAL)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->pcal_purpose);
|
||||
@ -352,15 +341,15 @@ png_free_pCAL(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
#if defined(PNG_iCCP_SUPPORTED)
|
||||
/* free any iCCP entry */
|
||||
void
|
||||
png_free_iCCP(png_structp png_ptr, png_infop info_ptr)
|
||||
if (mask & PNG_FREE_ICCP)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->valid & PNG_INFO_iCCP)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->iccp_name);
|
||||
png_free(png_ptr, info_ptr->iccp_profile);
|
||||
if (info_ptr->free_me & PNG_FREE_ICCP)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->iccp_name);
|
||||
png_free(png_ptr, info_ptr->iccp_profile);
|
||||
}
|
||||
info_ptr->valid &= ~PNG_INFO_iCCP;
|
||||
}
|
||||
}
|
||||
@ -368,11 +357,8 @@ png_free_iCCP(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
#if defined(PNG_sPLT_SUPPORTED)
|
||||
/* free a given sPLT entry, or (if num == -1) all sPLT entries */
|
||||
void
|
||||
png_free_spalettes(png_structp png_ptr, png_infop info_ptr, int num)
|
||||
if (mask & PNG_FREE_SPLT)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (num != -1)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->splt_palettes[num].name);
|
||||
@ -381,26 +367,22 @@ png_free_spalettes(png_structp png_ptr, png_infop info_ptr, int num)
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
if(info_ptr->splt_palettes_num)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_SPLT, i);
|
||||
|
||||
if(info_ptr->splt_palettes_num == 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
|
||||
png_free_spalettes(png_ptr, info_ptr, i);
|
||||
|
||||
png_free(png_ptr, info_ptr->splt_palettes);
|
||||
info_ptr->splt_palettes_num = 0;
|
||||
png_free(png_ptr, info_ptr->splt_palettes);
|
||||
info_ptr->splt_palettes_num = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
void
|
||||
png_free_unknown_chunks(png_structp png_ptr, png_infop info_ptr, int num)
|
||||
if (mask & PNG_FREE_UNKN)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (num != -1)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->unknown_chunks[num].data);
|
||||
@ -410,77 +392,60 @@ png_free_unknown_chunks(png_structp png_ptr, png_infop info_ptr, int num)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(info_ptr->unknown_chunks_num == 0)
|
||||
return;
|
||||
if(info_ptr->unknown_chunks_num)
|
||||
{
|
||||
for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);
|
||||
|
||||
for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
|
||||
png_free_unknown_chunks(png_ptr, info_ptr, i);
|
||||
|
||||
png_free(png_ptr, info_ptr->unknown_chunks);
|
||||
info_ptr->unknown_chunks_num = 0;
|
||||
}
|
||||
}
|
||||
void
|
||||
png_free_chunk_list(png_structp png_ptr)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
if (png_ptr->num_chunk_list)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunk_list);
|
||||
png_ptr->num_chunk_list=0;
|
||||
png_free(png_ptr, info_ptr->unknown_chunks);
|
||||
info_ptr->unknown_chunks_num = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_hIST_SUPPORTED)
|
||||
/* free any hIST entry */
|
||||
void
|
||||
png_free_hIST(png_structp png_ptr, png_infop info_ptr)
|
||||
if (mask & PNG_FREE_HIST)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->valid & PNG_INFO_hIST)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->hist);
|
||||
if (info_ptr->free_me & PNG_FREE_HIST)
|
||||
png_free(png_ptr, info_ptr->hist);
|
||||
info_ptr->valid &= ~PNG_INFO_hIST;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* free any PLTE entry that was internally allocated */
|
||||
void
|
||||
png_free_PLTE(png_structp png_ptr, png_infop info_ptr)
|
||||
if (mask & PNG_FREE_PLTE)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->valid & PNG_INFO_PLTE)
|
||||
{
|
||||
if (info_ptr->valid & PNG_ALLOCATED_INFO_PLTE)
|
||||
if (info_ptr->free_me & PNG_FREE_PLTE)
|
||||
png_zfree(png_ptr, info_ptr->palette);
|
||||
info_ptr->valid &= ~(PNG_INFO_PLTE|PNG_ALLOCATED_INFO_PLTE);
|
||||
info_ptr->valid &= ~(PNG_INFO_PLTE);
|
||||
info_ptr->num_palette = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
||||
/* free any image bits attached to the info structure */
|
||||
void
|
||||
png_free_pixels(png_structp png_ptr, png_infop info_ptr)
|
||||
if (mask & PNG_FREE_ROWS)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->valid & PNG_INFO_IDAT)
|
||||
if (info_ptr->free_me & PNG_FREE_ROWS)
|
||||
{
|
||||
int row;
|
||||
|
||||
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->valid &= ~PNG_INFO_IDAT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(num == -1)
|
||||
info_ptr->free_me &= ~mask;
|
||||
}
|
||||
|
||||
/* This is an internal routine to free any memory that the info struct is
|
||||
* pointing to before re-using it or freeing the struct itself. Recall
|
||||
@ -490,35 +455,17 @@ void
|
||||
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
png_debug(1, "in png_info_destroy\n");
|
||||
#if defined(PNG_READ_TEXT_SUPPORTED)
|
||||
png_free_text(png_ptr, info_ptr, -1);
|
||||
#endif
|
||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||
png_free_tRNS(png_ptr, info_ptr);
|
||||
#endif
|
||||
#if defined(PNG_READ_sCAL_SUPPORTED)
|
||||
png_free_sCAL(png_ptr, info_ptr);
|
||||
#endif
|
||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
||||
png_free_pCAL(png_ptr, info_ptr);
|
||||
#endif
|
||||
#if defined(PNG_READ_iCCP_SUPPORTED)
|
||||
png_free_iCCP(png_ptr, info_ptr);
|
||||
#endif
|
||||
#if defined(PNG_READ_sPLT_SUPPORTED)
|
||||
png_free_spalettes(png_ptr, info_ptr, -1);
|
||||
#endif
|
||||
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
png_free_unknown_chunks(png_ptr, info_ptr, -1);
|
||||
png_free_chunk_list(png_ptr);
|
||||
#endif
|
||||
#if defined(PNG_hIST_SUPPORTED)
|
||||
png_free_hIST(png_ptr, info_ptr);
|
||||
#endif
|
||||
png_free_PLTE(png_ptr, info_ptr);
|
||||