mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 23:42:15 +08:00
Updated the bundled libpng to v1.5.1 (released Feb 3, 2011).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8523 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -21,8 +21,9 @@ CHANGES IN FLTK 1.3.0
|
|||||||
to avoid overriding Fl_Widget::position(int,int) (STR #1303)
|
to avoid overriding Fl_Widget::position(int,int) (STR #1303)
|
||||||
- Although FLTK 1.3 maintains source code compatibility as good
|
- Although FLTK 1.3 maintains source code compatibility as good
|
||||||
as possible, the binary interface changed considerably.
|
as possible, the binary interface changed considerably.
|
||||||
- Updated the bundled libpng to v1.2.40 (released Sep. 10, 2009)
|
- Updated the bundled libpng to v1.5.1 (released Feb 3, 2011)
|
||||||
- Update lib png access (STR #2442)
|
- Updated the bundled libjpeg to v8c (released Jan 16, 2011)
|
||||||
|
- Updated the bundled zlib to v1.2.5 (released Apr 19, 2010)
|
||||||
|
|
||||||
API enhancements and changes
|
API enhancements and changes
|
||||||
|
|
||||||
|
|||||||
+71
-32
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.2.40 - September 10, 2009
|
Libpng 1.5.1 - February 3, 2011
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
@@ -8,46 +8,85 @@ Files available for download:
|
|||||||
Source files with LF line endings (for Unix/Linux) and with a
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
libpng-1.2.40.tar.xz (LZMA-compressed, recommended)
|
libpng-1.5.1.tar.xz (LZMA-compressed, recommended)
|
||||||
libpng-1.2.40.tar.gz
|
libpng-1.5.1.tar.gz
|
||||||
libpng-1.2.40.tar.bz2
|
libpng-1.5.1.tar.bz2
|
||||||
|
|
||||||
Source files with LF line endings (for Unix/Linux) without the
|
|
||||||
"configure" script
|
|
||||||
|
|
||||||
libpng-1.2.40-no-config.tar.xz (LZMA-compressed, recommended)
|
|
||||||
libpng-1.2.40-no-config.tar.gz
|
|
||||||
libpng-1.2.40-no-config.tar.bz2
|
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
Source files with CRLF line endings (for Windows), without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
lpng1240.zip
|
lpng151.7z (LZMA-compressed, recommended)
|
||||||
lpng1240.7z
|
lpng151.zip
|
||||||
lpng1240.tar.bz2
|
|
||||||
|
|
||||||
Project files
|
|
||||||
|
|
||||||
libpng-1.2.40-project-netware.zip
|
|
||||||
libpng-1.2.40-project-wince.zip
|
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.2.40-README.txt
|
libpng-1.5.1-README.txt
|
||||||
libpng-1.2.40-KNOWNBUGS.txt
|
libpng-1.5.1-LICENSE.txt
|
||||||
libpng-1.2.40-LICENSE.txt
|
|
||||||
libpng-1.2.40-Y2K-compliance.txt
|
|
||||||
libpng-1.2.40-[previous version]-diff.txt
|
|
||||||
|
|
||||||
Changes since the last public release (1.2.39):
|
Changes since the last public release (1.5.0):
|
||||||
|
|
||||||
version 1.2.40 [September 10, 2009]
|
Added description of png_set_crc_action() to the manual.
|
||||||
|
Added a note in the manual that the type of the iCCP profile was changed
|
||||||
Removed an extra png_debug() recently added to png_write_find_filter().
|
from png_charpp to png_bytepp in png_get_iCCP(). Similarly,
|
||||||
Fixed incorrect #ifdef in pngset.c regarding unknown chunk support.
|
it was changed from png_charpp to png_const_bytepp in png_set_iCCP().
|
||||||
Various bugfixes and improvements to CMakeLists.txt (Philip Lowman)
|
Ensure that png_rgb_to_gray ignores palette mapped images, if libpng
|
||||||
|
internally happens to call it with one.
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Fixed the failure to handle palette mapped images correctly.
|
||||||
|
Fixed a bug in handling of interlaced images (bero at arklinux.org).
|
||||||
|
Updated CMakeLists.txt (Clifford Yapp)
|
||||||
|
Fixed typecasting of some png_debug() statements (Cosmin)
|
||||||
|
Updated documentation of png_set|get_tRNS() (Thomas Klausner).
|
||||||
|
Mentioned in the documentation that applications must #include "zlib.h"
|
||||||
|
if they need access to anything in zlib.h, and that a number of
|
||||||
|
macros such as png_memset() are no longer accessible by applications.
|
||||||
|
Corrected pngvalid gamma test "sample" function to access all of the color
|
||||||
|
samples of each pixel, instead of sampling the red channel three times.
|
||||||
|
Changed variable names index, div, exp, and gamma to char_index, divisor,
|
||||||
|
exp_b10, and gamma_val, respectively, to avoid "shadow" warnings.
|
||||||
|
Prevent png_push_crc_skip() from hanging while reading an unknown chunk
|
||||||
|
or an over-large compressed zTXt chunk with the progressive reader.
|
||||||
|
Eliminated more GCC "shadow" warnings.
|
||||||
|
Revised png_fixed() in png.c to avoid compiler warning about reaching the
|
||||||
|
end without returning anything.
|
||||||
|
In the manual, describe the png_get_IHDR() arguments in the correct order.
|
||||||
|
Added const_png_structp and const_png_infop types, and used them in
|
||||||
|
prototypes for most png_get_*() functions.
|
||||||
|
Added png_get_io_chunk_type() and deprecated png_get_io_chunk_name()
|
||||||
|
Added synopses for the IO_STATE functions and other missing synopses
|
||||||
|
to the manual. Removed the synopses from libpngpf.3 because they
|
||||||
|
were out of date and no longer useful. Better information can be
|
||||||
|
obtained by reading the prototypes and comments in pngpriv.h
|
||||||
|
Attempted to fix cpp on Solaris with S. Studio 12 cc, fix build
|
||||||
|
Added a make macro DFNCPP that is a CPP that will accept the tokens in
|
||||||
|
a .dfn file and adds configure stuff to test for such a CPP. ./configure
|
||||||
|
should fail if one is not available.
|
||||||
|
Corrected const_png_ in png.h to png_const_ to avoid polluting the namespace.
|
||||||
|
Added png_get_current_row_number and png_get_current_pass_number for the
|
||||||
|
benefit of the user transform callback.
|
||||||
|
Added png_process_data_pause and png_process_data_skip for the benefit of
|
||||||
|
progressive readers that need to stop data processing or want to optimize
|
||||||
|
skipping of unread data (e.g. if the reader marks a chunk to be skipped.)
|
||||||
|
Enhanced pngvalid, corrected an error in gray_to_rgb, corrected doc error.
|
||||||
|
pngvalid contains tests of transforms, which tests are currently disabled
|
||||||
|
because they are incompletely tested. gray_to_rgb was failing to expand
|
||||||
|
the bit depth for smaller bit depth images; this seems to be a long
|
||||||
|
standing error and resulted, apparently, in invalid output. The
|
||||||
|
documentation did not accurately describe what libpng really does when
|
||||||
|
converting RGB to gray.
|
||||||
|
Fixed incorrect examples of callback prototypes in the manual, that were
|
||||||
|
introduced in libpng-1.0.0.
|
||||||
|
In addition the order of the png_get_uint macros with respect to the
|
||||||
|
relevant function definitions has been reversed. This helps the
|
||||||
|
preprocessing of the symbol files be more robust. Furthermore, the
|
||||||
|
symbol file preprocessing now uses -DPNG_NO_USE_READ_MACROS even when
|
||||||
|
the library may actually be built with PNG_USE_READ_MACROS; this stops
|
||||||
|
the read macros interfering with the symbol file format.
|
||||||
|
Made the manual, synopses, and function prototypes use the function
|
||||||
|
argument names file_gamma, int_file_gamma, and srgb_intent consistently.
|
||||||
|
Changed PNG_UNUSED from "param=param;" to "(void)param;".
|
||||||
|
Added transform tests to pngvalid and simplified the arguments.
|
||||||
|
Added a request in the manual that applications do not use "png_" or
|
||||||
|
"PNG_" to begin any of their own symbols.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
|||||||
+1719
-945
File diff suppressed because it is too large
Load Diff
+38
-102
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng version 1.2.40 - September 10, 2009
|
Installing libpng
|
||||||
|
|
||||||
On Unix/Linux and similar systems, you can simply type
|
On Unix/Linux and similar systems, you can simply type
|
||||||
|
|
||||||
@@ -13,10 +13,16 @@ If configure does not work on your system and you have a reasonably
|
|||||||
up-to-date set of tools, running ./autogen.sh before running ./configure
|
up-to-date set of tools, running ./autogen.sh before running ./configure
|
||||||
may fix the problem. You can also run the individual commands in
|
may fix the problem. You can also run the individual commands in
|
||||||
autogen.sh with the --force option, if supported by your version of
|
autogen.sh with the --force option, if supported by your version of
|
||||||
the tools. If you run 'libtoolize --force', though, this will replace
|
the tools. To be really sure that you aren't using any of the included
|
||||||
the distributed, patched, version of ltmain.sh with an unpatched version
|
pre-built scripts, you can do this:
|
||||||
and your shared library builds may fail to produce libraries with the
|
|
||||||
correct version numbers.
|
./configure --enable-maintainer-mode
|
||||||
|
make maintainer-clean
|
||||||
|
./autogen.sh
|
||||||
|
./configure [--prefix=/path] [other options]
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
make check
|
||||||
|
|
||||||
Instead, you can use one of the custom-built makefiles in the
|
Instead, you can use one of the custom-built makefiles in the
|
||||||
"scripts" directory
|
"scripts" directory
|
||||||
@@ -25,27 +31,29 @@ Instead, you can use one of the custom-built makefiles in the
|
|||||||
make test
|
make test
|
||||||
make install
|
make install
|
||||||
|
|
||||||
|
The files that are presently available in the scripts directory
|
||||||
|
are listed and described in scripts/README.txt.
|
||||||
|
|
||||||
Or you can use one of the "projects" in the "projects" directory.
|
Or you can use one of the "projects" in the "projects" directory.
|
||||||
|
|
||||||
If you want to use "cmake" (see www.cmake.org), copy CMakeLists.txt
|
|
||||||
from the "scripts" directory to this directory and type
|
|
||||||
|
|
||||||
cmake . [-DPNG_MMX=YES] -DCMAKE_INSTALL_PREFIX=/path
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
Before installing libpng, you must first install zlib, if it
|
Before installing libpng, you must first install zlib, if it
|
||||||
is not already on your system. zlib can usually be found
|
is not already on your system. zlib can usually be found
|
||||||
wherever you got libpng. zlib can be placed in another directory,
|
wherever you got libpng. zlib can be placed in another directory,
|
||||||
at the same level as libpng.
|
at the same level as libpng.
|
||||||
|
|
||||||
|
If you want to use "cmake" (see www.cmake.org), type
|
||||||
|
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=/path
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
If your system already has a preinstalled zlib you will still need
|
If your system already has a preinstalled zlib you will still need
|
||||||
to have access to the zlib.h and zconf.h include files that
|
to have access to the zlib.h and zconf.h include files that
|
||||||
correspond to the version of zlib that's installed.
|
correspond to the version of zlib that's installed.
|
||||||
|
|
||||||
You can rename the directories that you downloaded (they
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-1.2.40" or "lpng109" and "zlib-1.2.1"
|
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
|
||||||
or "zlib121") so that you have directories called "zlib" and "libpng".
|
or "zlib125") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
@@ -55,19 +63,25 @@ Your directory structure should look like this:
|
|||||||
README
|
README
|
||||||
*.h
|
*.h
|
||||||
*.c
|
*.c
|
||||||
|
CMakeLists.txt => "cmake" script
|
||||||
|
configuration files:
|
||||||
|
configure.ac, configure, Makefile.am, Makefile.in,
|
||||||
|
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
||||||
|
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
||||||
|
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
||||||
contrib
|
contrib
|
||||||
gregbook
|
gregbook
|
||||||
|
pngminim
|
||||||
pngminus
|
pngminus
|
||||||
pngsuite
|
pngsuite
|
||||||
visupng
|
visupng
|
||||||
projects
|
projects
|
||||||
beos
|
visualc71
|
||||||
c5builder (Borland)
|
vstudio
|
||||||
visualc6 (msvc)
|
|
||||||
netware.txt
|
|
||||||
wince.txt
|
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
|
*.def (module definition files)
|
||||||
|
etc.
|
||||||
pngtest.png
|
pngtest.png
|
||||||
etc.
|
etc.
|
||||||
zlib
|
zlib
|
||||||
@@ -82,80 +96,13 @@ distribution of libpng. It is available in both tar.gz (UNIX style line
|
|||||||
endings) and zip (DOS style line endings) formats.
|
endings) and zip (DOS style line endings) formats.
|
||||||
|
|
||||||
If you are building libpng with MSVC, you can enter the
|
If you are building libpng with MSVC, you can enter the
|
||||||
libpng projects\visualc6 directory and follow the instructions in
|
libpng projects\visualc6 or visualc71 directory and follow the instructions
|
||||||
projects\visualc6\README.txt.
|
in README.txt.
|
||||||
|
|
||||||
You can build libpng for WindowsCE by downloading and installing
|
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
||||||
the projects\wince directory as instructed in the projects\wince.txt file, and
|
|
||||||
then following the instructions in the README* files. Similarly, you can
|
|
||||||
build libpng for Netware or Beos as instructed in projects\netware.txt
|
|
||||||
or projects\beos.
|
|
||||||
|
|
||||||
Else enter the zlib directory and follow the instructions in zlib/README,
|
|
||||||
then come back here and run "configure" or choose the appropriate
|
then come back here and run "configure" or choose the appropriate
|
||||||
makefile.sys in the scripts directory.
|
makefile.sys in the scripts directory.
|
||||||
|
|
||||||
The files that are presently available in the scripts directory
|
|
||||||
include
|
|
||||||
|
|
||||||
CMakeLists.txt => "cmake" script
|
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
|
||||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
|
||||||
gcc, creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.linux => Linux/ELF makefile
|
|
||||||
(gcc, creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
|
||||||
ansi2knr (Requires ansi2knr.c from
|
|
||||||
ftp://ftp.cs.wisc.edu/ghost)
|
|
||||||
makefile.aix => AIX/gcc makefile
|
|
||||||
makefile.cygwin => Cygwin/gcc makefile
|
|
||||||
makefile.darwin => Darwin makefile, can use on MacosX
|
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
|
||||||
makefile.freebsd => FreeBSD makefile
|
|
||||||
makefile.hpgcc => HPUX makefile using gcc
|
|
||||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
|
||||||
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64-bit
|
|
||||||
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.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
|
|
||||||
makefile.ne12bsd => NetBSD/cc makefile, uses PNGGCCRD,
|
|
||||||
makes libpng12.so
|
|
||||||
makefile.openbsd => OpenBSD makefile
|
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
|
||||||
makefile.sggcc => Silicon Graphics (gcc,
|
|
||||||
creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.sunos => Sun makefile
|
|
||||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
|
||||||
creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
|
|
||||||
creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.so9 => Solaris 9 makefile (gcc,
|
|
||||||
creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
|
||||||
makefile.64sunu => Sun Ultra 64-bit makefile
|
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
|
||||||
makefile.mips => MIPS makefile
|
|
||||||
makefile.acorn => Acorn makefile
|
|
||||||
makefile.amiga => Amiga makefile
|
|
||||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
|
|
||||||
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
|
|
||||||
makefile.atari => Atari makefile
|
|
||||||
makefile.beos => BEOS makefile for X86
|
|
||||||
makefile.bor => Borland makefile (uses bcc)
|
|
||||||
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
|
||||||
makefile.tc3 => Turbo C 3.0 makefile
|
|
||||||
makefile.dj2 => DJGPP 2 makefile
|
|
||||||
makefile.msc => Microsoft C makefile
|
|
||||||
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later
|
|
||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
|
||||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
|
||||||
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
|
||||||
makevms.com => VMS build script
|
|
||||||
descrip.mms => VMS makefile for MMS or MMK
|
|
||||||
SCOPTIONS.ppc => Used with smakefile.ppc
|
|
||||||
|
|
||||||
Copy the file (or files) that you need from the
|
Copy the file (or files) that you need from the
|
||||||
scripts directory into this directory, for example
|
scripts directory into this directory, for example
|
||||||
|
|
||||||
@@ -165,7 +112,7 @@ scripts directory into this directory, for example
|
|||||||
Read the makefile to see if you need to change any source or
|
Read the makefile to see if you need to change any source or
|
||||||
target directories to match your preferences.
|
target directories to match your preferences.
|
||||||
|
|
||||||
Then read pngconf.h to see if you want to make any configuration
|
Then read pnglibconf.dfa to see if you want to make any configuration
|
||||||
changes.
|
changes.
|
||||||
|
|
||||||
Then just run "make" which will create the libpng library in
|
Then just run "make" which will create the libpng library in
|
||||||
@@ -183,17 +130,6 @@ do that, run "make install" in the zlib directory first if necessary).
|
|||||||
Some also allow you to run "make test-installed" after you have
|
Some also allow you to run "make test-installed" after you have
|
||||||
run "make install".
|
run "make install".
|
||||||
|
|
||||||
If you encounter a compiler error message complaining about the
|
Further information can be found in the README and libpng-manual.txt
|
||||||
lines
|
|
||||||
__png.h__ already includes setjmp.h;
|
|
||||||
__dont__ include it again.;
|
|
||||||
This means you have compiled another module that includes setjmp.h,
|
|
||||||
which is hazardous because the two modules might not include exactly
|
|
||||||
the same setjmp.h. If you are sure that you know what you are doing
|
|
||||||
and that they are exactly the same, then you can comment out or
|
|
||||||
delete the two lines. Better yet, use the cexcept interface
|
|
||||||
instead, as demonstrated in contrib/visupng of the libpng distribution.
|
|
||||||
|
|
||||||
Further information can be found in the README and libpng.txt
|
|
||||||
files, in the individual makefiles, in png.h, and the manual pages
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
libpng.3 and png.5.
|
libpng.3 and png.5.
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
Known bugs in libpng version 1.2.40
|
|
||||||
|
|
||||||
1. February 23, 2006: The custom makefiles don't build libpng with -lz.
|
|
||||||
|
|
||||||
STATUS: This is a subject of debate. The change will probably be made
|
|
||||||
as a part of a major overhaul of the makefiles in libpng version 1.4.0.
|
|
||||||
|
|
||||||
2. February 24, 2006: The Makefile generated by the "configure" script
|
|
||||||
fails to install symbolic links
|
|
||||||
libpng12.so => libpng12.so.0.1.2.9betaN
|
|
||||||
that are generated by the custom makefiles.
|
|
||||||
|
|
||||||
3. September 4, 2007: There is a report that pngtest crashes on MacOS 10.
|
|
||||||
|
|
||||||
STATUS: workarounds are
|
|
||||||
1) Compile without optimization (crashes are observed with
|
|
||||||
-arch i386 and -O2 or -O3, using gcc-4.0.1).
|
|
||||||
2) Compile pngtest.c with PNG_DEBUG defined (the bug goes away if
|
|
||||||
you try to look at it).
|
|
||||||
3) Ignore the crash. The library itself seems to be OK.
|
|
||||||
|
|
||||||
+3
-3
@@ -10,8 +10,8 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are
|
libpng versions 1.2.6, August 15, 2004, through 1.5.1, February 3, 2011, are
|
||||||
Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
|
|
||||||
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
September 10, 2009
|
February 3, 2011
|
||||||
|
|||||||
+3
-1
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# PNG library makefile for the Fast Light Toolkit (FLTK).
|
# PNG library makefile for the Fast Light Toolkit (FLTK).
|
||||||
#
|
#
|
||||||
# Copyright 1997-2009 by Easy Software Products.
|
# Copyright 1997-2011 by Easy Software Products.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Library General Public
|
# modify it under the terms of the GNU Library General Public
|
||||||
@@ -67,6 +67,7 @@ install: $(LIBPNG)
|
|||||||
-$(INSTALL_DIR) $(DESTDIR)$(includedir)/FL/images
|
-$(INSTALL_DIR) $(DESTDIR)$(includedir)/FL/images
|
||||||
$(INSTALL_DATA) png.h $(DESTDIR)$(includedir)/FL/images
|
$(INSTALL_DATA) png.h $(DESTDIR)$(includedir)/FL/images
|
||||||
$(INSTALL_DATA) pngconf.h $(DESTDIR)$(includedir)/FL/images
|
$(INSTALL_DATA) pngconf.h $(DESTDIR)$(includedir)/FL/images
|
||||||
|
$(INSTALL_DATA) pnglibconf.h $(DESTDIR)$(includedir)/FL/images
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -79,6 +80,7 @@ uninstall:
|
|||||||
echo "Uninstalling png headers in $(includedir)/FL/images..."
|
echo "Uninstalling png headers in $(includedir)/FL/images..."
|
||||||
$(RM) $(DESTDIR)$(includedir)/FL/images/png.h
|
$(RM) $(DESTDIR)$(includedir)/FL/images/png.h
|
||||||
$(RM) $(DESTDIR)$(includedir)/FL/images/pngconf.h
|
$(RM) $(DESTDIR)$(includedir)/FL/images/pngconf.h
|
||||||
|
$(RM) $(DESTDIR)$(includedir)/FL/images/pnglibconf.h
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
+41
-103
@@ -1,15 +1,11 @@
|
|||||||
README for libpng version 1.2.40 - September 10, 2009 (shared library 12.0)
|
README for libpng version 1.5.1 - February 3, 2011 (shared library 15.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
||||||
libpng-*.tar.lzma, or libpng-*.tar.bz2 if you want UNIX-style line
|
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
||||||
endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style
|
in the text files, or lpng*.zip if you want DOS-style line endings.
|
||||||
line endings. You can get UNIX-style line endings from the *.zip file
|
|
||||||
by using "unzip -a" but there seems to be no simple way to recover
|
|
||||||
UNIX-style line endings from the *.7z file. The *.tar.lzma file is
|
|
||||||
recommended for *NIX users instead.
|
|
||||||
|
|
||||||
Version 0.89 was the first official release of libpng. Don't let the
|
Version 0.89 was the first official release of libpng. Don't let the
|
||||||
fact that it's the first release fool you. The libpng library has been in
|
fact that it's the first release fool you. The libpng library has been in
|
||||||
@@ -58,11 +54,11 @@ to set different actions based on whether the CRC error occurred in a
|
|||||||
critical or an ancillary chunk.
|
critical or an ancillary chunk.
|
||||||
|
|
||||||
The changes made to the library, and bugs fixed are based on discussions
|
The changes made to the library, and bugs fixed are based on discussions
|
||||||
on the png-mng-implement mailing list
|
on the PNG-implement mailing list and not on material submitted
|
||||||
and not on material submitted privately to Guy, Andreas, or Glenn. They will
|
privately to Guy, Andreas, or Glenn. They will forward any good
|
||||||
forward any good suggestions to the list.
|
suggestions to the list.
|
||||||
|
|
||||||
For a detailed description on using libpng, read libpng.txt. For
|
For a detailed description on using libpng, read libpng-manual.txt. For
|
||||||
examples of libpng in a program, see example.c and pngtest.c. For usage
|
examples of libpng in a program, see example.c and pngtest.c. For usage
|
||||||
information and restrictions (what little they are) on libpng, see
|
information and restrictions (what little they are) on libpng, see
|
||||||
png.h. For a description on using zlib (the compression library used by
|
png.h. For a description on using zlib (the compression library used by
|
||||||
@@ -81,12 +77,12 @@ compression library that is useful for more things than just PNG files.
|
|||||||
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||||
you are so inclined.
|
you are so inclined.
|
||||||
|
|
||||||
zlib should be available at the same place that libpng is, or at
|
zlib should be available at the same place that libpng is, or at.
|
||||||
ftp://ftp.simplesystems.org/pub/png/src/
|
ftp://ftp.info-zip.org/pub/infozip/zlib
|
||||||
|
|
||||||
You may also want a copy of the PNG specification. It is available
|
You may also want a copy of the PNG specification. It is available
|
||||||
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||||
these at http://www.libpng.org/pub/png/pngdocs.html
|
these at http://www.libpng.org/pub/png/documents/
|
||||||
|
|
||||||
This code is currently being archived at libpng.sf.net in the
|
This code is currently being archived at libpng.sf.net in the
|
||||||
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
|
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
|
||||||
@@ -105,23 +101,24 @@ Finally, if you get any warning messages when compiling libpng
|
|||||||
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
||||||
|
|
||||||
This release was created and will be supported by myself (of course
|
This release was created and will be supported by myself (of course
|
||||||
based in a large way on Guy's and Andreas' earlier work), and the PNG group.
|
based in a large way on Guy's and Andreas' earlier work), and the PNG
|
||||||
|
development group.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at
|
||||||
(subscription required; visit
|
lists.sourceforge.net (subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe) or to glennrp at users.sourceforge.net
|
to subscribe) or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
You can't reach Guy, the original libpng author, at the addresses
|
You can't reach Guy, the original libpng author, at the addresses
|
||||||
given in previous versions of this document. He and Andreas will read mail
|
given in previous versions of this document. He and Andreas will
|
||||||
addressed to the png-mng-implement list, however.
|
read mail addressed to the png-implement list, however.
|
||||||
|
|
||||||
Please do not send general questions about PNG. Send them to
|
Please do not send general questions about PNG. Send them to
|
||||||
the (png-mng-misc at lists.sourceforge.net, subscription required, visit
|
the (png-list at ccrc.wustl.edu, subscription required, write to
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe)
|
majordomo at ccrc.wustl.edu with "subscribe png-list" in your message).
|
||||||
On the other hand,
|
On the other hand,
|
||||||
please do not send libpng questions to that address, send them to me
|
please do not send libpng questions to that address, send them to me
|
||||||
or to the png-mng-implement list. I'll
|
or to the png-implement list. I'll
|
||||||
get them in the end anyway. If you have a question about something
|
get them in the end anyway. If you have a question about something
|
||||||
in the PNG specification that is related to using libpng, send it
|
in the PNG specification that is related to using libpng, send it
|
||||||
to me. Send me any questions that start with "I was using libpng,
|
to me. Send me any questions that start with "I was using libpng,
|
||||||
@@ -129,7 +126,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
|
|||||||
to others, if necessary.
|
to others, if necessary.
|
||||||
|
|
||||||
Please do not send suggestions on how to change PNG. We have
|
Please do not send suggestions on how to change PNG. We have
|
||||||
been discussing PNG for twelve years now, and it is official and
|
been discussing PNG for nine years now, and it is official and
|
||||||
finished. If you have suggestions for libpng, however, I'll
|
finished. If you have suggestions for libpng, however, I'll
|
||||||
gladly listen. Even if your suggestion is not used immediately,
|
gladly listen. Even if your suggestion is not used immediately,
|
||||||
it may be used later.
|
it may be used later.
|
||||||
@@ -144,14 +141,17 @@ Files in this distribution:
|
|||||||
TODO => Things not implemented in the current library
|
TODO => Things not implemented in the current library
|
||||||
Y2KINFO => Statement of Y2K compliance
|
Y2KINFO => Statement of Y2K compliance
|
||||||
example.c => Example code for using libpng functions
|
example.c => Example code for using libpng functions
|
||||||
libpng-*-*-diff.txt => Diff from previous release
|
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
||||||
libpng.3 => manual page for libpng (includes libpng.txt)
|
libpng-manual.txt => Description of libpng and its functions
|
||||||
libpng.txt => Description of libpng and its functions
|
|
||||||
libpngpf.3 => manual page for libpng's private functions
|
libpngpf.3 => manual page for libpng's private functions
|
||||||
png.5 => manual page for the PNG format
|
png.5 => manual page for the PNG format
|
||||||
png.c => Basic interface functions common to library
|
png.c => Basic interface functions common to library
|
||||||
png.h => Library function and interface declarations
|
png.h => Library function and interface declarations (public)
|
||||||
pngconf.h => System specific library configuration
|
pngpriv.h => Library function and interface declarations (private)
|
||||||
|
pngconf.h => System specific library configuration (public)
|
||||||
|
pngstruct.h => png_struct declaration (private)
|
||||||
|
pnginfo.h => png_info struct declaration (private)
|
||||||
|
pngdebug.h => debugging macros (private)
|
||||||
pngerror.c => Error/warning message I/O functions
|
pngerror.c => Error/warning message I/O functions
|
||||||
pngget.c => Functions for retrieving info from struct
|
pngget.c => Functions for retrieving info from struct
|
||||||
pngmem.c => Memory handling functions
|
pngmem.c => Memory handling functions
|
||||||
@@ -178,89 +178,27 @@ Files in this distribution:
|
|||||||
pngminus => Simple pnm2png and png2pnm programs
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
pngsuite => Test images
|
pngsuite => Test images
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
projects => Contains project files and workspaces for building DLL
|
projects => Contains project files and workspaces for
|
||||||
beos => Contains a Beos workspace for building libpng
|
building a DLL
|
||||||
c5builder => Contains a Borland workspace for building libpng
|
cbuilder5 => Contains a Borland workspace for building
|
||||||
and zlib
|
libpng and zlib
|
||||||
visualc6 => Contains a Microsoft Visual C++ (MSVC) workspace
|
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
for building libpng and zlib
|
workspace for building libpng and zlib
|
||||||
netware.txt => Contains instructions for downloading a set of
|
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
project files for building libpng and zlib on
|
workspace for building libpng and zlib
|
||||||
Netware.
|
xcode => Contains an Apple xcode
|
||||||
wince.txt => Contains instructions for downloading a Microsoft
|
workspace for building libpng and zlib
|
||||||
Visual C++ (Windows CD Toolkit) workspace for
|
|
||||||
building libpng and zlib on WindowsCE
|
|
||||||
scripts => Directory containing scripts for building libpng:
|
scripts => Directory containing scripts for building libpng:
|
||||||
descrip.mms => VMS makefile for MMS or MMK
|
(see scripts/README.txt for the list of scripts)
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
|
||||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
|
||||||
gcc, creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.linux => Linux/ELF makefile
|
|
||||||
(gcc, creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.gcmmx => Linux/ELF makefile
|
|
||||||
(gcc, creates libpng12.so.0.1.2.40,
|
|
||||||
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
|
|
||||||
ansi2knr (Requires ansi2knr.c from
|
|
||||||
ftp://ftp.cs.wisc.edu/ghost)
|
|
||||||
makefile.aix => AIX makefile
|
|
||||||
makefile.cygwin => Cygwin/gcc makefile
|
|
||||||
makefile.darwin => Darwin makefile
|
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
|
||||||
makefile.freebsd => FreeBSD makefile
|
|
||||||
makefile.hpgcc => HPUX makefile using gcc
|
|
||||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
|
||||||
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
|
|
||||||
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.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so.
|
|
||||||
makefile.ne12bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng12.so
|
|
||||||
makefile.openbsd => OpenBSD makefile
|
|
||||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
|
||||||
makefile.sggcc => Silicon Graphics
|
|
||||||
(gcc, creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.sunos => Sun makefile
|
|
||||||
makefile.solaris => Solaris 2.X makefile
|
|
||||||
(gcc, creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.so9 => Solaris 9 makefile
|
|
||||||
(gcc, creates libpng12.so.0.1.2.40)
|
|
||||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
|
||||||
makefile.64sunu => Sun Ultra 64-bit makefile
|
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
|
||||||
makefile.mips => MIPS makefile
|
|
||||||
makefile.acorn => Acorn makefile
|
|
||||||
makefile.amiga => Amiga makefile
|
|
||||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC
|
|
||||||
compiler (Requires SCOPTIONS, copied from
|
|
||||||
scripts/SCOPTIONS.ppc)
|
|
||||||
makefile.atari => Atari makefile
|
|
||||||
makefile.beos => BEOS makefile for X86
|
|
||||||
makefile.bor => Borland makefile (uses bcc)
|
|
||||||
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
|
||||||
makefile.tc3 => Turbo C 3.0 makefile
|
|
||||||
makefile.dj2 => DJGPP 2 makefile
|
|
||||||
makefile.msc => Microsoft C makefile
|
|
||||||
makefile.vcawin32=> makefile for Microsoft Visual C++ 5.0 and
|
|
||||||
later (uses assembler code tuned for Intel MMX
|
|
||||||
platform)
|
|
||||||
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
|
|
||||||
later (does not use assembler code)
|
|
||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
|
||||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
|
||||||
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
|
||||||
makevms.com => VMS build script
|
|
||||||
SCOPTIONS.ppc => Used with smakefile.ppc
|
|
||||||
|
|
||||||
Good luck, and happy coding.
|
Good luck, and happy coding.
|
||||||
|
|
||||||
-Glenn Randers-Pehrson (current maintainer)
|
-Glenn Randers-Pehrson (current maintainer, since 1998)
|
||||||
Internet: glennrp at users.sourceforge.net
|
Internet: glennrp at users.sourceforge.net
|
||||||
|
|
||||||
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||||
Internet: adilger at enel.ucalgary.ca
|
Internet: adilger at enel.ucalgary.ca
|
||||||
Web: http://members.shaw.ca/adilger/
|
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
||||||
|
|
||||||
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||||
(formerly of Group 42, Inc)
|
(formerly of Group 42, Inc)
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
|
/*
|
||||||
TODO - list of things to do for libpng:
|
TODO - list of things to do for libpng:
|
||||||
|
|
||||||
Final bug fixes.
|
Final bug fixes.
|
||||||
Improve API by hiding the png_struct and png_info structs.
|
|
||||||
Finish work on the no-floating-point version (including gamma compensation)
|
|
||||||
Better C++ wrapper/full C++ implementation?
|
Better C++ wrapper/full C++ implementation?
|
||||||
Fix problem with C++ and EXTERN "C".
|
Fix problem with C++ and EXTERN "C".
|
||||||
cHRM transformation.
|
cHRM transformation.
|
||||||
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
|
Remove setjmp/longjmp usage in favor of returning error codes.
|
||||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
Improved dithering.
|
Improved dithering.
|
||||||
Multi-lingual error and warning message support.
|
Multi-lingual error and warning message support.
|
||||||
@@ -17,9 +16,12 @@ Better filter selection
|
|||||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||||
Histogram creation.
|
Histogram creation.
|
||||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||||
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
|
Avoid building gamma tables whenever possible.
|
||||||
Build gamma tables using fixed point (and do away with floating point entirely).
|
|
||||||
Use greater precision when changing to linear gamma for compositing against
|
Use greater precision when changing to linear gamma for compositing against
|
||||||
background and doing rgb-to-gray transformation.
|
background and doing rgb-to-gray transformation.
|
||||||
Investigate pre-incremented loop counters and other loop constructions.
|
Investigate pre-incremented loop counters and other loop constructions.
|
||||||
Add interpolated method of handling interlacing.
|
Add interpolated method of handling interlacing.
|
||||||
|
Switch to the simpler zlib (zlib/libpng) license if legally possible.
|
||||||
|
Extend pngvalid.c to validate more of the libpng transformations.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
-55
@@ -1,55 +0,0 @@
|
|||||||
Y2K compliance in libpng:
|
|
||||||
=========================
|
|
||||||
|
|
||||||
September 10, 2009
|
|
||||||
|
|
||||||
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.2.40 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 will hold years up to 65535. The other two hold the date in text
|
|
||||||
format, and will hold years up to 9999.
|
|
||||||
|
|
||||||
The integer is
|
|
||||||
"png_uint_16 year" in png_time_struct.
|
|
||||||
|
|
||||||
The strings are
|
|
||||||
"png_charp time_buffer" in png_struct and
|
|
||||||
"near_time_buffer", which is a local character string in png.c.
|
|
||||||
|
|
||||||
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_time_t() in pngwrite.c
|
|
||||||
png_get_tIME() in pngget.c
|
|
||||||
png_handle_tIME() in pngrutil.c, called in pngread.c
|
|
||||||
png_set_tIME() in pngset.c
|
|
||||||
png_write_tIME() in pngwutil.c, called in pngwrite.c
|
|
||||||
|
|
||||||
All appear to handle dates properly in a Y2K environment. The
|
|
||||||
png_convert_from_time_t() function calls gmtime() to convert from system
|
|
||||||
clock time, which returns (year - 1900), which we properly convert to
|
|
||||||
the full 4-digit year. There is a possibility that applications using
|
|
||||||
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
|
||||||
function, or that they are incorrectly passing only a 2-digit year
|
|
||||||
instead of "year - 1900" into the png_convert_from_struct_tm() function,
|
|
||||||
but this is not under our control. The libpng documentation has always
|
|
||||||
stated that it works with 4-digit years, and the APIs have been
|
|
||||||
documented as such.
|
|
||||||
|
|
||||||
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
|
||||||
integer to hold the year, and can hold years as large as 65535.
|
|
||||||
|
|
||||||
zlib, upon which libpng depends, is also Y2K compliant. It contains
|
|
||||||
no date-related code.
|
|
||||||
|
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
|
||||||
libpng maintainer
|
|
||||||
PNG Development Group
|
|
||||||
+1285
-261
File diff suppressed because it is too large
Load Diff
+1564
-537
File diff suppressed because it is too large
Load Diff
+10
-770
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "September 10, 2009"
|
.TH PNG 5 "February 3, 2011"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
@@ -18,7 +18,7 @@ gamma and chromaticity data for improved color matching on heterogeneous
|
|||||||
platforms.
|
platforms.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.IR libpng(3) ", " zlib(3) ", " deflate(5) ", and " zlib(5)
|
.BR "libpng"(3), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
|
||||||
.LP
|
.LP
|
||||||
PNG specification (second edition), November 2003:
|
PNG specification (second edition), November 2003:
|
||||||
.IP
|
.IP
|
||||||
@@ -35,7 +35,7 @@ PNG 1.0 specification, October 1996:
|
|||||||
RFC 2083
|
RFC 2083
|
||||||
.IP
|
.IP
|
||||||
.br
|
.br
|
||||||
ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
|
ftp://ds.internic.net/rfc/rfc2083.txt
|
||||||
.br
|
.br
|
||||||
or (as a W3C Recommendation) at
|
or (as a W3C Recommendation) at
|
||||||
.br
|
.br
|
||||||
|
|||||||
+444
-1320
File diff suppressed because it is too large
Load Diff
Executable
+157
@@ -0,0 +1,157 @@
|
|||||||
|
|
||||||
|
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 1998-2011 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.)
|
||||||
|
*
|
||||||
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define PNG_DEBUG at compile time for debugging information. Higher
|
||||||
|
* numbers for PNG_DEBUG mean more debugging information. This has
|
||||||
|
* only been added since version 0.95 so it is not implemented throughout
|
||||||
|
* libpng yet, but more support will be added as needed.
|
||||||
|
*
|
||||||
|
* png_debug[1-2]?(level, message ,arg{0-2})
|
||||||
|
* Expands to a statement (either a simple expression or a compound
|
||||||
|
* do..while(0) statement) that outputs a message with parameter
|
||||||
|
* substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
|
||||||
|
* is undefined, 0 or 1 every png_debug expands to a simple expression
|
||||||
|
* (actually ((void)0)).
|
||||||
|
*
|
||||||
|
* level: level of detail of message, starting at 0. A level 'n'
|
||||||
|
* message is preceded by 'n' tab characters (not implemented
|
||||||
|
* on Microsoft compilers unless PNG_DEBUG_FILE is also
|
||||||
|
* defined, to allow debug DLL compilation with no standard IO).
|
||||||
|
* message: a printf(3) style text string. A trailing '\n' is added
|
||||||
|
* to the message.
|
||||||
|
* arg: 0 to 2 arguments for printf(3) style substitution in message.
|
||||||
|
*/
|
||||||
|
#ifndef PNGDEBUG_H
|
||||||
|
#define PNGDEBUG_H
|
||||||
|
/* These settings control the formatting of messages in png.c and pngerror.c */
|
||||||
|
/* Moved to pngdebug.h at 1.5.0 */
|
||||||
|
# ifndef PNG_LITERAL_SHARP
|
||||||
|
# define PNG_LITERAL_SHARP 0x23
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
|
||||||
|
# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
|
||||||
|
# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_STRING_NEWLINE
|
||||||
|
# define PNG_STRING_NEWLINE "\n"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#ifdef PNG_DEBUG
|
||||||
|
# if (PNG_DEBUG > 0)
|
||||||
|
# if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
|
||||||
|
# include <crtdbg.h>
|
||||||
|
# if (PNG_DEBUG > 1)
|
||||||
|
# ifndef _DEBUG
|
||||||
|
# define _DEBUG
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug
|
||||||
|
# define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug1
|
||||||
|
# define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug2
|
||||||
|
# define png_debug2(l,m,p1,p2) \
|
||||||
|
_RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# else /* PNG_DEBUG_FILE || !_MSC_VER */
|
||||||
|
# ifndef PNG_STDIO_SUPPORTED
|
||||||
|
# include <stdio.h> /* not included yet */
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_DEBUG_FILE
|
||||||
|
# define PNG_DEBUG_FILE stderr
|
||||||
|
# endif /* PNG_DEBUG_FILE */
|
||||||
|
|
||||||
|
# if (PNG_DEBUG > 1)
|
||||||
|
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
|
||||||
|
* non-ISO compilers
|
||||||
|
*/
|
||||||
|
# ifdef __STDC__
|
||||||
|
# ifndef png_debug
|
||||||
|
# define png_debug(l,m) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug1
|
||||||
|
# define png_debug1(l,m,p1) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug2
|
||||||
|
# define png_debug2(l,m,p1,p2) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# else /* __STDC __ */
|
||||||
|
# ifndef png_debug
|
||||||
|
# define png_debug(l,m) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
char format[256]; \
|
||||||
|
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||||
|
m,PNG_STRING_NEWLINE); \
|
||||||
|
fprintf(PNG_DEBUG_FILE,format); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug1
|
||||||
|
# define png_debug1(l,m,p1) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
char format[256]; \
|
||||||
|
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||||
|
m,PNG_STRING_NEWLINE); \
|
||||||
|
fprintf(PNG_DEBUG_FILE,format,p1); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug2
|
||||||
|
# define png_debug2(l,m,p1,p2) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
char format[256]; \
|
||||||
|
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||||
|
m,PNG_STRING_NEWLINE); \
|
||||||
|
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# endif /* __STDC __ */
|
||||||
|
# endif /* (PNG_DEBUG > 1) */
|
||||||
|
|
||||||
|
# endif /* _MSC_VER */
|
||||||
|
# endif /* (PNG_DEBUG > 0) */
|
||||||
|
#endif /* PNG_DEBUG */
|
||||||
|
#ifndef png_debug
|
||||||
|
# define png_debug(l, m) ((void)0)
|
||||||
|
#endif
|
||||||
|
#ifndef png_debug1
|
||||||
|
# define png_debug1(l, m, p1) ((void)0)
|
||||||
|
#endif
|
||||||
|
#ifndef png_debug2
|
||||||
|
# define png_debug2(l, m, p1, p2) ((void)0)
|
||||||
|
#endif
|
||||||
|
#endif /* PNGDEBUG_H */
|
||||||
+136
-53
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.37 [June 4, 2009]
|
* Last changed in libpng 1.5.1 [February 3, 2011]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -16,27 +16,27 @@
|
|||||||
* at each function.
|
* at each function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#include "png.h"
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
||||||
static void /* PRIVATE */
|
static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr,
|
||||||
png_default_error PNGARG((png_structp png_ptr,
|
png_const_charp error_message)),PNG_NORETURN);
|
||||||
png_const_charp error_message));
|
|
||||||
#ifndef PNG_NO_WARNINGS
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_warning PNGARG((png_structp png_ptr,
|
png_default_warning PNGARG((png_structp png_ptr,
|
||||||
png_const_charp warning_message));
|
png_const_charp warning_message));
|
||||||
#endif /* PNG_NO_WARNINGS */
|
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||||
|
|
||||||
/* This function is called whenever there is a fatal error. This function
|
/* This function is called whenever there is a fatal error. This function
|
||||||
* should not be changed. If there is a need to handle errors differently,
|
* should not be changed. If there is a need to handle errors differently,
|
||||||
* you should supply a replacement error function and use png_set_error_fn()
|
* you should supply a replacement error function and use png_set_error_fn()
|
||||||
* to replace the error function at run-time.
|
* to replace the error function at run-time.
|
||||||
*/
|
*/
|
||||||
#ifndef PNG_NO_ERROR_TEXT
|
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
||||||
void PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_error(png_structp png_ptr, png_const_charp error_message)
|
png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
||||||
{
|
{
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
char msg[16];
|
char msg[16];
|
||||||
@@ -45,13 +45,14 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
if (png_ptr->flags&
|
if (png_ptr->flags&
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
{
|
{
|
||||||
if (*error_message == '#')
|
if (*error_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
/* Strip "#nnnn " from beginning of error message. */
|
/* Strip "#nnnn " from beginning of error message. */
|
||||||
int offset;
|
int offset;
|
||||||
for (offset = 1; offset<15; offset++)
|
for (offset = 1; offset<15; offset++)
|
||||||
if (error_message[offset] == ' ')
|
if (error_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -60,9 +61,11 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
msg[i - 1] = '\0';
|
msg[i - 1] = '\0';
|
||||||
error_message = msg;
|
error_message = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
error_message += offset;
|
error_message += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
@@ -83,8 +86,8 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
png_default_error(png_ptr, error_message);
|
png_default_error(png_ptr, error_message);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_err(png_structp png_ptr)
|
png_err,(png_structp png_ptr),PNG_NORETURN)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
||||||
(*(png_ptr->error_fn))(png_ptr, '\0');
|
(*(png_ptr->error_fn))(png_ptr, '\0');
|
||||||
@@ -93,9 +96,9 @@ png_err(png_structp png_ptr)
|
|||||||
use the default handler, which will not return. */
|
use the default handler, which will not return. */
|
||||||
png_default_error(png_ptr, '\0');
|
png_default_error(png_ptr, '\0');
|
||||||
}
|
}
|
||||||
#endif /* PNG_NO_ERROR_TEXT */
|
#endif /* PNG_ERROR_TEXT_SUPPORTED */
|
||||||
|
|
||||||
#ifndef PNG_NO_WARNINGS
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
/* This function is called whenever there is a non-fatal error. This function
|
/* This function is called whenever there is a non-fatal error. This function
|
||||||
* should not be changed. If there is a need to handle warnings differently,
|
* should not be changed. If there is a need to handle warnings differently,
|
||||||
* you should supply a replacement warning function and use
|
* you should supply a replacement warning function and use
|
||||||
@@ -112,7 +115,7 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (*warning_message == '#')
|
if (*warning_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
for (offset = 1; offset < 15; offset++)
|
for (offset = 1; offset < 15; offset++)
|
||||||
if (warning_message[offset] == ' ')
|
if (warning_message[offset] == ' ')
|
||||||
@@ -125,8 +128,18 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
else
|
else
|
||||||
png_default_warning(png_ptr, warning_message + offset);
|
png_default_warning(png_ptr, warning_message + offset);
|
||||||
}
|
}
|
||||||
#endif /* PNG_NO_WARNINGS */
|
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
|
void PNGAPI
|
||||||
|
png_benign_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
|
{
|
||||||
|
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
||||||
|
png_warning(png_ptr, error_message);
|
||||||
|
else
|
||||||
|
png_error(png_ptr, error_message);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* These utilities are used internally to build an error message that relates
|
/* These utilities are used internally to build an error message that relates
|
||||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||||
@@ -141,8 +154,7 @@ static PNG_CONST char png_digit[16] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define PNG_MAX_ERROR_TEXT 64
|
#define PNG_MAX_ERROR_TEXT 64
|
||||||
|
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||||
#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||||
error_message)
|
error_message)
|
||||||
@@ -154,11 +166,12 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
int c = png_ptr->chunk_name[iin++];
|
int c = png_ptr->chunk_name[iin++];
|
||||||
if (isnonalpha(c))
|
if (isnonalpha(c))
|
||||||
{
|
{
|
||||||
buffer[iout++] = '[';
|
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
||||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
||||||
buffer[iout++] = png_digit[c & 0x0f];
|
buffer[iout++] = png_digit[c & 0x0f];
|
||||||
buffer[iout++] = ']';
|
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[iout++] = (png_byte)c;
|
buffer[iout++] = (png_byte)c;
|
||||||
@@ -167,6 +180,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
|
|
||||||
if (error_message == NULL)
|
if (error_message == NULL)
|
||||||
buffer[iout] = '\0';
|
buffer[iout] = '\0';
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[iout++] = ':';
|
buffer[iout++] = ':';
|
||||||
@@ -175,50 +189,105 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0';
|
buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||||
void PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
|
||||||
|
PNG_NORETURN)
|
||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+PNG_MAX_ERROR_TEXT];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
png_error(png_ptr, error_message);
|
png_error(png_ptr, error_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_format_buffer(png_ptr, msg, error_message);
|
png_format_buffer(png_ptr, msg, error_message);
|
||||||
png_error(png_ptr, msg);
|
png_error(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
|
||||||
#endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */
|
|
||||||
|
|
||||||
#ifndef PNG_NO_WARNINGS
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+PNG_MAX_ERROR_TEXT];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
png_warning(png_ptr, warning_message);
|
png_warning(png_ptr, warning_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_format_buffer(png_ptr, msg, warning_message);
|
png_format_buffer(png_ptr, msg, warning_message);
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_NO_WARNINGS */
|
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
|
void PNGAPI
|
||||||
|
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
|
{
|
||||||
|
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
||||||
|
png_chunk_warning(png_ptr, error_message);
|
||||||
|
|
||||||
|
else
|
||||||
|
png_chunk_error(png_ptr, error_message);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
PNG_FUNCTION(void,
|
||||||
|
png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
|
||||||
|
{
|
||||||
|
# define fixed_message "fixed point overflow in "
|
||||||
|
# define fixed_message_ln ((sizeof fixed_message)-1)
|
||||||
|
int iin;
|
||||||
|
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
||||||
|
png_memcpy(msg, fixed_message, fixed_message_ln);
|
||||||
|
iin = 0;
|
||||||
|
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
||||||
|
{
|
||||||
|
msg[fixed_message_ln + iin] = name[iin];
|
||||||
|
++iin;
|
||||||
|
}
|
||||||
|
msg[fixed_message_ln + iin] = 0;
|
||||||
|
png_error(png_ptr, msg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
/* This API only exists if ANSI-C style error handling is used,
|
||||||
|
* otherwise it is necessary for png_default_error to be overridden.
|
||||||
|
*/
|
||||||
|
jmp_buf* PNGAPI
|
||||||
|
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
|
||||||
|
size_t jmp_buf_size)
|
||||||
|
{
|
||||||
|
if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
png_ptr->longjmp_fn = longjmp_fn;
|
||||||
|
return &png_ptr->png_jmpbuf;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is the default error handling function. Note that replacements for
|
/* This is the default error handling function. Note that replacements for
|
||||||
* this function MUST NOT RETURN, or the program will likely crash. This
|
* this function MUST NOT RETURN, or the program will likely crash. This
|
||||||
* function is used by default, or if the program supplies NULL for the
|
* function is used by default, or if the program supplies NULL for the
|
||||||
* error function pointer in png_set_error_fn().
|
* error function pointer in png_set_error_fn().
|
||||||
*/
|
*/
|
||||||
static void /* PRIVATE */
|
static PNG_FUNCTION(void /* PRIVATE */,
|
||||||
png_default_error(png_structp png_ptr, png_const_charp error_message)
|
png_default_error,(png_structp png_ptr, png_const_charp error_message),
|
||||||
|
PNG_NORETURN)
|
||||||
{
|
{
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (*error_message == '#')
|
if (*error_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
/* Strip "#nnnn " from beginning of error message. */
|
/* Strip "#nnnn " from beginning of error message. */
|
||||||
int offset;
|
int offset;
|
||||||
@@ -229,6 +298,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
if (error_message[offset] == ' ')
|
if (error_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((offset > 1) && (offset < 15))
|
if ((offset > 1) && (offset < 15))
|
||||||
{
|
{
|
||||||
error_number[offset - 1] = '\0';
|
error_number[offset - 1] = '\0';
|
||||||
@@ -236,6 +306,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
error_number, error_message + offset + 1);
|
error_number, error_message + offset + 1);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng error: %s, offset=%d",
|
fprintf(stderr, "libpng error: %s, offset=%d",
|
||||||
@@ -250,29 +321,35 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef PNG_CONSOLE_IO_SUPPORTED
|
||||||
|
PNG_UNUSED(error_message) /* Make compiler happy */
|
||||||
|
#endif
|
||||||
|
png_longjmp(png_ptr, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
PNG_FUNCTION(void,PNGAPI
|
||||||
|
png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
|
||||||
|
{
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
if (png_ptr)
|
if (png_ptr && png_ptr->longjmp_fn)
|
||||||
{
|
{
|
||||||
# ifdef USE_FAR_KEYWORD
|
# ifdef USE_FAR_KEYWORD
|
||||||
{
|
{
|
||||||
jmp_buf jmpbuf;
|
jmp_buf png_jmpbuf;
|
||||||
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
png_memcpy(png_jmpbuf, png_ptr->png_jmpbuf, png_sizeof(jmp_buf));
|
||||||
longjmp(jmpbuf, 1);
|
png_ptr->longjmp_fn(png_jmpbuf, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
# else
|
# else
|
||||||
longjmp(png_ptr->jmpbuf, 1);
|
png_ptr->longjmp_fn(png_ptr->png_jmpbuf, val);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#else
|
#endif
|
||||||
|
/* Here if not setjmp support or if png_ptr is null. */
|
||||||
PNG_ABORT();
|
PNG_ABORT();
|
||||||
#endif
|
|
||||||
#ifdef PNG_NO_CONSOLE_IO
|
|
||||||
error_message = error_message; /* Make compiler happy */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PNG_NO_WARNINGS
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
/* This function is called when there is a warning, but the library thinks
|
/* This function is called when there is a warning, but the library thinks
|
||||||
* it can continue anyway. Replacement functions don't have to do anything
|
* it can continue anyway. Replacement functions don't have to do anything
|
||||||
* here if you don't want them to. In the default configuration, png_ptr is
|
* here if you don't want them to. In the default configuration, png_ptr is
|
||||||
@@ -281,9 +358,9 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||||
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (*warning_message == '#')
|
if (*warning_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
char warning_number[16];
|
char warning_number[16];
|
||||||
@@ -293,6 +370,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
if (warning_message[offset] == ' ')
|
if (warning_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((offset > 1) && (offset < 15))
|
if ((offset > 1) && (offset < 15))
|
||||||
{
|
{
|
||||||
warning_number[offset + 1] = '\0';
|
warning_number[offset + 1] = '\0';
|
||||||
@@ -300,6 +378,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
warning_number, warning_message + offset);
|
warning_number, warning_message + offset);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng warning: %s",
|
fprintf(stderr, "libpng warning: %s",
|
||||||
@@ -309,21 +388,22 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng warning: %s", warning_message);
|
fprintf(stderr, "libpng warning: %s", warning_message);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
warning_message = warning_message; /* Make compiler happy */
|
PNG_UNUSED(warning_message) /* Make compiler happy */
|
||||||
#endif
|
#endif
|
||||||
png_ptr = png_ptr; /* Make compiler happy */
|
PNG_UNUSED(png_ptr) /* Make compiler happy */
|
||||||
}
|
}
|
||||||
#endif /* PNG_NO_WARNINGS */
|
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||||
|
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
* of handling errors and warnings. Note that the error function MUST NOT
|
* of handling errors and warnings. Note that the error function MUST NOT
|
||||||
* return to the calling routine or serious problems will occur. The return
|
* return to the calling routine or serious problems will occur. The return
|
||||||
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
* method used in the default routine calls longjmp(png_ptr->png_jmpbuf, 1)
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
||||||
@@ -331,6 +411,7 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->error_ptr = error_ptr;
|
png_ptr->error_ptr = error_ptr;
|
||||||
png_ptr->error_fn = error_fn;
|
png_ptr->error_fn = error_fn;
|
||||||
png_ptr->warning_fn = warning_fn;
|
png_ptr->warning_fn = warning_fn;
|
||||||
@@ -342,10 +423,11 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
*/
|
*/
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_error_ptr(png_structp png_ptr)
|
png_get_error_ptr(png_const_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->error_ptr);
|
return ((png_voidp)png_ptr->error_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +439,8 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
|||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
png_ptr->flags &=
|
png_ptr->flags &=
|
||||||
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
((~(PNG_FLAG_STRIP_ERROR_NUMBERS |
|
||||||
|
PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+422
-333
File diff suppressed because it is too large
Load Diff
Executable
+270
@@ -0,0 +1,270 @@
|
|||||||
|
|
||||||
|
/* pnginfo.h - header file for PNG reference library
|
||||||
|
*
|
||||||
|
* Copyright (c) 1998-2011 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.)
|
||||||
|
*
|
||||||
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* png_info is a structure that holds the information in a PNG file so
|
||||||
|
* that the application can find out the characteristics of the image.
|
||||||
|
* If you are reading the file, this structure will tell you what is
|
||||||
|
* in the PNG file. If you are writing the file, fill in the information
|
||||||
|
* you want to put into the PNG file, using png_set_*() functions, then
|
||||||
|
* call png_write_info().
|
||||||
|
*
|
||||||
|
* The names chosen should be very close to the PNG specification, so
|
||||||
|
* consult that document for information about the meaning of each field.
|
||||||
|
*
|
||||||
|
* With libpng < 0.95, it was only possible to directly set and read the
|
||||||
|
* the values in the png_info_struct, which meant that the contents and
|
||||||
|
* order of the values had to remain fixed. With libpng 0.95 and later,
|
||||||
|
* however, there are now functions that abstract the contents of
|
||||||
|
* png_info_struct from the application, so this makes it easier to use
|
||||||
|
* libpng with dynamic libraries, and even makes it possible to use
|
||||||
|
* libraries that don't have all of the libpng ancillary chunk-handing
|
||||||
|
* functionality. In libpng-1.5.0 this was moved into a separate private
|
||||||
|
* file that is not visible to applications.
|
||||||
|
*
|
||||||
|
* The following members may have allocated storage attached that should be
|
||||||
|
* cleaned up before the structure is discarded: palette, trans, text,
|
||||||
|
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
|
||||||
|
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
|
||||||
|
* are automatically freed when the info structure is deallocated, if they were
|
||||||
|
* allocated internally by libpng. This behavior can be changed by means
|
||||||
|
* of the png_data_freer() function.
|
||||||
|
*
|
||||||
|
* More allocation details: all the chunk-reading functions that
|
||||||
|
* change these members go through the corresponding png_set_*
|
||||||
|
* functions. A function to clear these members is available: see
|
||||||
|
* png_free_data(). The png_set_* functions do not depend on being
|
||||||
|
* able to point info structure members to any of the storage they are
|
||||||
|
* passed (they make their own copies), EXCEPT that the png_set_text
|
||||||
|
* functions use the same storage passed to them in the text_ptr or
|
||||||
|
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
|
||||||
|
* functions do not make their own copies.
|
||||||
|
*/
|
||||||
|
#ifndef PNGINFO_H
|
||||||
|
#define PNGINFO_H
|
||||||
|
|
||||||
|
struct png_info_def
|
||||||
|
{
|
||||||
|
/* the following are necessary for every PNG file */
|
||||||
|
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
||||||
|
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
||||||
|
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
||||||
|
png_size_t rowbytes; /* bytes needed to hold an untransformed row */
|
||||||
|
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
|
||||||
|
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
|
||||||
|
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
|
||||||
|
png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
|
||||||
|
png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
|
||||||
|
/* The following three should have been named *_method not *_type */
|
||||||
|
png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
|
||||||
|
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
|
||||||
|
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
||||||
|
|
||||||
|
/* The following is informational only on read, and not used on writes. */
|
||||||
|
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
|
||||||
|
png_byte pixel_depth; /* number of bits per pixel */
|
||||||
|
png_byte spare_byte; /* to align the data, and for future use */
|
||||||
|
png_byte signature[8]; /* magic bytes read by libpng from start of file */
|
||||||
|
|
||||||
|
/* The rest of the data is optional. If you are reading, check the
|
||||||
|
* valid field to see if the information in these are valid. If you
|
||||||
|
* are writing, set the valid field to those chunks you want written,
|
||||||
|
* and initialize the appropriate fields below.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(PNG_gAMA_SUPPORTED)
|
||||||
|
/* The gAMA chunk describes the gamma characteristics of the system
|
||||||
|
* on which the image was created, normally in the range [1.0, 2.5].
|
||||||
|
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
|
||||||
|
*/
|
||||||
|
png_fixed_point gamma;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_sRGB_SUPPORTED
|
||||||
|
/* GR-P, 0.96a */
|
||||||
|
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
|
||||||
|
png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_TEXT_SUPPORTED
|
||||||
|
/* The tEXt, and zTXt chunks contain human-readable textual data in
|
||||||
|
* uncompressed, compressed, and optionally compressed forms, respectively.
|
||||||
|
* The data in "text" is an array of pointers to uncompressed,
|
||||||
|
* null-terminated C strings. Each chunk has a keyword that describes the
|
||||||
|
* textual data contained in that chunk. Keywords are not required to be
|
||||||
|
* unique, and the text string may be empty. Any number of text chunks may
|
||||||
|
* be in an image.
|
||||||
|
*/
|
||||||
|
int num_text; /* number of comments read or comments to write */
|
||||||
|
int max_text; /* current size of text array */
|
||||||
|
png_textp text; /* array of comments read or comments to write */
|
||||||
|
#endif /* PNG_TEXT_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_tIME_SUPPORTED
|
||||||
|
/* The tIME chunk holds the last time the displayed image data was
|
||||||
|
* modified. See the png_time struct for the contents of this struct.
|
||||||
|
*/
|
||||||
|
png_time mod_time;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_sBIT_SUPPORTED
|
||||||
|
/* The sBIT chunk specifies the number of significant high-order bits
|
||||||
|
* in the pixel data. Values are in the range [1, bit_depth], and are
|
||||||
|
* only specified for the channels in the pixel data. The contents of
|
||||||
|
* the low-order bits is not specified. Data is valid if
|
||||||
|
* (valid & PNG_INFO_sBIT) is non-zero.
|
||||||
|
*/
|
||||||
|
png_color_8 sig_bit; /* significant bits in color channels */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
|
||||||
|
defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
/* The tRNS chunk supplies transparency data for paletted images and
|
||||||
|
* other image types that don't need a full alpha channel. There are
|
||||||
|
* "num_trans" transparency values for a paletted image, stored in the
|
||||||
|
* same order as the palette colors, starting from index 0. Values
|
||||||
|
* for the data are in the range [0, 255], ranging from fully transparent
|
||||||
|
* to fully opaque, respectively. For non-paletted images, there is a
|
||||||
|
* single color specified that should be treated as fully transparent.
|
||||||
|
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
|
||||||
|
*/
|
||||||
|
png_bytep trans; /* alpha values for paletted image */
|
||||||
|
png_bytep trans_alpha; /* alpha values for paletted image */
|
||||||
|
png_color_16 trans_color; /* transparent color for non-palette image */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
/* The bKGD chunk gives the suggested image background color if the
|
||||||
|
* display program does not have its own background color and the image
|
||||||
|
* is needs to composited onto a background before display. The colors
|
||||||
|
* in "background" are normally in the same color space/depth as the
|
||||||
|
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
|
||||||
|
*/
|
||||||
|
png_color_16 background;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
|
||||||
|
* and downwards from the top-left corner of the display, page, or other
|
||||||
|
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
|
||||||
|
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
|
||||||
|
*/
|
||||||
|
png_int_32 x_offset; /* x offset on page */
|
||||||
|
png_int_32 y_offset; /* y offset on page */
|
||||||
|
png_byte offset_unit_type; /* offset units type */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
/* The pHYs chunk gives the physical pixel density of the image for
|
||||||
|
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
|
||||||
|
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
|
||||||
|
*/
|
||||||
|
png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
|
||||||
|
png_uint_32 y_pixels_per_unit; /* vertical pixel density */
|
||||||
|
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_hIST_SUPPORTED
|
||||||
|
/* The hIST chunk contains the relative frequency or importance of the
|
||||||
|
* various palette entries, so that a viewer can intelligently select a
|
||||||
|
* reduced-color palette, if required. Data is an array of "num_palette"
|
||||||
|
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
|
||||||
|
* is non-zero.
|
||||||
|
*/
|
||||||
|
png_uint_16p hist;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_cHRM_SUPPORTED
|
||||||
|
/* The cHRM chunk describes the CIE color characteristics of the monitor
|
||||||
|
* on which the PNG was created. This data allows the viewer to do gamut
|
||||||
|
* mapping of the input image to ensure that the viewer sees the same
|
||||||
|
* colors in the image as the creator. Values are in the range
|
||||||
|
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
|
||||||
|
*/
|
||||||
|
png_fixed_point x_white;
|
||||||
|
png_fixed_point y_white;
|
||||||
|
png_fixed_point x_red;
|
||||||
|
png_fixed_point y_red;
|
||||||
|
png_fixed_point x_green;
|
||||||
|
png_fixed_point y_green;
|
||||||
|
png_fixed_point x_blue;
|
||||||
|
png_fixed_point y_blue;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_pCAL_SUPPORTED
|
||||||
|
/* The pCAL chunk describes a transformation between the stored pixel
|
||||||
|
* values and original physical data values used to create the image.
|
||||||
|
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
|
||||||
|
* range given by [pcal_X0, pcal_X1], and are further transformed by a
|
||||||
|
* (possibly non-linear) transformation function given by "pcal_type"
|
||||||
|
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
|
||||||
|
* defines below, and the PNG-Group's PNG extensions document for a
|
||||||
|
* complete description of the transformations and how they should be
|
||||||
|
* implemented, and for a description of the ASCII parameter strings.
|
||||||
|
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
|
||||||
|
*/
|
||||||
|
png_charp pcal_purpose; /* pCAL chunk description string */
|
||||||
|
png_int_32 pcal_X0; /* minimum value */
|
||||||
|
png_int_32 pcal_X1; /* maximum value */
|
||||||
|
png_charp pcal_units; /* Latin-1 string giving physical units */
|
||||||
|
png_charpp pcal_params; /* ASCII strings containing parameter values */
|
||||||
|
png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
|
||||||
|
png_byte pcal_nparams; /* number of parameters given in pcal_params */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.6 */
|
||||||
|
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||||
|
|
||||||
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
|
||||||
|
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
|
||||||
|
/* Storage for unknown chunks that the library doesn't recognize. */
|
||||||
|
png_unknown_chunkp unknown_chunks;
|
||||||
|
int unknown_chunks_num;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_iCCP_SUPPORTED
|
||||||
|
/* iCCP chunk data. */
|
||||||
|
png_charp iccp_name; /* profile name */
|
||||||
|
png_bytep iccp_profile; /* International Color Consortium profile data */
|
||||||
|
png_uint_32 iccp_proflen; /* ICC profile data length */
|
||||||
|
png_byte iccp_compression; /* Always zero */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_sPLT_SUPPORTED
|
||||||
|
/* Data on sPLT chunks (there may be more than one). */
|
||||||
|
png_sPLT_tp splt_palettes;
|
||||||
|
png_uint_32 splt_palettes_num;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_sCAL_SUPPORTED
|
||||||
|
/* The sCAL chunk describes the actual physical dimensions of the
|
||||||
|
* subject matter of the graphic. The chunk contains a unit specification
|
||||||
|
* a byte value, and two ASCII strings representing floating-point
|
||||||
|
* values. The values are width and height corresponsing to one pixel
|
||||||
|
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
|
||||||
|
* non-zero.
|
||||||
|
*/
|
||||||
|
png_byte scal_unit; /* unit of physical scale */
|
||||||
|
png_charp scal_s_width; /* string containing height */
|
||||||
|
png_charp scal_s_height; /* string containing width */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||||
|
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
|
||||||
|
non-zero */
|
||||||
|
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
|
||||||
|
png_bytepp row_pointers; /* the image bits */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif /* PNGINFO_H */
|
||||||
Executable
+173
@@ -0,0 +1,173 @@
|
|||||||
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
|
/* libpng version 1.5.0 - January 6, 2011 */
|
||||||
|
|
||||||
|
/* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
|
/* This code is released under the libpng license. */
|
||||||
|
/* For conditions of distribution and use, see the disclaimer */
|
||||||
|
/* and license in png.h */
|
||||||
|
|
||||||
|
/* pnglibconf.h */
|
||||||
|
/* Machine generated file: DO NOT EDIT */
|
||||||
|
/* Derived from: scripts/pnglibconf.dfa */
|
||||||
|
#ifndef PNGLCONF_H
|
||||||
|
#define PNGLCONF_H
|
||||||
|
/* settings */
|
||||||
|
#define PNG_MAX_GAMMA_8 11
|
||||||
|
#define PNG_CALLOC_SUPPORTED
|
||||||
|
#define PNG_QUANTIZE_RED_BITS 5
|
||||||
|
#define PNG_USER_WIDTH_MAX 1000000L
|
||||||
|
#define PNG_QUANTIZE_GREEN_BITS 5
|
||||||
|
#define PNG_API_RULE 0
|
||||||
|
#define PNG_QUANTIZE_BLUE_BITS 5
|
||||||
|
#define PNG_USER_CHUNK_CACHE_MAX 0
|
||||||
|
#define PNG_USER_HEIGHT_MAX 1000000L
|
||||||
|
#define PNG_sCAL_PRECISION 5
|
||||||
|
#define PNG_COST_SHIFT 3
|
||||||
|
#define PNG_WEIGHT_SHIFT 8
|
||||||
|
#define PNG_USER_CHUNK_MALLOC_MAX 0
|
||||||
|
#define PNG_DEFAULT_READ_MACROS 1
|
||||||
|
#define PNG_ZBUF_SIZE 8192
|
||||||
|
#define PNG_GAMMA_THRESHOLD_FIXED 5000
|
||||||
|
/* end of settings */
|
||||||
|
/* options */
|
||||||
|
#define PNG_INFO_IMAGE_SUPPORTED
|
||||||
|
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
|
#define PNG_POINTER_INDEXING_SUPPORTED
|
||||||
|
#define PNG_WARNINGS_SUPPORTED
|
||||||
|
#define PNG_FLOATING_ARITHMETIC_SUPPORTED
|
||||||
|
#define PNG_WRITE_SUPPORTED
|
||||||
|
#define PNG_WRITE_INTERLACING_SUPPORTED
|
||||||
|
#define PNG_WRITE_16BIT_SUPPORTED
|
||||||
|
#define PNG_EASY_ACCESS_SUPPORTED
|
||||||
|
#define PNG_ALIGN_MEMORY_SUPPORTED
|
||||||
|
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||||
|
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_USER_LIMITS_SUPPORTED
|
||||||
|
#define PNG_FIXED_POINT_SUPPORTED
|
||||||
|
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
||||||
|
#define PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
#define PNG_READ_SUPPORTED
|
||||||
|
/*#undef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED*/
|
||||||
|
#define PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
|
#define PNG_SETJMP_SUPPORTED
|
||||||
|
#define PNG_WRITE_FLUSH_SUPPORTED
|
||||||
|
#define PNG_MNG_FEATURES_SUPPORTED
|
||||||
|
#define PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
||||||
|
#define PNG_STDIO_SUPPORTED
|
||||||
|
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_USER_MEM_SUPPORTED
|
||||||
|
#define PNG_IO_STATE_SUPPORTED
|
||||||
|
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
|
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
|
||||||
|
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_WRITE_FILTER_SUPPORTED
|
||||||
|
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||||
|
#define PNG_WRITE_iCCP_SUPPORTED
|
||||||
|
#define PNG_READ_TRANSFORMS_SUPPORTED
|
||||||
|
#define PNG_READ_GAMMA_SUPPORTED
|
||||||
|
#define PNG_READ_bKGD_SUPPORTED
|
||||||
|
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_READ_sCAL_SUPPORTED
|
||||||
|
#define PNG_WRITE_hIST_SUPPORTED
|
||||||
|
#define PNG_READ_OPT_PLTE_SUPPORTED
|
||||||
|
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||||
|
#define PNG_WRITE_gAMA_SUPPORTED
|
||||||
|
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||||
|
#define PNG_WRITE_pCAL_SUPPORTED
|
||||||
|
#define PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||||
|
#define PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||||
|
#define PNG_READ_sBIT_SUPPORTED
|
||||||
|
#define PNG_READ_PACK_SUPPORTED
|
||||||
|
#define PNG_WRITE_SWAP_SUPPORTED
|
||||||
|
#define PNG_READ_cHRM_SUPPORTED
|
||||||
|
#define PNG_WRITE_tIME_SUPPORTED
|
||||||
|
#define PNG_READ_INTERLACING_SUPPORTED
|
||||||
|
#define PNG_READ_tRNS_SUPPORTED
|
||||||
|
#define PNG_WRITE_pHYs_SUPPORTED
|
||||||
|
#define PNG_WRITE_INVERT_SUPPORTED
|
||||||
|
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||||
|
#define PNG_WRITE_sRGB_SUPPORTED
|
||||||
|
#define PNG_READ_oFFs_SUPPORTED
|
||||||
|
#define PNG_WRITE_FILLER_SUPPORTED
|
||||||
|
#define PNG_WRITE_TEXT_SUPPORTED
|
||||||
|
#define PNG_WRITE_SHIFT_SUPPORTED
|
||||||
|
#define PNG_PROGRESSIVE_READ_SUPPORTED
|
||||||
|
#define PNG_READ_SHIFT_SUPPORTED
|
||||||
|
#define PNG_CONVERT_tIME_SUPPORTED
|
||||||
|
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
|
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
|
||||||
|
#define PNG_READ_USER_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_READ_hIST_SUPPORTED
|
||||||
|
#define PNG_READ_16BIT_SUPPORTED
|
||||||
|
#define PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||||
|
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||||
|
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
||||||
|
#define PNG_READ_BACKGROUND_SUPPORTED
|
||||||
|
#define PNG_READ_QUANTIZE_SUPPORTED
|
||||||
|
#define PNG_READ_iCCP_SUPPORTED
|
||||||
|
#define PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||||
|
#define PNG_READ_PACKSWAP_SUPPORTED
|
||||||
|
#define PNG_READ_sRGB_SUPPORTED
|
||||||
|
#define PNG_WRITE_tEXt_SUPPORTED
|
||||||
|
#define PNG_READ_gAMA_SUPPORTED
|
||||||
|
#define PNG_READ_pCAL_SUPPORTED
|
||||||
|
#define PNG_READ_EXPAND_SUPPORTED
|
||||||
|
#define PNG_WRITE_sPLT_SUPPORTED
|
||||||
|
#define PNG_READ_SWAP_SUPPORTED
|
||||||
|
#define PNG_READ_tIME_SUPPORTED
|
||||||
|
#define PNG_READ_pHYs_SUPPORTED
|
||||||
|
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
|
#define PNG_TIME_RFC1123_SUPPORTED
|
||||||
|
#define PNG_READ_TEXT_SUPPORTED
|
||||||
|
#define PNG_WRITE_BGR_SUPPORTED
|
||||||
|
#define PNG_USER_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_CONSOLE_IO_SUPPORTED
|
||||||
|
#define PNG_WRITE_PACK_SUPPORTED
|
||||||
|
#define PNG_READ_FILLER_SUPPORTED
|
||||||
|
#define PNG_WRITE_bKGD_SUPPORTED
|
||||||
|
#define PNG_WRITE_tRNS_SUPPORTED
|
||||||
|
#define PNG_READ_sPLT_SUPPORTED
|
||||||
|
#define PNG_WRITE_sCAL_SUPPORTED
|
||||||
|
#define PNG_WRITE_oFFs_SUPPORTED
|
||||||
|
#define PNG_READ_tEXt_SUPPORTED
|
||||||
|
#define PNG_WRITE_sBIT_SUPPORTED
|
||||||
|
#define PNG_READ_INVERT_SUPPORTED
|
||||||
|
#define PNG_READ_16_TO_8_SUPPORTED
|
||||||
|
#define PNG_WRITE_cHRM_SUPPORTED
|
||||||
|
#define PNG_16BIT_SUPPORTED
|
||||||
|
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||||
|
#define PNG_READ_BGR_SUPPORTED
|
||||||
|
#define PNG_WRITE_PACKSWAP_SUPPORTED
|
||||||
|
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||||
|
#define PNG_sCAL_SUPPORTED
|
||||||
|
#define PNG_WRITE_zTXt_SUPPORTED
|
||||||
|
#define PNG_USER_TRANSFORM_INFO_SUPPORTED
|
||||||
|
#define PNG_sBIT_SUPPORTED
|
||||||
|
#define PNG_cHRM_SUPPORTED
|
||||||
|
#define PNG_bKGD_SUPPORTED
|
||||||
|
#define PNG_tRNS_SUPPORTED
|
||||||
|
#define PNG_WRITE_iTXt_SUPPORTED
|
||||||
|
#define PNG_oFFs_SUPPORTED
|
||||||
|
#define PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||||
|
#define PNG_hIST_SUPPORTED
|
||||||
|
#define PNG_iCCP_SUPPORTED
|
||||||
|
#define PNG_sRGB_SUPPORTED
|
||||||
|
#define PNG_READ_zTXt_SUPPORTED
|
||||||
|
#define PNG_gAMA_SUPPORTED
|
||||||
|
#define PNG_pCAL_SUPPORTED
|
||||||
|
#define PNG_CHECK_cHRM_SUPPORTED
|
||||||
|
#define PNG_tIME_SUPPORTED
|
||||||
|
#define PNG_pHYs_SUPPORTED
|
||||||
|
#define PNG_READ_iTXt_SUPPORTED
|
||||||
|
#define PNG_TEXT_SUPPORTED
|
||||||
|
#define PNG_SAVE_INT_32_SUPPORTED
|
||||||
|
#define PNG_sPLT_SUPPORTED
|
||||||
|
#define PNG_tEXt_SUPPORTED
|
||||||
|
#define PNG_zTXt_SUPPORTED
|
||||||
|
#define PNG_iTXt_SUPPORTED
|
||||||
|
/* end of options */
|
||||||
|
#endif /* PNGLCONF_H */
|
||||||
+172
-134
File diff suppressed because it is too large
Load Diff
+331
-204
File diff suppressed because it is too large
Load Diff
Executable
+1239
File diff suppressed because it is too large
Load Diff
+439
-446
File diff suppressed because it is too large
Load Diff
+34
-35
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.37 [June 4, 2009]
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -18,9 +18,9 @@
|
|||||||
* libpng use it at run time with png_set_read_fn(...).
|
* libpng use it at run time with png_set_read_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#include "png.h"
|
|
||||||
#if defined(PNG_READ_SUPPORTED)
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
||||||
/* Read the data from whatever input you are using. The default routine
|
/* Read the data from whatever input you are using. The default routine
|
||||||
* reads from a file pointer. Note that this routine sometimes gets called
|
* reads from a file pointer. Note that this routine sometimes gets called
|
||||||
@@ -32,41 +32,38 @@ void /* PRIVATE */
|
|||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_debug1(4, "reading %d bytes", (int)length);
|
png_debug1(4, "reading %d bytes", (int)length);
|
||||||
|
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Call to NULL read function");
|
png_error(png_ptr, "Call to NULL read function");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
/* This is the function that does the actual reading of data. If you are
|
/* This is the function that does the actual reading of data. If you are
|
||||||
* not reading from a standard C stream, you should create a replacement
|
* not reading from a standard C stream, you should create a replacement
|
||||||
* read_data function and use it at run time with png_set_read_fn(), rather
|
* read_data function and use it at run time with png_set_read_fn(), rather
|
||||||
* than changing the library.
|
* than changing the library.
|
||||||
*/
|
*/
|
||||||
#ifndef USE_FAR_KEYWORD
|
# ifndef USE_FAR_KEYWORD
|
||||||
void PNGAPI
|
void PNGCBAPI
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_size_t check;
|
png_size_t check;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||||
* instead of an int, which is what fread() actually returns.
|
* instead of an int, which is what fread() actually returns.
|
||||||
*/
|
*/
|
||||||
#if defined(_WIN32_WCE)
|
check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
|
||||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
|
||||||
(png_FILE_p)png_ptr->io_ptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Read Error");
|
png_error(png_ptr, "Read Error");
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
/* This is the model-independent version. Since the standard I/O library
|
/* This is the model-independent version. Since the standard I/O library
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
can't handle far buffers in the medium and small models, we have to copy
|
||||||
the data.
|
the data.
|
||||||
@@ -75,65 +72,66 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
#define NEAR_BUF_SIZE 1024
|
#define NEAR_BUF_SIZE 1024
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
|
|
||||||
static void PNGAPI
|
static void PNGCBAPI
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
int check;
|
png_size_t check;
|
||||||
png_byte *n_data;
|
png_byte *n_data;
|
||||||
png_FILE_p io_ptr;
|
png_FILE_p io_ptr;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
/* Check if data really is near. If so, use usual code. */
|
||||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
|
|
||||||
if ((png_bytep)n_data == data)
|
if ((png_bytep)n_data == data)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fread(n_data, 1, length, io_ptr);
|
check = fread(n_data, 1, length, io_ptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
png_byte buf[NEAR_BUF_SIZE];
|
||||||
png_size_t read, remaining, err;
|
png_size_t read, remaining, err;
|
||||||
check = 0;
|
check = 0;
|
||||||
remaining = length;
|
remaining = length;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
read = MIN(NEAR_BUF_SIZE, remaining);
|
read = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
#if defined(_WIN32_WCE)
|
err = fread(buf, 1, read, io_ptr);
|
||||||
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
|
|
||||||
err = 0;
|
|
||||||
#else
|
|
||||||
err = fread(buf, (png_size_t)1, read, io_ptr);
|
|
||||||
#endif
|
|
||||||
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
||||||
|
|
||||||
if (err != read)
|
if (err != read)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
else
|
else
|
||||||
check += err;
|
check += err;
|
||||||
|
|
||||||
data += read;
|
data += read;
|
||||||
remaining -= read;
|
remaining -= read;
|
||||||
}
|
}
|
||||||
while (remaining != 0);
|
while (remaining != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((png_uint_32)check != (png_uint_32)length)
|
if ((png_uint_32)check != (png_uint_32)length)
|
||||||
png_error(png_ptr, "read Error");
|
png_error(png_ptr, "read Error");
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function allows the application to supply a new input function
|
/* This function allows the application to supply a new input function
|
||||||
* for libpng if standard C streams aren't being used.
|
* for libpng if standard C streams aren't being used.
|
||||||
*
|
*
|
||||||
* This function takes as its arguments:
|
* This function takes as its arguments:
|
||||||
|
*
|
||||||
* png_ptr - pointer to a png input data structure
|
* png_ptr - pointer to a png input data structure
|
||||||
|
*
|
||||||
* io_ptr - pointer to user supplied structure containing info about
|
* io_ptr - pointer to user supplied structure containing info about
|
||||||
* the input functions. May be NULL.
|
* the input functions. May be NULL.
|
||||||
|
*
|
||||||
* read_data_fn - pointer to a new input function that takes as its
|
* read_data_fn - pointer to a new input function that takes as its
|
||||||
* arguments a pointer to a png_struct, a pointer to
|
* arguments a pointer to a png_struct, a pointer to
|
||||||
* a location where input data can be stored, and a 32-bit
|
* a location where input data can be stored, and a 32-bit
|
||||||
@@ -149,11 +147,13 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->io_ptr = io_ptr;
|
png_ptr->io_ptr = io_ptr;
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
if (read_data_fn != NULL)
|
if (read_data_fn != NULL)
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->read_data_fn = png_default_read_data;
|
png_ptr->read_data_fn = png_default_read_data;
|
||||||
#else
|
#else
|
||||||
@@ -165,12 +165,11 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
{
|
{
|
||||||
png_ptr->write_data_fn = NULL;
|
png_ptr->write_data_fn = NULL;
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"It's an error to set both read_data_fn and write_data_fn in the ");
|
"Can't set both read_data_fn and write_data_fn in the"
|
||||||
png_warning(png_ptr,
|
" same structure");
|
||||||
"same structure. Resetting write_data_fn to NULL.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
png_ptr->output_flush_fn = NULL;
|
png_ptr->output_flush_fn = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+758
-915
File diff suppressed because it is too large
Load Diff
+984
-620
File diff suppressed because it is too large
Load Diff
+431
-491
File diff suppressed because it is too large
Load Diff
Executable
+308
@@ -0,0 +1,308 @@
|
|||||||
|
|
||||||
|
/* pngstruct.h - header file for PNG reference library
|
||||||
|
*
|
||||||
|
* Copyright (c) 1998-2011 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.)
|
||||||
|
*
|
||||||
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The structure that holds the information to read and write PNG files.
|
||||||
|
* The only people who need to care about what is inside of this are the
|
||||||
|
* people who will be modifying the library for their own special needs.
|
||||||
|
* It should NOT be accessed directly by an application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PNGSTRUCT_H
|
||||||
|
#define PNGSTRUCT_H
|
||||||
|
/* zlib.h defines the structure z_stream, an instance of which is included
|
||||||
|
* in this structure and is required for decompressing the LZ compressed
|
||||||
|
* data in PNG files.
|
||||||
|
*/
|
||||||
|
#include "zlib.h"
|
||||||
|
|
||||||
|
struct png_struct_def
|
||||||
|
{
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
jmp_buf png_jmpbuf; /* used in png_error */
|
||||||
|
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
|
||||||
|
#endif
|
||||||
|
png_error_ptr error_fn; /* function for printing errors and aborting */
|
||||||
|
png_error_ptr warning_fn; /* function for printing warnings */
|
||||||
|
png_voidp error_ptr; /* user supplied struct for error functions */
|
||||||
|
png_rw_ptr write_data_fn; /* function for writing output data */
|
||||||
|
png_rw_ptr read_data_fn; /* function for reading input data */
|
||||||
|
png_voidp io_ptr; /* ptr to application struct for I/O functions */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
|
png_user_transform_ptr read_user_transform_fn; /* user read transform */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||||
|
png_user_transform_ptr write_user_transform_fn; /* user write transform */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These were added in libpng-1.0.2 */
|
||||||
|
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||||
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||||
|
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
|
png_voidp user_transform_ptr; /* user supplied struct for user transform */
|
||||||
|
png_byte user_transform_depth; /* bit depth of user transformed pixels */
|
||||||
|
png_byte user_transform_channels; /* channels in user transformed pixels */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_uint_32 mode; /* tells us where we are in the PNG file */
|
||||||
|
png_uint_32 flags; /* flags indicating various things to libpng */
|
||||||
|
png_uint_32 transformations; /* which transformations to perform */
|
||||||
|
|
||||||
|
z_stream zstream; /* pointer to decompression structure (below) */
|
||||||
|
png_bytep zbuf; /* buffer for zlib */
|
||||||
|
uInt zbuf_size; /* size of zbuf (typically 65536) */
|
||||||
|
int zlib_level; /* holds zlib compression level */
|
||||||
|
int zlib_method; /* holds zlib compression method */
|
||||||
|
int zlib_window_bits; /* holds zlib compression window bits */
|
||||||
|
int zlib_mem_level; /* holds zlib compression memory level */
|
||||||
|
int zlib_strategy; /* holds zlib compression strategy */
|
||||||
|
|
||||||
|
png_uint_32 width; /* width of image in pixels */
|
||||||
|
png_uint_32 height; /* height of image in pixels */
|
||||||
|
png_uint_32 num_rows; /* number of rows in current pass */
|
||||||
|
png_uint_32 usr_width; /* width of row at start of write */
|
||||||
|
png_size_t rowbytes; /* size of row in bytes */
|
||||||
|
png_uint_32 iwidth; /* width of current interlaced row in pixels */
|
||||||
|
png_uint_32 row_number; /* current row in interlace pass */
|
||||||
|
png_bytep prev_row; /* buffer to save previous (unfiltered) row */
|
||||||
|
png_bytep row_buf; /* buffer to save current (unfiltered) row */
|
||||||
|
png_bytep sub_row; /* buffer to save "sub" row when filtering */
|
||||||
|
png_bytep up_row; /* buffer to save "up" row when filtering */
|
||||||
|
png_bytep avg_row; /* buffer to save "avg" row when filtering */
|
||||||
|
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
|
||||||
|
png_row_info row_info; /* used for transformation routines */
|
||||||
|
|
||||||
|
png_uint_32 idat_size; /* current IDAT size for read */
|
||||||
|
png_uint_32 crc; /* current chunk CRC value */
|
||||||
|
png_colorp palette; /* palette from the input file */
|
||||||
|
png_uint_16 num_palette; /* number of color entries in palette */
|
||||||
|
png_uint_16 num_trans; /* number of transparency values */
|
||||||
|
png_byte chunk_name[5]; /* null-terminated name of current chunk */
|
||||||
|
png_byte compression; /* file compression type (always 0) */
|
||||||
|
png_byte filter; /* file filter type (always 0) */
|
||||||
|
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
||||||
|
png_byte pass; /* current interlace pass (0 - 6) */
|
||||||
|
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
|
||||||
|
png_byte color_type; /* color type of file */
|
||||||
|
png_byte bit_depth; /* bit depth of file */
|
||||||
|
png_byte usr_bit_depth; /* bit depth of users row */
|
||||||
|
png_byte pixel_depth; /* number of bits per pixel */
|
||||||
|
png_byte channels; /* number of channels in file */
|
||||||
|
png_byte usr_channels; /* channels at start of write */
|
||||||
|
png_byte sig_bytes; /* magic bytes read/written from start of file */
|
||||||
|
|
||||||
|
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||||
|
png_uint_16 filler; /* filler bytes for pixel expansion */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_bKGD_SUPPORTED
|
||||||
|
png_byte background_gamma_type;
|
||||||
|
png_fixed_point background_gamma;
|
||||||
|
png_color_16 background; /* background color in screen gamma space */
|
||||||
|
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||||
|
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_bKGD_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
|
png_flush_ptr output_flush_fn; /* Function for flushing output */
|
||||||
|
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
|
||||||
|
png_uint_32 flush_rows; /* number of rows written since last flush */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
|
||||||
|
png_fixed_point gamma; /* file gamma value */
|
||||||
|
png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
png_bytep gamma_table; /* gamma table for 8-bit depth files */
|
||||||
|
png_bytep gamma_from_1; /* converts from 1.0 to screen */
|
||||||
|
png_bytep gamma_to_1; /* converts from file to 1.0 */
|
||||||
|
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
|
||||||
|
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
|
||||||
|
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
|
||||||
|
png_color_8 sig_bit; /* significant bits in each available channel */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||||
|
png_color_8 shift; /* shift for significant bit tranformation */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|
||||||
|
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
png_bytep trans_alpha; /* alpha values for paletted files */
|
||||||
|
png_color_16 trans_color; /* transparent color for non-paletted files */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_read_status_ptr read_row_fn; /* called after each row is decoded */
|
||||||
|
png_write_status_ptr write_row_fn; /* called after each row is encoded */
|
||||||
|
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||||
|
png_progressive_info_ptr info_fn; /* called after header data fully read */
|
||||||
|
png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
|
||||||
|
png_progressive_end_ptr end_fn; /* called after image is complete */
|
||||||
|
png_bytep save_buffer_ptr; /* current location in save_buffer */
|
||||||
|
png_bytep save_buffer; /* buffer for previously read data */
|
||||||
|
png_bytep current_buffer_ptr; /* current location in current_buffer */
|
||||||
|
png_bytep current_buffer; /* buffer for recently used data */
|
||||||
|
png_uint_32 push_length; /* size of current input chunk */
|
||||||
|
png_uint_32 skip_length; /* bytes to skip in input data */
|
||||||
|
png_size_t save_buffer_size; /* amount of data now in save_buffer */
|
||||||
|
png_size_t save_buffer_max; /* total size of save_buffer */
|
||||||
|
png_size_t buffer_size; /* total amount of available input data */
|
||||||
|
png_size_t current_buffer_size; /* amount of data now in current_buffer */
|
||||||
|
int process_mode; /* what push library is currently doing */
|
||||||
|
int cur_palette; /* current push library palette index */
|
||||||
|
|
||||||
|
# ifdef PNG_TEXT_SUPPORTED
|
||||||
|
png_size_t current_text_size; /* current size of text input data */
|
||||||
|
png_size_t current_text_left; /* how much text left to read in input */
|
||||||
|
png_charp current_text; /* current text chunk buffer */
|
||||||
|
png_charp current_text_ptr; /* current location in current_text */
|
||||||
|
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
|
||||||
|
|
||||||
|
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||||
|
|
||||||
|
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||||
|
/* For the Borland special 64K segment handler */
|
||||||
|
png_bytepp offset_table_ptr;
|
||||||
|
png_bytep offset_table;
|
||||||
|
png_uint_16 offset_table_number;
|
||||||
|
png_uint_16 offset_table_count;
|
||||||
|
png_uint_16 offset_table_count_free;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
|
png_bytep palette_lookup; /* lookup table for quantizing */
|
||||||
|
png_bytep quantize_index; /* index translation for palette files */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
|
||||||
|
png_uint_16p hist; /* histogram */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||||
|
png_byte heuristic_method; /* heuristic for row filter selection */
|
||||||
|
png_byte num_prev_filters; /* number of weights for previous rows */
|
||||||
|
png_bytep prev_filters; /* filter type(s) of previous row(s) */
|
||||||
|
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
|
||||||
|
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
|
||||||
|
png_uint_16p filter_costs; /* relative filter calculation cost */
|
||||||
|
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||||
|
png_charp time_buffer; /* String to hold RFC 1123 time text */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.6 */
|
||||||
|
|
||||||
|
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||||
|
|
||||||
|
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
||||||
|
png_voidp user_chunk_ptr;
|
||||||
|
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
|
int num_chunk_list;
|
||||||
|
png_bytep chunk_list;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.3 */
|
||||||
|
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||||
|
png_byte rgb_to_gray_status;
|
||||||
|
/* These were changed from png_byte in libpng-1.0.6 */
|
||||||
|
png_uint_16 rgb_to_gray_red_coeff;
|
||||||
|
png_uint_16 rgb_to_gray_green_coeff;
|
||||||
|
png_uint_16 rgb_to_gray_blue_coeff;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
|
||||||
|
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
|
||||||
|
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
|
||||||
|
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
|
||||||
|
png_uint_32 mng_features_permitted;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
|
||||||
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
|
png_byte filter_type;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.2.0 */
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
png_voidp mem_ptr; /* user supplied struct for mem functions */
|
||||||
|
png_malloc_ptr malloc_fn; /* function for allocating memory */
|
||||||
|
png_free_ptr free_fn; /* function for freeing memory */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.13 and 1.2.0 */
|
||||||
|
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
|
/* The following three members were added at version 1.0.14 and 1.2.4 */
|
||||||
|
png_bytep quantize_sort; /* working sort array */
|
||||||
|
png_bytep index_to_palette; /* where the original index currently is
|
||||||
|
in the palette */
|
||||||
|
png_bytep palette_to_index; /* which original index points to this
|
||||||
|
palette color */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.16 and 1.2.6 */
|
||||||
|
png_byte compression_type;
|
||||||
|
|
||||||
|
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||||
|
png_uint_32 user_width_max;
|
||||||
|
png_uint_32 user_height_max;
|
||||||
|
|
||||||
|
/* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
|
||||||
|
* chunks that can be stored (0 means unlimited).
|
||||||
|
*/
|
||||||
|
png_uint_32 user_chunk_cache_max;
|
||||||
|
|
||||||
|
/* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
|
||||||
|
* can occupy when decompressed. 0 means unlimited.
|
||||||
|
*/
|
||||||
|
png_alloc_size_t user_chunk_malloc_max;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.25 and 1.2.17 */
|
||||||
|
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
/* Storage for unknown chunk that the library doesn't recognize. */
|
||||||
|
png_unknown_chunk unknown_chunk;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.2.26 */
|
||||||
|
png_size_t old_big_row_buf_size;
|
||||||
|
png_size_t old_prev_row_size;
|
||||||
|
|
||||||
|
/* New member added in libpng-1.2.30 */
|
||||||
|
png_charp chunkdata; /* buffer for reading chunk data */
|
||||||
|
|
||||||
|
#ifdef PNG_IO_STATE_SUPPORTED
|
||||||
|
/* New member added in libpng-1.4.0 */
|
||||||
|
png_uint_32 io_state;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
#endif /* PNGSTRUCT_H */
|
||||||
+112
-66
File diff suppressed because it is too large
Load Diff
+40
-45
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.37 [June 4, 2009]
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
* them at run time with png_set_write_fn(...).
|
* them at run time with png_set_write_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#include "png.h"
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Write the data to whatever output you are using. The default routine
|
/* Write the data to whatever output you are using. The default routine
|
||||||
@@ -30,34 +30,33 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
|
/* NOTE: write_data_fn must not change the buffer! */
|
||||||
if (png_ptr->write_data_fn != NULL )
|
if (png_ptr->write_data_fn != NULL )
|
||||||
(*(png_ptr->write_data_fn))(png_ptr, data, length);
|
(*(png_ptr->write_data_fn))(png_ptr, (png_bytep)data, length);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Call to NULL write function");
|
png_error(png_ptr, "Call to NULL write function");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
/* This is the function that does the actual writing of data. If you are
|
/* This is the function that does the actual writing of data. If you are
|
||||||
* not writing to a standard C stream, you should create a replacement
|
* not writing to a standard C stream, you should create a replacement
|
||||||
* write_data function and use it at run time with png_set_write_fn(), rather
|
* write_data function and use it at run time with png_set_write_fn(), rather
|
||||||
* than changing the library.
|
* than changing the library.
|
||||||
*/
|
*/
|
||||||
#ifndef USE_FAR_KEYWORD
|
#ifndef USE_FAR_KEYWORD
|
||||||
void PNGAPI
|
void PNGCBAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_size_t check;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
||||||
#endif
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
@@ -70,7 +69,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
#define NEAR_BUF_SIZE 1024
|
#define NEAR_BUF_SIZE 1024
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
|
|
||||||
void PNGAPI
|
void PNGCBAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
@@ -79,34 +78,29 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
/* Check if data really is near. If so, use usual code. */
|
||||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
|
|
||||||
if ((png_bytep)near_data == data)
|
if ((png_bytep)near_data == data)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fwrite(near_data, 1, length, io_ptr);
|
check = fwrite(near_data, 1, length, io_ptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
png_byte buf[NEAR_BUF_SIZE];
|
||||||
png_size_t written, remaining, err;
|
png_size_t written, remaining, err;
|
||||||
check = 0;
|
check = 0;
|
||||||
remaining = length;
|
remaining = length;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
written = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
|
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
|
||||||
#if defined(_WIN32_WCE)
|
|
||||||
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
|
||||||
err = 0;
|
|
||||||
#else
|
|
||||||
err = fwrite(buf, 1, written, io_ptr);
|
err = fwrite(buf, 1, written, io_ptr);
|
||||||
#endif
|
|
||||||
if (err != written)
|
if (err != written)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -118,6 +112,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
}
|
}
|
||||||
while (remaining != 0);
|
while (remaining != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
@@ -129,7 +124,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
* to disk). After png_flush is called, there should be no data pending
|
* to disk). After png_flush is called, there should be no data pending
|
||||||
* writing in any buffers.
|
* writing in any buffers.
|
||||||
*/
|
*/
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_flush(png_structp png_ptr)
|
png_flush(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
@@ -137,21 +132,19 @@ png_flush(png_structp png_ptr)
|
|||||||
(*(png_ptr->output_flush_fn))(png_ptr);
|
(*(png_ptr->output_flush_fn))(png_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
# ifdef PNG_STDIO_SUPPORTED
|
||||||
void PNGAPI
|
void PNGCBAPI
|
||||||
png_default_flush(png_structp png_ptr)
|
png_default_flush(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
png_FILE_p io_ptr;
|
png_FILE_p io_ptr;
|
||||||
#endif
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
#if !defined(_WIN32_WCE)
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||||
fflush(io_ptr);
|
fflush(io_ptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function allows the application to supply new output functions for
|
/* This function allows the application to supply new output functions for
|
||||||
@@ -173,7 +166,7 @@ png_default_flush(png_structp png_ptr)
|
|||||||
* arguments a pointer to a png_struct. After a call to
|
* arguments a pointer to a png_struct. After a call to
|
||||||
* the flush function, there should be no data in any buffers
|
* the flush function, there should be no data in any buffers
|
||||||
* or pending transmission. If the output method doesn't do
|
* or pending transmission. If the output method doesn't do
|
||||||
* any buffering of ouput, a function prototype must still be
|
* any buffering of output, a function prototype must still be
|
||||||
* supplied although it doesn't have to do anything. If
|
* supplied although it doesn't have to do anything. If
|
||||||
* PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
* PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
||||||
* time, output_flush_fn will be ignored, although it must be
|
* time, output_flush_fn will be ignored, although it must be
|
||||||
@@ -192,7 +185,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
|
|
||||||
png_ptr->io_ptr = io_ptr;
|
png_ptr->io_ptr = io_ptr;
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
if (write_data_fn != NULL)
|
if (write_data_fn != NULL)
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
png_ptr->write_data_fn = write_data_fn;
|
||||||
|
|
||||||
@@ -202,31 +195,33 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
png_ptr->write_data_fn = write_data_fn;
|
png_ptr->write_data_fn = write_data_fn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
#if !defined(PNG_NO_STDIO)
|
# ifdef PNG_STDIO_SUPPORTED
|
||||||
|
|
||||||
if (output_flush_fn != NULL)
|
if (output_flush_fn != NULL)
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->output_flush_fn = png_default_flush;
|
png_ptr->output_flush_fn = png_default_flush;
|
||||||
#else
|
|
||||||
|
# else
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
#endif
|
# endif
|
||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
||||||
|
|
||||||
/* It is an error to read while writing a png file */
|
/* It is an error to read while writing a png file */
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
{
|
{
|
||||||
png_ptr->read_data_fn = NULL;
|
png_ptr->read_data_fn = NULL;
|
||||||
|
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Attempted to set both read_data_fn and write_data_fn in");
|
"Can't set both read_data_fn and write_data_fn in the"
|
||||||
png_warning(png_ptr,
|
" same structure");
|
||||||
"the same structure. Resetting read_data_fn to NULL.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_FAR_KEYWORD)
|
#ifdef USE_FAR_KEYWORD
|
||||||
#if defined(_MSC_VER)
|
# ifdef _MSC_VER
|
||||||
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
||||||
{
|
{
|
||||||
void *near_ptr;
|
void *near_ptr;
|
||||||
@@ -255,5 +250,5 @@ void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
|||||||
return(near_ptr);
|
return(near_ptr);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# endif
|
#endif
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|||||||
+444
-400
File diff suppressed because it is too large
Load Diff
+116
-60
File diff suppressed because it is too large
Load Diff
+493
-370
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user