Imported from libpng-1.0.10beta1.tar
This commit is contained in:
parent
d4e8109a48
commit
1909560348
63
ANNOUNCE
63
ANNOUNCE
@ -1,58 +1,21 @@
|
||||
|
||||
Libpng 1.0.9 - January 31, 2001
|
||||
Libpng 1.0.10beta1 - March 14, 2001
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
|
||||
Changes since the last public release (1.0.8):
|
||||
Changes since the last public release (1.0.9):
|
||||
|
||||
Fixed typo in scripts/makefile.hpux
|
||||
Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
|
||||
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
|
||||
Changed "cdrom.com" in documentation to "libpng.org"
|
||||
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
|
||||
Changed type of "params" from voidp to png_voidp in png_read|write_png().
|
||||
Added MNG_EXTENSIONS_SUPPORTED macro and support for some proposed MNG
|
||||
features, for testing purposes.
|
||||
Make sure PNGAPI and PNG_IMPEXP are defined in pngconf.h.
|
||||
Revised the 3 instances of WRITEFILE in pngtest.c.
|
||||
Updated png.rc in dll/msvc project
|
||||
Revised makefile.dec to define and use LIBPATH and INCPATH
|
||||
Increased size of global png_libpng_ver[] array from 12 to 18 chars.
|
||||
Made global png_libpng_ver[], png_sig[] and png_pass_*[] arrays const.
|
||||
Removed duplicate png_crc_finish() from png_handle_bKGD() function.
|
||||
Added a warning when application calls png_read_update_info() multiple times.
|
||||
Revised makefile.cygwin
|
||||
Fixed bugs in iCCP support in pngrutil.c and pngwutil.c.
|
||||
Replaced png_set_empty_plte_permitted() with png_permit_mng_features().
|
||||
Relocated "msvc" and "wince" project subdirectories into "projects"
|
||||
subdirectory and added projects/borland project subdirectory.
|
||||
Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate.
|
||||
Add error message in png_set_compression_buffer_size() when malloc fails.
|
||||
Revised PNG_LIBPNG_BUILD_TYPE macro in png.h, used in the msvc project.
|
||||
Removed the png_flush() in pngwrite.c that crashes some applications
|
||||
that don't set png_output_flush_fn.
|
||||
Added makefile.macosx and makefile.aix to scripts directory.
|
||||
Change png_chunk_warning to png_warning in png_check_keyword().
|
||||
Increased the first part of msg buffer from 16 to 18 in png_chunk_error().
|
||||
Added support for filter method 64 (for PNG datastreams embedded in MNG)
|
||||
Revised png_set_filter() to accept filter method 64 when appropriate.
|
||||
Added new PNG_HAVE_PNG_SIGNATURE bit to png_ptr->mode and use it to
|
||||
help prevent applications from using MNG features in PNG datastreams.
|
||||
Revised libpng.3/libpng.txt. Changed "filter type" to "filter method".
|
||||
Fixed error handling of unknown compression type in png_decompress_chunk().
|
||||
In pngconf.h, define __cdecl when _MSC_VER is defined.
|
||||
Changed PNG_TEXT_COMPRESSION_zTXt to PNG_COMPRESSION_TYPE_BASE several places.
|
||||
Revised memory management in png_set_hIST and png_handle_hIST in a backward
|
||||
compatible manner. PLTE and tRNS were revised similarly.
|
||||
Revised the iCCP chunk reader to ignore trailing garbage.
|
||||
Moved pngasmrd.h into pngconf.h.
|
||||
Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop.
|
||||
Added png_set_invalid to wince and msvc project module definition files.
|
||||
Fixed bug with progressive reading of narrow interlaced images in pngpread.c
|
||||
Do not typedef png_FILE_io in pngconf.h when PNG_NO_STDIO is defined.
|
||||
Updated makefile.sgi to make shared library.
|
||||
Added check of cygwin's ALL_STATIC in pngconf.h
|
||||
Added "-nommx" parameter to contrib/gregbook/rpng2-win and rpng2-x demos.
|
||||
Revised makefile.dec
|
||||
Reformatted libpng.3 to eliminate bad line breaks.
|
||||
Added checks for _mmx_supported in the read_filter_row function of pnggccrd.c
|
||||
Added prototype for png_mmx_support() near the top of pnggccrd.c
|
||||
Moved some error checking from png_handle_IHDR to png_set_IHDR.
|
||||
Added PNG_NO_READ_SUPPORTED and PNG_NO_WRITE_SUPPORTED macros.
|
||||
Revised png_mmx_support() function in pnggccrd.c
|
||||
Restored version 1.0.8 PNG_WRITE_EMPTY_PLTE_SUPPORTED behavior in pngwutil.c
|
||||
Fixed memory leak in contrib/visupng/PngFile.c
|
||||
Fixed bugs in png_combine_row() in pnggccrd.c and pngvcrd.c (C version)
|
||||
Added warnings when retrieving or setting gamma=0.
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
13
CHANGES
13
CHANGES
@ -893,6 +893,19 @@ version 1.0.9rc2 [January 22, 2001]
|
||||
version 1.0.9 [January 31, 2001]
|
||||
Added check of cygwin's ALL_STATIC in pngconf.h
|
||||
Added "-nommx" parameter to contrib/gregbook/rpng2-win and rpng2-x demos.
|
||||
version 1.0.10beta1 [March 14, 2001]
|
||||
Revised makefile.dec, makefile.sgi, and makefile.sggcc; added makefile.hpgcc.
|
||||
Reformatted libpng.3 to eliminate bad line breaks.
|
||||
Added checks for _mmx_supported in the read_filter_row function of pnggccrd.c
|
||||
Added prototype for png_mmx_support() near the top of pnggccrd.c
|
||||
Moved some error checking from png_handle_IHDR to png_set_IHDR.
|
||||
Added PNG_NO_READ_SUPPORTED and PNG_NO_WRITE_SUPPORTED macros.
|
||||
Revised png_mmx_support() function in pnggccrd.c
|
||||
Restored version 1.0.8 PNG_WRITE_EMPTY_PLTE_SUPPORTED behavior in pngwutil.c
|
||||
Fixed memory leak in contrib/visupng/PngFile.c
|
||||
Fixed bugs in png_combine_row() in pnggccrd.c and pngvcrd.c (C version)
|
||||
Added warnings when retrieving or setting gamma=0.
|
||||
Increased the first part of msg buffer from 16 to 18 in png_chunk_warning().
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
13
INSTALL
13
INSTALL
@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.0.9 - January 31, 2001
|
||||
Installing libpng version 1.0.10beta1 - March 14, 2001
|
||||
|
||||
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.9" or "lpng109" and "zlib-1.1.3"
|
||||
might be called "libpng-1.0.10beta1" or "lpng109" and "zlib-1.1.3"
|
||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
@ -59,8 +59,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.9)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9,
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.10beta1)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.10beta1,
|
||||
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
|
||||
@ -69,15 +69,16 @@ include
|
||||
makefile.aix => AIX makefile
|
||||
makefile.cygwin => Cygwin/gcc makefile
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.hpgcc => HPUX makefile using gcc
|
||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||
makefile.intel => Intel C/C++ version 4.0 and later
|
||||
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
||||
makefile.macosx => MACOS X Makefile
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.9)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.10beta1)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.9)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.10beta1)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mips => MIPS makefile
|
||||
makefile.acorn => Acorn makefile
|
||||
|
4
KNOWNBUG
4
KNOWNBUG
@ -1,4 +1,4 @@
|
||||
|
||||
Known bugs in libpng-1.0.9
|
||||
Known bugs in libpng-1.0.10
|
||||
|
||||
None.
|
||||
None as of March 14, 2001.
|
||||
|
14
LICENSE
14
LICENSE
@ -8,8 +8,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.9, January 31, 2001, are
|
||||
Copyright (c) 2000 Glenn Randers-Pehrson
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.10beta1, March 14, 2001, are
|
||||
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
|
||||
and are distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
|
||||
@ -73,11 +73,11 @@ to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
2. Altered versions must be plainly marked as such and
|
||||
must not be misrepresented as being the original source.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
3. This Copyright notice may not be removed or altered from
|
||||
any source or altered source distribution.
|
||||
|
||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
fee, and encourage the use of this source code as a component to
|
||||
@ -99,4 +99,4 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
randeg@alum.rpi.edu
|
||||
January 31, 2001
|
||||
March 14, 2001
|
||||
|
11
README
11
README
@ -1,4 +1,4 @@
|
||||
README for libpng 1.0.9 - January 31, 2001 (shared library 2.1)
|
||||
README for libpng 1.0.10beta1 - March 14, 2001 (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.
|
||||
@ -182,9 +182,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.9)
|
||||
(gcc, creates libpng.so.2.1.0.10beta1)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||
libpng.so.2.1.0.9, uses assembler code
|
||||
libpng.so.2.1.0.10beta1, 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
|
||||
@ -193,16 +193,17 @@ Files in this distribution:
|
||||
makefile.aix => AIX makefile
|
||||
makefile.cygwin => Cygwin/gcc makefile
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.hpgcc => HPUX makefile using gcc
|
||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||
makefile.intel => Intel C/C++ version 4.0 and later
|
||||
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
||||
makefile.macosx => MACOS X Makefile
|
||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.9)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.10beta1)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng.so.2.1.0.9)
|
||||
(gcc, creates libpng.so.2.1.0.10beta1)
|
||||
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:
|
||||
=========================
|
||||
|
||||
January 31, 2001
|
||||
March 14, 2001
|
||||
|
||||
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.9 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.10beta1 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.9. Instead, please
|
||||
There is no \"configure\" script for Libpng-1.0.10beta1. Instead, please
|
||||
copy the appropriate makefile for your system from the \"scripts\"
|
||||
directory. Read the INSTALL file for more details.
|
||||
"
|
||||
|
@ -370,14 +370,14 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||
|
||||
// clean up after the write, and free any memory allocated
|
||||
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
||||
// yepp, done
|
||||
}
|
||||
|
||||
Catch (msg)
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
||||
if(ppbRowPointers)
|
||||
free (ppbRowPointers);
|
||||
|
361
libpng.3
361
libpng.3
@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "January 31, 2001"
|
||||
.TH LIBPNG 3 "March 14, 2001"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.10beta1
|
||||
.SH SYNOPSIS
|
||||
\fI\fB
|
||||
|
||||
@ -747,7 +747,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.9 - January 31, 2001
|
||||
libpng version 1.0.10beta1 - March 14, 2001
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@ -1004,10 +1004,11 @@ input stream. You must supply the function
|
||||
png_byte name[5];
|
||||
png_byte *data;
|
||||
png_size_t size;
|
||||
/* Note that libpng has already taken care of the
|
||||
CRC handling */
|
||||
/* Note that libpng has already taken care of
|
||||
the CRC handling */
|
||||
|
||||
/* put your code here. Return one of the following: */
|
||||
/* put your code here. Return one of the
|
||||
following: */
|
||||
|
||||
return (-n); /* chunk had an error */
|
||||
return (0); /* did not recognize */
|
||||
@ -1078,16 +1079,23 @@ the entire image into memory, and (b) the input transformations
|
||||
you want to do are limited to the following set:
|
||||
|
||||
PNG_TRANSFORM_IDENTITY No transformation
|
||||
PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to 8 bits
|
||||
PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to
|
||||
8 bits
|
||||
PNG_TRANSFORM_STRIP_ALPHA Discard the alpha channel
|
||||
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit samples to bytes
|
||||
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
|
||||
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit
|
||||
samples to bytes
|
||||
PNG_TRANSFORM_PACKSWAP Change order of packed
|
||||
pixels to LSB first
|
||||
PNG_TRANSFORM_EXPAND Perform set_expand()
|
||||
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
|
||||
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
|
||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
|
||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
|
||||
PNG_TRANSFORM_SHIFT Normalize pixels to the
|
||||
sBIT depth
|
||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
|
||||
to BGRA
|
||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA
|
||||
to AG
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
||||
to transparency
|
||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||
|
||||
(This excludes setting a background color, doing gamma transformation,
|
||||
@ -1115,9 +1123,11 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
||||
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));
|
||||
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);
|
||||
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
|
||||
@ -1185,8 +1195,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_method can be NULL if you are
|
||||
not interested in their values.
|
||||
filter_method 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
|
||||
@ -1249,14 +1259,15 @@ into the info_ptr is returned for any complex types.
|
||||
implies specific values of gAMA and
|
||||
cHRM.
|
||||
|
||||
png_get_iCCP(png_ptr, info_ptr, &name, &compression_type,
|
||||
&profile, &proflen);
|
||||
png_get_iCCP(png_ptr, info_ptr, &name,
|
||||
&compression_type, &profile, &proflen);
|
||||
name - The profile name.
|
||||
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
|
||||
for PNG 1.0. You may give NULL to this argument
|
||||
to ignore it.
|
||||
profile - International Color Consortium color profile
|
||||
data. May contain NULs.
|
||||
compression - The compression type; always
|
||||
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
||||
You may give NULL to this argument to
|
||||
ignore it.
|
||||
profile - International Color Consortium color
|
||||
profile data. May contain NULs.
|
||||
proflen - length of profile data in bytes.
|
||||
|
||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
@ -1312,21 +1323,24 @@ into the info_ptr is returned for any complex types.
|
||||
string for unknown).
|
||||
text_ptr[i].translated_keyword - keyword in UTF-8
|
||||
(empty string for unknown).
|
||||
num_text - number of comments (same as num_comments;
|
||||
you can put NULL here to avoid the duplication)
|
||||
Note while png_set_text() will accept text, language, and
|
||||
translated keywords that can be NULL pointers, the structure
|
||||
returned by png_get_text will always contain regular
|
||||
zero-terminated C strings. They might be empty strings but
|
||||
they will never be NULL pointers.
|
||||
num_text - number of comments (same as
|
||||
num_comments; you can put NULL here
|
||||
to avoid the duplication)
|
||||
Note while png_set_text() will accept text, language,
|
||||
and translated keywords that can be NULL pointers, the
|
||||
structure returned by png_get_text will always contain
|
||||
regular zero-terminated C strings. They might be
|
||||
empty strings but they will never be NULL pointers.
|
||||
|
||||
num_spalettes = png_get_sPLT(png_ptr, info_ptr, &palette_ptr);
|
||||
num_spalettes = png_get_sPLT(png_ptr, info_ptr,
|
||||
&palette_ptr);
|
||||
palette_ptr - array of palette structures holding
|
||||
contents of one or more sPLT chunks read.
|
||||
contents of one or more sPLT chunks
|
||||
read.
|
||||
num_spalettes - number of sPLT chunks read.
|
||||
|
||||
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
|
||||
&unit_type);
|
||||
&unit_type);
|
||||
offset_x - positive offset from the left edge
|
||||
of the screen
|
||||
offset_y - positive offset from the top edge
|
||||
@ -1334,7 +1348,7 @@ into the info_ptr is returned for any complex types.
|
||||
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
|
||||
|
||||
png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y,
|
||||
&unit_type);
|
||||
&unit_type);
|
||||
res_x - pixels/unit physical resolution in
|
||||
x direction
|
||||
res_y - pixels/unit physical resolution in
|
||||
@ -1342,47 +1356,50 @@ into the info_ptr is returned for any complex types.
|
||||
unit_type - PNG_RESOLUTION_UNKNOWN,
|
||||
PNG_RESOLUTION_METER
|
||||
|
||||
png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height)
|
||||
png_get_sCAL(png_ptr, info_ptr, &unit, &width,
|
||||
&height)
|
||||
unit - physical scale units (an integer)
|
||||
width - width of a pixel in physical scale units
|
||||
height - height of a pixel in physical scale units
|
||||
(width and height are doubles)
|
||||
|
||||
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, &height)
|
||||
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width,
|
||||
&height)
|
||||
unit - physical scale units (an integer)
|
||||
width - width of a pixel in physical scale units
|
||||
height - height of a pixel in physical scale units
|
||||
(width and height are strings like "2.54")
|
||||
|
||||
num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr,
|
||||
&unknowns)
|
||||
unknowns - array of png_unknown_chunk structures holding
|
||||
unknown chunks
|
||||
num_unknown_chunks = png_get_unknown_chunks(png_ptr,
|
||||
info_ptr, &unknowns)
|
||||
unknowns - array of png_unknown_chunk
|
||||
structures holding unknown chunks
|
||||
unknowns[i].name - name of unknown chunk
|
||||
unknowns[i].data - data of unknown chunk
|
||||
unknowns[i].size - size of unknown chunk's data
|
||||
unknowns[i].location - position of chunk in file
|
||||
|
||||
The value of "i" corresponds to the order in which the chunks were read
|
||||
from the PNG file or inserted with the png_set_unknown_chunks() function.
|
||||
The value of "i" corresponds to the order in which the
|
||||
chunks were read from the PNG file or inserted with the
|
||||
png_set_unknown_chunks() function.
|
||||
|
||||
The data from the pHYs chunk can be retrieved in several convenient
|
||||
forms:
|
||||
|
||||
res_x = png_get_x_pixels_per_meter(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_y = png_get_y_pixels_per_meter(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_x_and_y = png_get_pixels_per_meter(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_x = png_get_x_pixels_per_inch(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_y = png_get_y_pixels_per_inch(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_x_and_y = png_get_pixels_per_inch(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
|
||||
(Each of these returns 0 [signifying "unknown"] if
|
||||
the data is not present or if res_x is 0;
|
||||
@ -1397,8 +1414,8 @@ forms:
|
||||
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
|
||||
|
||||
(Each of these returns 0 [signifying "unknown" if both
|
||||
x and y are 0] if the data is not present or if the chunk
|
||||
is present but the unit is the pixel)
|
||||
x and y are 0] if the data is not present or if the
|
||||
chunk is present but the unit is the pixel)
|
||||
|
||||
For more information, see the png_info definition in png.h and the
|
||||
PNG specification for chunk contents. Be careful with trusting
|
||||
@ -1932,7 +1949,7 @@ When you are done, you can free all memory allocated by libpng like this:
|
||||
It is also possible to individually free the info_ptr members that
|
||||
point to libpng-allocated storage with the following function:
|
||||
|
||||
png_free_data(png_ptr, info_ptr, mask, n)
|
||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||
mask - identifies data to be freed, a mask
|
||||
containing the logical OR of one or
|
||||
more of
|
||||
@ -1942,16 +1959,17 @@ point to libpng-allocated storage with the following function:
|
||||
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||
or simply PNG_FREE_ALL
|
||||
n - sequence number of item to be freed
|
||||
seq - sequence number of item to be freed
|
||||
(-1 for all items)
|
||||
|
||||
This function may be safely called when the relevant storage has
|
||||
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
|
||||
cases do nothing. The "seq" parameter is ignored if only one item
|
||||
of the selected data type, such as PLTE, is allowed. If "seq" 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 in the structure
|
||||
is freed, where n is "seq".
|
||||
|
||||
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,
|
||||
@ -2124,9 +2142,10 @@ png_infop info_ptr;
|
||||
|
||||
/* This function is called when each row of image
|
||||
data is complete */
|
||||
|
||||
void
|
||||
row_callback(png_structp png_ptr, png_bytep new_row,
|
||||
png_uint_32 row_num, int pass)
|
||||
png_uint_32 row_num, int pass)
|
||||
{
|
||||
/* If the image is interlaced, and you turned
|
||||
on the interlace handler, this function will
|
||||
@ -2270,7 +2289,8 @@ called after each row has been written, which you can use to control
|
||||
a progress meter or the like. It's demonstrated in pngtest.c.
|
||||
You must supply a function
|
||||
|
||||
void write_row_callback(png_ptr, png_uint_32 row, int pass);
|
||||
void write_row_callback(png_ptr, png_uint_32 row,
|
||||
int pass);
|
||||
{
|
||||
/* put your code here */
|
||||
}
|
||||
@ -2298,8 +2318,9 @@ types.
|
||||
|
||||
|
||||
/* turn on or off filtering, and/or choose
|
||||
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
|
||||
or the logical OR of one or more PNG_FILTER_NAME masks. */
|
||||
specific filters. You can use either a single
|
||||
PNG_FILTER_VALUE_NAME 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 |
|
||||
@ -2435,11 +2456,12 @@ Some of the more important parts of the png_info are:
|
||||
png_set_iCCP(png_ptr, info_ptr, name, compression_type,
|
||||
profile, proflen);
|
||||
name - The profile name.
|
||||
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
|
||||
for PNG 1.0. You may give NULL to this argument
|
||||
to ignore it.
|
||||
profile - International Color Consortium color profile
|
||||
data. May contain NULs.
|
||||
compression - The compression type; always
|
||||
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
||||
You may give NULL to this argument to
|
||||
ignore it.
|
||||
profile - International Color Consortium color
|
||||
profile data. May contain NULs.
|
||||
proflen - length of profile data in bytes.
|
||||
|
||||
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
||||
@ -2493,11 +2515,13 @@ Some of the more important parts of the png_info are:
|
||||
or empty for unknown).
|
||||
num_text - number of comments
|
||||
|
||||
png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes);
|
||||
palette_ptr - array of png_sPLT_struct structures to be
|
||||
added to the list of palettes in the info
|
||||
structure.
|
||||
num_spalettes - number of palette structures to be added.
|
||||
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
|
||||
num_spalettes);
|
||||
palette_ptr - array of png_sPLT_struct structures
|
||||
to be added to the list of palettes
|
||||
in the info structure.
|
||||
num_spalettes - number of palette structures to be
|
||||
added.
|
||||
|
||||
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
|
||||
unit_type);
|
||||
@ -2528,9 +2552,10 @@ Some of the more important parts of the png_info are:
|
||||
height - height of a pixel in physical scale units
|
||||
(width and height are strings like "2.54")
|
||||
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns)
|
||||
unknowns - array of png_unknown_chunk structures holding
|
||||
unknown chunks
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns,
|
||||
num_unknowns)
|
||||
unknowns - array of png_unknown_chunk
|
||||
structures holding unknown chunks
|
||||
unknowns[i].name - name of unknown chunk
|
||||
unknowns[i].data - data of unknown chunk
|
||||
unknowns[i].size - size of unknown chunk's data
|
||||
@ -2539,14 +2564,15 @@ Some of the more important parts of the png_info are:
|
||||
PNG_HAVE_IHDR: before PLTE
|
||||
PNG_HAVE_PLTE: before IDAT
|
||||
PNG_AFTER_IDAT: after IDAT
|
||||
The "location" member is set automatically according to
|
||||
what part of the output file has already been written.
|
||||
You can change its value after calling png_set_unknown_chunks()
|
||||
as demonstrated in pngtest.c. Within each of the "locations",
|
||||
the chunks are sequenced according to their position in the
|
||||
structure (that is, the value of "i", which is the order in which
|
||||
the chunk was either read from the input file or defined with
|
||||
png_set_unknown_chunks).
|
||||
|
||||
The "location" member is set automatically according to
|
||||
what part of the output file has already been written.
|
||||
You can change its value after calling png_set_unknown_chunks()
|
||||
as demonstrated in pngtest.c. Within each of the "locations",
|
||||
the chunks are sequenced according to their position in the
|
||||
structure (that is, the value of "i", which is the order in which
|
||||
the chunk was either read from the input file or defined with
|
||||
png_set_unknown_chunks).
|
||||
|
||||
A quick word about text and num_text. text is an array of png_text
|
||||
structures. num_text is the number of valid structures in the array.
|
||||
@ -2647,12 +2673,17 @@ transformations are permitted, enabled by the following masks.
|
||||
|
||||
PNG_TRANSFORM_IDENTITY No transformation
|
||||
PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples
|
||||
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
|
||||
PNG_TRANSFORM_PACKSWAP Change order of packed
|
||||
pixels to LSB first
|
||||
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
|
||||
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
|
||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
|
||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
|
||||
PNG_TRANSFORM_SHIFT Normalize pixels to the
|
||||
sBIT depth
|
||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
|
||||
to BGRA
|
||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA
|
||||
to AG
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
||||
to transparency
|
||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
|
||||
|
||||
@ -2916,7 +2947,7 @@ When you are done, you can free all memory used by libpng like this:
|
||||
It is also possible to individually free the info_ptr members that
|
||||
point to libpng-allocated storage with the following function:
|
||||
|
||||
png_free_data(png_ptr, info_ptr, mask, n)
|
||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||
mask - identifies data to be freed, a mask
|
||||
containing the logical OR of one or
|
||||
more of
|
||||
@ -2926,16 +2957,17 @@ point to libpng-allocated storage with the following function:
|
||||
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||
or simply PNG_FREE_ALL
|
||||
n - sequence number of item to be freed
|
||||
seq - sequence number of item to be freed
|
||||
(-1 for all items)
|
||||
|
||||
This function may be safely called when the relevant storage has
|
||||
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
|
||||
cases do nothing. The "seq" parameter is ignored if only one item
|
||||
of the selected data type, such as PLTE, is allowed. If "seq" 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 in the structure
|
||||
is freed, where n is "seq".
|
||||
|
||||
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
|
||||
@ -3016,8 +3048,8 @@ memory allocation on a platform will change between applications, these
|
||||
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)
|
||||
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
|
||||
|
||||
@ -3025,7 +3057,8 @@ This function also provides a void pointer that can be retrieved via
|
||||
|
||||
Your replacement memory functions must have prototypes as follows:
|
||||
|
||||
png_voidp malloc_fn(png_structp png_ptr, png_uint_32 size);
|
||||
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(),
|
||||
@ -3237,10 +3270,12 @@ structures appropriately for all of the filter types.
|
||||
|
||||
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
|
||||
filters);
|
||||
The second parameter can also be PNG_INTRAPIXEL_DIFFERENCING
|
||||
if you are writing a PNG to be embedded in a MNG
|
||||
datastream. This parameter must be the same as the
|
||||
value of filter_method used in png_set_IHDR().
|
||||
The second parameter can also be
|
||||
PNG_INTRAPIXEL_DIFFERENCING if you are
|
||||
writing a PNG to be embedded in a MNG
|
||||
datastream. This parameter must be the
|
||||
same as the value of filter_method used
|
||||
in png_set_IHDR().
|
||||
|
||||
It is also possible to influence how libpng chooses from among the
|
||||
available filters. This is done in two ways - by telling it how
|
||||
@ -3429,13 +3464,13 @@ application:
|
||||
|
||||
.SH VIII. Y2K Compliance in libpng
|
||||
|
||||
January 31, 2001
|
||||
March 14, 2001
|
||||
|
||||
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.9 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.10beta1 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
|
||||
@ -3453,7 +3488,8 @@ There are seven time-related functions:
|
||||
|
||||
png_convert_to_rfc_1123() in png.c
|
||||
(formerly png_convert_to_rfc_1152() in error)
|
||||
png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
|
||||
png_convert_from_struct_tm() in pngwrite.c, called
|
||||
in pngwrite.c
|
||||
png_convert_from_time_t() in pngwrite.c
|
||||
png_get_tIME() in pngget.c
|
||||
png_handle_tIME() in pngrutil.c, called in pngread.c
|
||||
@ -3492,43 +3528,63 @@ on the library has not always been consistent and straightforward.
|
||||
The following table summarizes matters since version 0.89c, which was
|
||||
the first widely used release:
|
||||
|
||||
source png.h png.h shared-lib
|
||||
version string int version
|
||||
------- ------ ----- ----------
|
||||
0.89c ("1.0 beta 3") 0.89 89 1.0.89
|
||||
0.90 ("1.0 beta 4") 0.90 90 0.90 [should have been 2.0.90]
|
||||
0.95 ("1.0 beta 5") 0.95 95 0.95 [should have been 2.0.95]
|
||||
0.96 ("1.0 beta 6") 0.96 96 0.96 [should have been 2.0.96]
|
||||
0.97b ("1.00.97 beta 7") 1.00.97 97 1.0.1 [should have been 2.0.97]
|
||||
0.97c 0.97 97 2.0.97
|
||||
0.98 0.98 98 2.0.98
|
||||
0.99 0.99 98 2.0.99
|
||||
0.99a-m 0.99 99 2.0.99
|
||||
1.00 1.00 100 2.1.0 [100 should be 10000]
|
||||
1.0.0 1.0.0 100 2.1.0 [100 should be 10000]
|
||||
1.0.1 1.0.1 10001 2.1.0
|
||||
1.0.1a-e 1.0.1a-e 10002 2.1.0.1a-e
|
||||
1.0.2 1.0.2 10002 2.1.0.2
|
||||
1.0.2a-b 1.0.2a-b 10003 2.1.0.2a-b
|
||||
1.0.3 1.0.3 10003 2.1.0.3
|
||||
1.0.3a-d 1.0.3a-d 10004 2.1.0.3a-d
|
||||
1.0.4 1.0.4 10004 2.1.0.4
|
||||
1.0.4a-f 1.0.4a-f 10005 2.1.0.4a-f
|
||||
1.0.5 (+ 2 patches) 1.0.5 10005 2.1.0.5
|
||||
1.0.5a-d 1.0.5a-d 10006 2.1.0.5a-d
|
||||
1.0.5e-r 1.0.5e-r 10100 2.1.0.5e-r (not compatible)
|
||||
1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-v (compatible)
|
||||
1.0.6 (+ 3 patches) 1.0.6 10006 2.1.0.6
|
||||
1.0.6d 1.0.6d 10007 2.1.0.6d
|
||||
1.0.7 1.0.7 10007 2.1.0.7 (still compatible)
|
||||
source png.h png.h shared-lib
|
||||
version string int version
|
||||
------- ------ ----- ----------
|
||||
0.89c ("beta 3") 0.89 89 1.0.89
|
||||
0.90 ("beta 4") 0.90 90 0.90
|
||||
0.95 ("beta 5") 0.95 95 0.95
|
||||
0.96 ("beta 6") 0.96 96 0.96
|
||||
0.97b ("beta 7") 1.00.97 97 1.0.1
|
||||
0.97c 0.97 97 2.0.97
|
||||
0.98 0.98 98 2.0.98
|
||||
0.99 0.99 98 2.0.99
|
||||
0.99a-m 0.99 99 2.0.99
|
||||
1.00 1.00 100 2.1.0
|
||||
1.0.0 1.0.0 100 2.1.0
|
||||
1.0.0 (from here on, the 100 2.1.0
|
||||
1.0.1 png.h string is 10001 2.1.0
|
||||
1.0.1a-e identical to the 10002 from here on, the
|
||||
1.0.2 source version) 10002 shared library is 2.V
|
||||
1.0.2a-b 10003 where V is the source
|
||||
1.0.1 10001 code version except as
|
||||
1.0.1a-e 10002 2.1.0.1a-e noted.
|
||||
1.0.2 10002 2.1.0.2
|
||||
1.0.2a-b 10003 2.1.0.2a-b
|
||||
1.0.3 10003 2.1.0.3
|
||||
1.0.3a-d 10004 2.1.0.3a-d
|
||||
1.0.4 10004 2.1.0.4
|
||||
1.0.4a-f 10005 2.1.0.4a-f
|
||||
1.0.5 (+ 2 patches) 10005 2.1.0.5
|
||||
1.0.5a-d 10006 2.1.0.5a-d
|
||||
1.0.5e-r 10100 2.1.0.5e-r
|
||||
1.0.5s-v 10006 2.1.0.5s-v
|
||||
1.0.6 (+ 3 patches) 10006 2.1.0.6
|
||||
1.0.6d-g 10007 2.1.0.6d-g
|
||||
1.0.6h 10007 10.6h
|
||||
1.0.6i 10007 10.6i
|
||||
1.0.6j 10007 2.1.0.6j
|
||||
1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14
|
||||
1.0.7beta15-18 1 10007 2.1.0.7beta15-18
|
||||
1.0.7rc1-2 1 10007 2.1.0.7rc1-2
|
||||
1.0.7 1 10007 2.1.0.7
|
||||
1.0.8beta1-4 1 10008 2.1.0.8beta1-4
|
||||
1.0.8rc1 1 10008 2.1.0.8rc1
|
||||
1.0.8 1 10008 2.1.0.8
|
||||
1.0.9beta1-6 1 10009 2.1.0.9beta1-6
|
||||
1.0.9rc1 1 10009 2.1.0.9rc1
|
||||
1.0.9beta7-10 1 10009 2.1.0.9beta7-10
|
||||
1.0.9rc2 1 10009 2.1.0.9rc2
|
||||
1.0.9 1 10009 2.1.0.9
|
||||
1.0.10rc1 1 10010 2.1.0.10rc1
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
used for changes in backward compatibility, as it is intended. The
|
||||
PNG_PNGLIB_VER macro, which is not used within libpng but is available
|
||||
for applications, is an unsigned integer of the form xyyzz corresponding
|
||||
to the source version x.y.z (leading zeros in y and z). Beta versions
|
||||
are given the previous public release number plus a letter or two.
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
used for changes in backward compatibility, as it is intended. The
|
||||
PNG_PNGLIB_VER macro, which is not used within libpng but is available
|
||||
for applications, is an unsigned integer of the form xyyzz corresponding
|
||||
to the source version x.y.z (leading zeros in y and z). Beta versions
|
||||
are given the previous public release number plus a letter or two.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
libpngpf(3), png(5)
|
||||
@ -3576,7 +3632,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.0.9 - January 31, 2001:
|
||||
Libpng version 1.0.10beta1 - March 14, 2001:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
|
||||
|
||||
@ -3593,8 +3649,8 @@ included in the libpng distribution, the latter shall prevail.)
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.9, January 31, 2001, are
|
||||
Copyright (c) 2000 Glenn Randers-Pehrson, and are
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.10beta1, March 14, 2001, are
|
||||
Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
|
||||
@ -3604,12 +3660,13 @@ with the following individuals added to the list of Contributing Authors
|
||||
|
||||
and with the following additions to the disclaimer:
|
||||
|
||||
There is no warranty against interference with your enjoyment of the
|
||||
library or against infringement. There is no warranty that our
|
||||
efforts or the library will fulfill any of your particular purposes
|
||||
or needs. This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||
the user.
|
||||
There is no warranty against interference with your
|
||||
enjoyment of the library or against infringement.
|
||||
There is no warranty that our efforts or the library
|
||||
will fulfill any of your particular purposes or needs.
|
||||
This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and
|
||||
effort is with the user.
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
|
||||
@ -3658,11 +3715,11 @@ to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
2. Altered versions must be plainly marked as such and
|
||||
must not be misrepresented as being the original source.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
3. This Copyright notice may not be removed or altered from
|
||||
any source or altered source distribution.
|
||||
|
||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
fee, and encourage the use of this source code as a component to
|
||||
@ -3684,7 +3741,7 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
randeg@alum.rpi.edu
|
||||
January 31, 2001
|
||||
March 14, 2001
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
236
libpng.txt
236
libpng.txt
@ -1,6 +1,6 @@
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.0.9 - January 31, 2001
|
||||
libpng version 1.0.10beta1 - March 14, 2001
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@ -257,10 +257,11 @@ input stream. You must supply the function
|
||||
png_byte name[5];
|
||||
png_byte *data;
|
||||
png_size_t size;
|
||||
/* Note that libpng has already taken care of the
|
||||
CRC handling */
|
||||
/* Note that libpng has already taken care of
|
||||
the CRC handling */
|
||||
|
||||
/* put your code here. Return one of the following: */
|
||||
/* put your code here. Return one of the
|
||||
following: */
|
||||
|
||||
return (-n); /* chunk had an error */
|
||||
return (0); /* did not recognize */
|
||||
@ -331,16 +332,23 @@ the entire image into memory, and (b) the input transformations
|
||||
you want to do are limited to the following set:
|
||||
|
||||
PNG_TRANSFORM_IDENTITY No transformation
|
||||
PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to 8 bits
|
||||
PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to
|
||||
8 bits
|
||||
PNG_TRANSFORM_STRIP_ALPHA Discard the alpha channel
|
||||
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit samples to bytes
|
||||
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
|
||||
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit
|
||||
samples to bytes
|
||||
PNG_TRANSFORM_PACKSWAP Change order of packed
|
||||
pixels to LSB first
|
||||
PNG_TRANSFORM_EXPAND Perform set_expand()
|
||||
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
|
||||
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
|
||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
|
||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
|
||||
PNG_TRANSFORM_SHIFT Normalize pixels to the
|
||||
sBIT depth
|
||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
|
||||
to BGRA
|
||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA
|
||||
to AG
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
||||
to transparency
|
||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||
|
||||
(This excludes setting a background color, doing gamma transformation,
|
||||
@ -368,9 +376,11 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
||||
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));
|
||||
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);
|
||||
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
|
||||
@ -438,8 +448,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_method can be NULL if you are
|
||||
not interested in their values.
|
||||
filter_method 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
|
||||
@ -502,14 +512,15 @@ into the info_ptr is returned for any complex types.
|
||||
implies specific values of gAMA and
|
||||
cHRM.
|
||||
|
||||
png_get_iCCP(png_ptr, info_ptr, &name, &compression_type,
|
||||
&profile, &proflen);
|
||||
png_get_iCCP(png_ptr, info_ptr, &name,
|
||||
&compression_type, &profile, &proflen);
|
||||
name - The profile name.
|
||||
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
|
||||
for PNG 1.0. You may give NULL to this argument
|
||||
to ignore it.
|
||||
profile - International Color Consortium color profile
|
||||
data. May contain NULs.
|
||||
compression - The compression type; always
|
||||
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
||||
You may give NULL to this argument to
|
||||
ignore it.
|
||||
profile - International Color Consortium color
|
||||
profile data. May contain NULs.
|
||||
proflen - length of profile data in bytes.
|
||||
|
||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
@ -565,21 +576,24 @@ into the info_ptr is returned for any complex types.
|
||||
string for unknown).
|
||||
text_ptr[i].translated_keyword - keyword in UTF-8
|
||||
(empty string for unknown).
|
||||
num_text - number of comments (same as num_comments;
|
||||
you can put NULL here to avoid the duplication)
|
||||
Note while png_set_text() will accept text, language, and
|
||||
translated keywords that can be NULL pointers, the structure
|
||||
returned by png_get_text will always contain regular
|
||||
zero-terminated C strings. They might be empty strings but
|
||||
they will never be NULL pointers.
|
||||
num_text - number of comments (same as
|
||||
num_comments; you can put NULL here
|
||||
to avoid the duplication)
|
||||
Note while png_set_text() will accept text, language,
|
||||
and translated keywords that can be NULL pointers, the
|
||||
structure returned by png_get_text will always contain
|
||||
regular zero-terminated C strings. They might be
|
||||
empty strings but they will never be NULL pointers.
|
||||
|
||||
num_spalettes = png_get_sPLT(png_ptr, info_ptr, &palette_ptr);
|
||||
num_spalettes = png_get_sPLT(png_ptr, info_ptr,
|
||||
&palette_ptr);
|
||||
palette_ptr - array of palette structures holding
|
||||
contents of one or more sPLT chunks read.
|
||||
contents of one or more sPLT chunks
|
||||
read.
|
||||
num_spalettes - number of sPLT chunks read.
|
||||
|
||||
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
|
||||
&unit_type);
|
||||
&unit_type);
|
||||
offset_x - positive offset from the left edge
|
||||
of the screen
|
||||
offset_y - positive offset from the top edge
|
||||
@ -587,7 +601,7 @@ into the info_ptr is returned for any complex types.
|
||||
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
|
||||
|
||||
png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y,
|
||||
&unit_type);
|
||||
&unit_type);
|
||||
res_x - pixels/unit physical resolution in
|
||||
x direction
|
||||
res_y - pixels/unit physical resolution in
|
||||
@ -595,47 +609,50 @@ into the info_ptr is returned for any complex types.
|
||||
unit_type - PNG_RESOLUTION_UNKNOWN,
|
||||
PNG_RESOLUTION_METER
|
||||
|
||||
png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height)
|
||||
png_get_sCAL(png_ptr, info_ptr, &unit, &width,
|
||||
&height)
|
||||
unit - physical scale units (an integer)
|
||||
width - width of a pixel in physical scale units
|
||||
height - height of a pixel in physical scale units
|
||||
(width and height are doubles)
|
||||
|
||||
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, &height)
|
||||
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width,
|
||||
&height)
|
||||
unit - physical scale units (an integer)
|
||||
width - width of a pixel in physical scale units
|
||||
height - height of a pixel in physical scale units
|
||||
(width and height are strings like "2.54")
|
||||
|
||||
num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr,
|
||||
&unknowns)
|
||||
unknowns - array of png_unknown_chunk structures holding
|
||||
unknown chunks
|
||||
num_unknown_chunks = png_get_unknown_chunks(png_ptr,
|
||||
info_ptr, &unknowns)
|
||||
unknowns - array of png_unknown_chunk
|
||||
structures holding unknown chunks
|
||||
unknowns[i].name - name of unknown chunk
|
||||
unknowns[i].data - data of unknown chunk
|
||||
unknowns[i].size - size of unknown chunk's data
|
||||
unknowns[i].location - position of chunk in file
|
||||
|
||||
The value of "i" corresponds to the order in which the chunks were read
|
||||
from the PNG file or inserted with the png_set_unknown_chunks() function.
|
||||
The value of "i" corresponds to the order in which the
|
||||
chunks were read from the PNG file or inserted with the
|
||||
png_set_unknown_chunks() function.
|
||||
|
||||
The data from the pHYs chunk can be retrieved in several convenient
|
||||
forms:
|
||||
|
||||
res_x = png_get_x_pixels_per_meter(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_y = png_get_y_pixels_per_meter(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_x_and_y = png_get_pixels_per_meter(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_x = png_get_x_pixels_per_inch(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_y = png_get_y_pixels_per_inch(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
res_x_and_y = png_get_pixels_per_inch(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
|
||||
info_ptr)
|
||||
info_ptr)
|
||||
|
||||
(Each of these returns 0 [signifying "unknown"] if
|
||||
the data is not present or if res_x is 0;
|
||||
@ -650,8 +667,8 @@ forms:
|
||||
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
|
||||
|
||||
(Each of these returns 0 [signifying "unknown" if both
|
||||
x and y are 0] if the data is not present or if the chunk
|
||||
is present but the unit is the pixel)
|
||||
x and y are 0] if the data is not present or if the
|
||||
chunk is present but the unit is the pixel)
|
||||
|
||||
For more information, see the png_info definition in png.h and the
|
||||
PNG specification for chunk contents. Be careful with trusting
|
||||
@ -1185,7 +1202,7 @@ When you are done, you can free all memory allocated by libpng like this:
|
||||
It is also possible to individually free the info_ptr members that
|
||||
point to libpng-allocated storage with the following function:
|
||||
|
||||
png_free_data(png_ptr, info_ptr, mask, n)
|
||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||
mask - identifies data to be freed, a mask
|
||||
containing the logical OR of one or
|
||||
more of
|
||||
@ -1195,16 +1212,17 @@ point to libpng-allocated storage with the following function:
|
||||
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||
or simply PNG_FREE_ALL
|
||||
n - sequence number of item to be freed
|
||||
seq - sequence number of item to be freed
|
||||
(-1 for all items)
|
||||
|
||||
This function may be safely called when the relevant storage has
|
||||
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
|
||||
cases do nothing. The "seq" parameter is ignored if only one item
|
||||
of the selected data type, such as PLTE, is allowed. If "seq" 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 in the structure
|
||||
is freed, where n is "seq".
|
||||
|
||||
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,
|
||||
@ -1377,9 +1395,10 @@ png_infop info_ptr;
|
||||
|
||||
/* This function is called when each row of image
|
||||
data is complete */
|
||||
|
||||
void
|
||||
row_callback(png_structp png_ptr, png_bytep new_row,
|
||||
png_uint_32 row_num, int pass)
|
||||
png_uint_32 row_num, int pass)
|
||||
{
|
||||
/* If the image is interlaced, and you turned
|
||||
on the interlace handler, this function will
|
||||
@ -1523,7 +1542,8 @@ called after each row has been written, which you can use to control
|
||||
a progress meter or the like. It's demonstrated in pngtest.c.
|
||||
You must supply a function
|
||||
|
||||
void write_row_callback(png_ptr, png_uint_32 row, int pass);
|
||||
void write_row_callback(png_ptr, png_uint_32 row,
|
||||
int pass);
|
||||
{
|
||||
/* put your code here */
|
||||
}
|
||||
@ -1551,8 +1571,9 @@ types.
|
||||
|
||||
|
||||
/* turn on or off filtering, and/or choose
|
||||
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
|
||||
or the logical OR of one or more PNG_FILTER_NAME masks. */
|
||||
specific filters. You can use either a single
|
||||
PNG_FILTER_VALUE_NAME 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 |
|
||||
@ -1688,11 +1709,12 @@ Some of the more important parts of the png_info are:
|
||||
png_set_iCCP(png_ptr, info_ptr, name, compression_type,
|
||||
profile, proflen);
|
||||
name - The profile name.
|
||||
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
|
||||
for PNG 1.0. You may give NULL to this argument
|
||||
to ignore it.
|
||||
profile - International Color Consortium color profile
|
||||
data. May contain NULs.
|
||||
compression - The compression type; always
|
||||
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
||||
You may give NULL to this argument to
|
||||
ignore it.
|
||||
profile - International Color Consortium color
|
||||
profile data. May contain NULs.
|
||||
proflen - length of profile data in bytes.
|
||||
|
||||
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
||||
@ -1746,11 +1768,13 @@ Some of the more important parts of the png_info are:
|
||||
or empty for unknown).
|
||||
num_text - number of comments
|
||||
|
||||
png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes);
|
||||
palette_ptr - array of png_sPLT_struct structures to be
|
||||
added to the list of palettes in the info
|
||||
structure.
|
||||
num_spalettes - number of palette structures to be added.
|
||||
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
|
||||
num_spalettes);
|
||||
palette_ptr - array of png_sPLT_struct structures
|
||||
to be added to the list of palettes
|
||||
in the info structure.
|
||||
num_spalettes - number of palette structures to be
|
||||
added.
|
||||
|
||||
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
|
||||
unit_type);
|
||||
@ -1781,9 +1805,10 @@ Some of the more important parts of the png_info are:
|
||||
height - height of a pixel in physical scale units
|
||||
(width and height are strings like "2.54")
|
||||
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns)
|
||||
unknowns - array of png_unknown_chunk structures holding
|
||||
unknown chunks
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns,
|
||||
num_unknowns)
|
||||
unknowns - array of png_unknown_chunk
|
||||
structures holding unknown chunks
|
||||
unknowns[i].name - name of unknown chunk
|
||||
unknowns[i].data - data of unknown chunk
|
||||
unknowns[i].size - size of unknown chunk's data
|
||||
@ -1792,14 +1817,15 @@ Some of the more important parts of the png_info are:
|
||||
PNG_HAVE_IHDR: before PLTE
|
||||
PNG_HAVE_PLTE: before IDAT
|
||||
PNG_AFTER_IDAT: after IDAT
|
||||
The "location" member is set automatically according to
|
||||
what part of the output file has already been written.
|
||||
You can change its value after calling png_set_unknown_chunks()
|
||||
as demonstrated in pngtest.c. Within each of the "locations",
|
||||
the chunks are sequenced according to their position in the
|
||||
structure (that is, the value of "i", which is the order in which
|
||||
the chunk was either read from the input file or defined with
|
||||
png_set_unknown_chunks).
|
||||
|
||||
The "location" member is set automatically according to
|
||||
what part of the output file has already been written.
|
||||
You can change its value after calling png_set_unknown_chunks()
|
||||
as demonstrated in pngtest.c. Within each of the "locations",
|
||||
the chunks are sequenced according to their position in the
|
||||
structure (that is, the value of "i", which is the order in which
|
||||
the chunk was either read from the input file or defined with
|
||||
png_set_unknown_chunks).
|
||||
|
||||
A quick word about text and num_text. text is an array of png_text
|
||||
structures. num_text is the number of valid structures in the array.
|
||||
@ -1900,12 +1926,17 @@ transformations are permitted, enabled by the following masks.
|
||||
|
||||
PNG_TRANSFORM_IDENTITY No transformation
|
||||
PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples
|
||||
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
|
||||
PNG_TRANSFORM_PACKSWAP Change order of packed
|
||||
pixels to LSB first
|
||||
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
|
||||
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
|
||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
|
||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
|
||||
PNG_TRANSFORM_SHIFT Normalize pixels to the
|
||||
sBIT depth
|
||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
|
||||
to BGRA
|
||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA
|
||||
to AG
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
||||
to transparency
|
||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
|
||||
|
||||
@ -2169,7 +2200,7 @@ When you are done, you can free all memory used by libpng like this:
|
||||
It is also possible to individually free the info_ptr members that
|
||||
point to libpng-allocated storage with the following function:
|
||||
|
||||
png_free_data(png_ptr, info_ptr, mask, n)
|
||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||
mask - identifies data to be freed, a mask
|
||||
containing the logical OR of one or
|
||||
more of
|
||||
@ -2179,16 +2210,17 @@ point to libpng-allocated storage with the following function:
|
||||
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||
or simply PNG_FREE_ALL
|
||||
n - sequence number of item to be freed
|
||||
seq - sequence number of item to be freed
|
||||
(-1 for all items)
|
||||
|
||||
This function may be safely called when the relevant storage has
|
||||
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
|
||||
cases do nothing. The "seq" parameter is ignored if only one item
|
||||
of the selected data type, such as PLTE, is allowed. If "seq" 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 in the structure
|
||||
is freed, where n is "seq".
|
||||
|
||||
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
|
||||
@ -2269,8 +2301,8 @@ memory allocation on a platform will change between applications, these
|
||||
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)
|
||||
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
|
||||
|
||||
@ -2278,7 +2310,8 @@ This function also provides a void pointer that can be retrieved via
|
||||
|
||||
Your replacement memory functions must have prototypes as follows:
|
||||
|
||||
png_voidp malloc_fn(png_structp png_ptr, png_uint_32 size);
|
||||
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(),
|
||||
@ -2490,10 +2523,12 @@ structures appropriately for all of the filter types.
|
||||
|
||||
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
|
||||
filters);
|
||||
The second parameter can also be PNG_INTRAPIXEL_DIFFERENCING
|
||||
if you are writing a PNG to be embedded in a MNG
|
||||
datastream. This parameter must be the same as the
|
||||
value of filter_method used in png_set_IHDR().
|
||||
The second parameter can also be
|
||||
PNG_INTRAPIXEL_DIFFERENCING if you are
|
||||
writing a PNG to be embedded in a MNG
|
||||
datastream. This parameter must be the
|
||||
same as the value of filter_method used
|
||||
in png_set_IHDR().
|
||||
|
||||
It is also possible to influence how libpng chooses from among the
|
||||
available filters. This is done in two ways - by telling it how
|
||||
@ -2682,13 +2717,13 @@ application:
|
||||
|
||||
VIII. Y2K Compliance in libpng
|
||||
|
||||
January 31, 2001
|
||||
March 14, 2001
|
||||
|
||||
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.9 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.10beta1 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
|
||||
@ -2706,7 +2741,8 @@ There are seven time-related functions:
|
||||
|
||||
png_convert_to_rfc_1123() in png.c
|
||||
(formerly png_convert_to_rfc_1152() in error)
|
||||
png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
|
||||
png_convert_from_struct_tm() in pngwrite.c, called
|
||||
in pngwrite.c
|
||||
png_convert_from_time_t() in pngwrite.c
|
||||
png_get_tIME() in pngget.c
|
||||
png_handle_tIME() in pngrutil.c, called in pngread.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "January 31, 2001"
|
||||
.TH LIBPNGPF 3 "March 14, 2001"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.10beta1
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include <png.h>\fP
|
||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "January 31, 2001"
|
||||
.TH PNG 5 "March 14, 2001"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
14
png.c
14
png.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* libpng version 1.0.9 - January 31, 2001
|
||||
* libpng version 1.0.10beta1 - March 14, 2001
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -13,14 +13,14 @@
|
||||
#include "png.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_0_9 Your_png_h_is_not_version_1_0_9;
|
||||
typedef version_1_0_10beta1 Your_png_h_is_not_version_1_0_10beta1;
|
||||
|
||||
/* 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 */
|
||||
const char png_libpng_ver[18] = "1.0.9";
|
||||
const char png_libpng_ver[18] = "1.0.10beta1";
|
||||
|
||||