Imported from libpng-0.97c.tar
This commit is contained in:
parent
70e3f543f1
commit
2687fcc7b5
16
CHANGES
16
CHANGES
@ -167,21 +167,23 @@ version 0.96 [May, 1997]
|
|||||||
added read of CRC after IEND chunk for embedded PNGs (Laszlo Nyul)
|
added read of CRC after IEND chunk for embedded PNGs (Laszlo Nyul)
|
||||||
added typecasts to quiet compiler errors
|
added typecasts to quiet compiler errors
|
||||||
added more debugging info
|
added more debugging info
|
||||||
version 1.00 [not distributed, but Andreas handed off to G&G]
|
version 0.97 [January, 1998]
|
||||||
skipped version 1.00 to avoid potential problems with shared libraries
|
|
||||||
created with version 0.89
|
|
||||||
removed PNG_USE_OWN_CRC capability
|
removed PNG_USE_OWN_CRC capability
|
||||||
relocated png_set_crc_action from pngrutil.c to pngrtran.c
|
relocated png_set_crc_action from pngrutil.c to pngrtran.c
|
||||||
fixed typecasts of "new_key" etc.
|
fixed typecasts of "new_key", etc.
|
||||||
added RFC 1152 date support
|
added RFC 1152 date support
|
||||||
version 1.00.97 [Dec 1997]
|
|
||||||
fixed bug in gamma handling of 4-bit grayscale
|
fixed bug in gamma handling of 4-bit grayscale
|
||||||
added more typecasts. 65536L becomes (png_uint_32)65536L, etc.
|
added more typecasts. 65536L becomes (png_uint_32)65536L, etc.
|
||||||
minor corrections in libpng.txt
|
minor corrections in libpng.txt
|
||||||
added simple sRGB support
|
added simple sRGB support
|
||||||
make it simpler to do conditional compiling
|
make it simpler to do conditional compiling: PNG_READ_NOT_FULLY_SUPPORTED
|
||||||
fixed memory leak in pngwrite.c (free info_ptr->text)
|
fixed memory leak in pngwrite.c (free info_ptr->text)
|
||||||
added more conditions for png_do_background, to avoid changing
|
added more conditions for png_do_background, to avoid changing
|
||||||
black pixels to background when a background is supplied and
|
black pixels to background when a background is supplied and
|
||||||
no pixels are transparent
|
no pixels are transparent
|
||||||
include stdio.h in pngconf.h even when PNG_NO_STDIO is defined.
|
repaired PNG_NO_STDIO behaviour
|
||||||
|
tested NODIV support and made it default behaviour
|
||||||
|
added "-m" option to pngtest
|
||||||
|
[anything else? 2-bit grayscale gamma bug?]
|
||||||
|
regularized version numbering scheme and bumped shared-library major
|
||||||
|
version number to 2 to avoid potential problems with libpng 0.89 apps
|
||||||
|
17
README
17
README
@ -1,23 +1,22 @@
|
|||||||
README for libpng 1.10
|
[NOTE: this is still beta version 0.97c; the text below has already
|
||||||
|
been updated in anticipation of the imminent 1.0 release.]
|
||||||
|
|
||||||
This first official release of libpng. Don't let the fact that
|
|
||||||
|
README for libpng 1.0
|
||||||
|
|
||||||
|
This is 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
|
it's the first release fool you. The libpng library has been in
|
||||||
extensive use and testing for about two years. However, it's
|
extensive use and testing for about two years. However, it's
|
||||||
finally gotten to the stage where there haven't been significant
|
finally gotten to the stage where there haven't been significant
|
||||||
changes to the API in some time, and people have a bad feeling about
|
changes to the API in some time, and people have a bad feeling about
|
||||||
libraries with versions < 1.0.
|
libraries with versions < 1.0.
|
||||||
|
|
||||||
Note that the version number is 1.10 to avoid potential problems
|
|
||||||
with shared libraries created for Linux ELF under version 0.89,
|
|
||||||
which mistakenly used 1.0.89 as the library version number in
|
|
||||||
false anticipation of an imminent 1.0 release.
|
|
||||||
|
|
||||||
****
|
****
|
||||||
Note that some of the changes to the png_info structure render this
|
Note that some of the changes to the png_info structure render this
|
||||||
version of the library binary incompatible with libpng-0.89 or
|
version of the library binary incompatible with libpng-0.89 or
|
||||||
earlier versions if you are using a shared library. The type of the
|
earlier versions if you are using a shared library. The type of the
|
||||||
"filler" parameter for png_set_filler() has changed from png_byte to
|
"filler" parameter for png_set_filler() has changed from png_byte to
|
||||||
png_uint_32, which will affect shared-library applications which use
|
png_uint_32, which will affect shared-library applications that use
|
||||||
this function.
|
this function.
|
||||||
|
|
||||||
To avoid problems with changes to the internals of png_info_struct,
|
To avoid problems with changes to the internals of png_info_struct,
|
||||||
@ -28,7 +27,7 @@ accessing/storing the info_struct data, rather than manipulating it
|
|||||||
directly, to avoid such problems in the future.
|
directly, to avoid such problems in the future.
|
||||||
|
|
||||||
It is important to note that the APIs do not make current programs
|
It is important to note that the APIs do not make current programs
|
||||||
which access the info struct directly incompatible with the new
|
that access the info struct directly incompatible with the new
|
||||||
library. However, it is strongly suggested that new programs use
|
library. However, it is strongly suggested that new programs use
|
||||||
the new APIs (as shown in example.c), and older programs be converted
|
the new APIs (as shown in example.c), and older programs be converted
|
||||||
to the new format, to facilitate upgrades in the future.
|
to the new format, to facilitate upgrades in the future.
|
||||||
|
68
makefile
68
makefile
@ -1,68 +0,0 @@
|
|||||||
# makefile for libpng
|
|
||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
|
||||||
#ZLIBLIB=/usr/local/lib
|
|
||||||
#ZLIBINC=/usr/local/include
|
|
||||||
ZLIBLIB=../zlib
|
|
||||||
ZLIBINC=../zlib
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
|
||||||
|
|
||||||
#RANLIB=echo
|
|
||||||
RANLIB=ranlib
|
|
||||||
|
|
||||||
# where make install puts libpng.a and png.h
|
|
||||||
prefix=/usr/local
|
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
|
||||||
|
|
||||||
all: libpng.a pngtest
|
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
|
||||||
ar rc $@ $(OBJS)
|
|
||||||
$(RANLIB) $@
|
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.a
|
|
||||||
$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
|
|
||||||
|
|
||||||
test: pngtest
|
|
||||||
./pngtest
|
|
||||||
|
|
||||||
install: libpng.a
|
|
||||||
-@mkdir $(prefix)/include
|
|
||||||
-@mkdir $(prefix)/lib
|
|
||||||
cp png.h $(prefix)/include
|
|
||||||
cp pngconf.h $(prefix)/include
|
|
||||||
chmod 644 $(prefix)/include/png.h
|
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
|
||||||
cp libpng.a $(prefix)/lib
|
|
||||||
chmod 644 $(prefix)/lib/libpng.a
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o libpng.a pngtest pngout.png
|
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
|
||||||
|
|
||||||
png.o: png.h pngconf.h
|
|
||||||
pngerror.o: png.h pngconf.h
|
|
||||||
pngrio.o: png.h pngconf.h
|
|
||||||
pngwio.o: png.h pngconf.h
|
|
||||||
pngmem.o: png.h pngconf.h
|
|
||||||
pngset.o: png.h pngconf.h
|
|
||||||
pngget.o: png.h pngconf.h
|
|
||||||
pngread.o: png.h pngconf.h
|
|
||||||
pngrtran.o: png.h pngconf.h
|
|
||||||
pngrutil.o: png.h pngconf.h
|
|
||||||
pngtest.o: png.h pngconf.h
|
|
||||||
pngtrans.o: png.h pngconf.h
|
|
||||||
pngwrite.o: png.h pngconf.h
|
|
||||||
pngwtran.o: png.h pngconf.h
|
|
||||||
pngwutil.o: png.h pngconf.h
|
|
||||||
pngpread.o: png.h pngconf.h
|
|
||||||
|
|
67
makefile.elf
67
makefile.elf
@ -1,5 +1,6 @@
|
|||||||
# makefile for libpng on (linux) ELF
|
# makefile for libpng on Linux ELF with gcc
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
|
# Copyright (C) 1998 Glenn Randers-Pehrson
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
@ -13,14 +14,15 @@ ZLIBINC=../zlib
|
|||||||
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||||
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -malign-loops=2 -malign-functions=2 -fPIC #$(WARNMORE) -g -DPNG_DEBUG=5
|
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -malign-loops=2 \
|
||||||
|
-malign-functions=2 #$(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
#RANLIB=echo
|
#RANLIB=echo
|
||||||
|
|
||||||
PNGMAJ = 1
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0
|
PNGMIN = 0.97
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng.so*, and png.h
|
# where make install puts libpng.a, libpng.so*, and png.h
|
||||||
@ -32,10 +34,17 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
|||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
|
||||||
all: libpng.so pngtest
|
OBJSDLL = $(OBJS:.o=.pic.o)
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o .pic.o
|
||||||
|
|
||||||
|
.c.pic.o:
|
||||||
|
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||||
|
|
||||||
|
all: libpng.a libpng.so pngtest
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.so: libpng.so.$(PNGMAJ)
|
libpng.so: libpng.so.$(PNGMAJ)
|
||||||
@ -44,43 +53,45 @@ libpng.so: libpng.so.$(PNGMAJ)
|
|||||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.so.$(PNGVER): $(OBJS)
|
libpng.so.$(PNGVER): $(OBJSDLL)
|
||||||
gcc -shared -Wl,-soname,libpng.so.$(PNGMAJ) $(OBJS) -o libpng.so.$(PNGVER)
|
gcc -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
|
||||||
|
$(OBJSDLL)
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.so
|
pngtest: pngtest.o libpng.so
|
||||||
$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
test: pngtest
|
test: pngtest
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install: libpng.so.$(PNGVER)
|
install: libpng.a libpng.so.$(PNGVER)
|
||||||
-@mkdir $(INCPATH) $(LIBPATH)
|
-@mkdir $(INCPATH) $(LIBPATH)
|
||||||
cp png.h pngconf.h $(INCPATH)
|
cp png.h pngconf.h $(INCPATH)
|
||||||
chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
cp libpng.so.$(PNGVER) $(LIBPATH)
|
cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
|
||||||
chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
|
chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
|
||||||
-@/bin/rm $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
|
-@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
|
||||||
(cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
(cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
png.o: png.h pngconf.h
|
png.o png.pic.o: png.h pngconf.h
|
||||||
pngerror.o: png.h pngconf.h
|
pngerror.o pngerror.pic.o: png.h pngconf.h
|
||||||
pngrio.o: png.h pngconf.h
|
pngrio.o pngrio.pic.o: png.h pngconf.h
|
||||||
pngwio.o: png.h pngconf.h
|
pngwio.o pngwio.pic.o: png.h pngconf.h
|
||||||
pngmem.o: png.h pngconf.h
|
pngmem.o pngmem.pic.o: png.h pngconf.h
|
||||||
pngset.o: png.h pngconf.h
|
pngset.o pngset.pic.o: png.h pngconf.h
|
||||||
pngget.o: png.h pngconf.h
|
pngget.o pngget.pic.o: png.h pngconf.h
|
||||||
pngread.o: png.h pngconf.h
|
pngread.o pngread.pic.o: png.h pngconf.h
|
||||||
pngrtran.o: png.h pngconf.h
|
pngrtran.o pngrtran.pic.o: png.h pngconf.h
|
||||||
pngrutil.o: png.h pngconf.h
|
pngrutil.o pngrutil.pic.o: png.h pngconf.h
|
||||||
|
pngtrans.o pngtrans.pic.o: png.h pngconf.h
|
||||||
|
pngwrite.o pngwrite.pic.o: png.h pngconf.h
|
||||||
|
pngwtran.o pngwtran.pic.o: png.h pngconf.h
|
||||||
|
pngwutil.o pngwutil.pic.o: png.h pngconf.h
|
||||||
|
pngpread.o pngpread.pic.o: png.h pngconf.h
|
||||||
|
|
||||||
pngtest.o: png.h pngconf.h
|
pngtest.o: png.h pngconf.h
|
||||||
pngtrans.o: png.h pngconf.h
|
|
||||||
pngwrite.o: png.h pngconf.h
|
|
||||||
pngwtran.o: png.h pngconf.h
|
|
||||||
pngwutil.o: png.h pngconf.h
|
|
||||||
pngpread.o: png.h pngconf.h
|
|
||||||
|
7
png.c
7
png.c
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -15,7 +16,7 @@
|
|||||||
/* Version information for C files. This had better match the version
|
/* Version information for C files. This had better match the version
|
||||||
* string defined in png.h.
|
* string defined in png.h.
|
||||||
*/
|
*/
|
||||||
char png_libpng_ver[] = "1.00.97";
|
char png_libpng_ver[] = "0.97";
|
||||||
|
|
||||||
/* Place to hold the signiture string for a PNG file. */
|
/* Place to hold the signiture string for a PNG file. */
|
||||||
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
|
34
png.h
34
png.h
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng 1.00.97 beta 7
|
* libpng 0.97 beta
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Dec 31, 1997
|
* Copyright (c) 1998 Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* BETA NOTICE:
|
* BETA NOTICE:
|
||||||
* This is a beta version. It reads and writes valid files on the
|
* This is a beta version. It reads and writes valid files on the
|
||||||
@ -93,7 +94,7 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.00.97"
|
#define PNG_LIBPNG_VER_STRING "0.97"
|
||||||
|
|
||||||
/* careful here. At one time, I wanted to use 082, but that would be octal.
|
/* careful here. At one time, I wanted to use 082, but that would be octal.
|
||||||
* Version 1.0 will be 100 here, etc.
|
* Version 1.0 will be 100 here, etc.
|
||||||
@ -107,6 +108,33 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
extern char png_libpng_ver[];
|
extern char png_libpng_ver[];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note about libpng version numbers:
|
||||||
|
*
|
||||||
|
* Due to various miscommunications, unforeseen code incompatibilities
|
||||||
|
* and occasional factors outside the authors' control, version numbering
|
||||||
|
* on the library has not always been consistent and straightforward.
|
||||||
|
* The following table summarizes matters since version 0.89c, which was
|
||||||
|
* the first widely used release:
|
||||||
|
*
|
||||||
|
* source png.h shared-lib
|
||||||
|
* version string version
|
||||||
|
* ------- ------ ----------
|
||||||
|
* 0.89c ("1.0 beta 3") 0.89 1.0.89
|
||||||
|
* 0.90 ("1.0 beta 4") 0.90 0.90 [should have been 2.0.90]
|
||||||
|
* 0.95 ("1.0 beta 5") 0.95 0.95 [should have been 2.0.95]
|
||||||
|
* 0.96 ("1.0 beta 6") 0.96 0.96 [should have been 2.0.96]
|
||||||
|
* 0.97b ("1.00.97 beta 7") 1.00.97 1.0.0 [should have been 2.0.97]
|
||||||
|
* 0.97c 0.97 2.0.97
|
||||||
|
* 0.98 0.98 2.0.98
|
||||||
|
* 0.99 0.99 2.0.99
|
||||||
|
* 1.0 1.00 2.1.0
|
||||||
|
*
|
||||||
|
* Henceforth the source version will match the shared-library minor
|
||||||
|
* and patch numbers; the shared-library major version number will be
|
||||||
|
* used for changes in backward compatibility, as it is intended.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Structures to facilitate easy interlacing. See png.c for more details */
|
/* Structures to facilitate easy interlacing. See png.c for more details */
|
||||||
extern int FARDATA png_pass_start[];
|
extern int FARDATA png_pass_start[];
|
||||||
extern int FARDATA png_pass_inc[];
|
extern int FARDATA png_pass_inc[];
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngconf.c - machine configurable file for libpng
|
/* pngconf.c - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Any machine specific code is near the front of this file, so if you
|
/* Any machine specific code is near the front of this file, so if you
|
||||||
@ -259,6 +260,7 @@ __dont__ include it again
|
|||||||
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||||
#define PNG_READ_SWAP_ALPHA_SUPPORTED
|
#define PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||||
#define PNG_READ_STRIP_ALPHA_SUPPORTED
|
#define PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||||
|
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel */
|
||||||
#endif /* PNG_READ_FULLY_SUPPORTED */
|
#endif /* PNG_READ_FULLY_SUPPORTED */
|
||||||
#define PNG_READ_INTERLACING_SUPPORTED
|
#define PNG_READ_INTERLACING_SUPPORTED
|
||||||
|
|
||||||
@ -274,7 +276,7 @@ __dont__ include it again
|
|||||||
#define PNG_WRITE_FLUSH_SUPPORTED
|
#define PNG_WRITE_FLUSH_SUPPORTED
|
||||||
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||||
#endif /*PNG_WRITE_FULLY_SUPPORTED */
|
#endif /* PNG_WRITE_FULLY_SUPPORTED */
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
#define PNG_TIME_RFC1152_SUPPORTED
|
#define PNG_TIME_RFC1152_SUPPORTED
|
||||||
@ -282,7 +284,6 @@ __dont__ include it again
|
|||||||
|
|
||||||
/* These are currently experimental features */
|
/* These are currently experimental features */
|
||||||
#undef PNG_READ_16_TO_8_ACCURATE_SHIFT_SUPPORTED /* very little testing */
|
#undef PNG_READ_16_TO_8_ACCURATE_SHIFT_SUPPORTED /* very little testing */
|
||||||
#undef PNG_READ_COMPOSITE_NODIV_SUPPORTED /* very little testing */
|
|
||||||
|
|
||||||
/* This is only for PowerPC big-endian and 680x0 systems */
|
/* This is only for PowerPC big-endian and 680x0 systems */
|
||||||
#undef PNG_READ_BIG_ENDIAN_SUPPORTED /* some testing */
|
#undef PNG_READ_BIG_ENDIAN_SUPPORTED /* some testing */
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all error handling. Users which
|
* This file provides a location for all error handling. Users which
|
||||||
* need special error handling are expected to write replacement functions
|
* need special error handling are expected to write replacement functions
|
||||||
@ -84,7 +85,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message
|
|||||||
else {
|
else {
|
||||||
buffer[iout++] = ':';
|
buffer[iout++] = ':';
|
||||||
buffer[iout++] = ' ';
|
buffer[iout++] = ' ';
|
||||||
strncpy(buffer+iout, message, 64);
|
png_memcpy(buffer+iout, message, 64);
|
||||||
buffer[iout+63] = 0;
|
buffer[iout+63] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
pngget.c
5
pngget.c
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
|
5
pngmem.c
5
pngmem.c
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all memory allocation. Users which
|
* This file provides a location for all memory allocation. Users which
|
||||||
* need special memory handling are expected to modify the code in this file
|
* need special memory handling are expected to modify the code in this file
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* This file contains routines that an application calls directly to
|
* This file contains routines that an application calls directly to
|
||||||
* read a PNG file or stream.
|
* read a PNG file or stream.
|
||||||
|
5
pngrio.c
5
pngrio.c
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all input. Users which need
|
* This file provides a location for all input. Users which need
|
||||||
* special handling are expected to write a function which has the same
|
* special handling are expected to write a function which has the same
|
||||||
|
86
pngrtran.c
86
pngrtran.c
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* This file contains functions optionally called by an application
|
* This file contains functions optionally called by an application
|
||||||
* in order to tell libpng how to handle data when reading a PNG.
|
* in order to tell libpng how to handle data when reading a PNG.
|
||||||
@ -21,35 +22,40 @@
|
|||||||
* many machines. However, it does take more operations than the corresponding
|
* many machines. However, it does take more operations than the corresponding
|
||||||
* divide method, so it may be slower on some RISC systems. There are two
|
* divide method, so it may be slower on some RISC systems. There are two
|
||||||
* shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
|
* shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
|
||||||
* The results may also be off by one for certain values.
|
*
|
||||||
|
* Note that the rounding factors are NOT supposed to be the same! 128 and
|
||||||
|
* 32768 are correct for the NODIV code; 127 and 32767 are correct for the
|
||||||
|
* standard method.
|
||||||
|
*
|
||||||
|
* [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* pixel and background should be in gamma 1.0 space */
|
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
|
||||||
#define png_composite(composite, pixel, trans, background) \
|
# define png_composite(composite, fg, alpha, bg) \
|
||||||
{ png_uint_16 temp = ((png_uint_16)(pixel) * (png_uint_16)(trans) + \
|
{ png_uint_16 temp = ((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
||||||
(png_uint_16)(background)*(png_uint_16)(255 - \
|
(png_uint_16)(bg)*(png_uint_16)(255 - \
|
||||||
(png_uint_16)(trans)) + (png_uint_16)127); \
|
(png_uint_16)(alpha)) + (png_uint_16)128); \
|
||||||
(composite) = (png_byte)(((temp >> 8) + temp) >> 8); }
|
(composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
|
||||||
|
# define png_composite_16(composite, fg, alpha, bg) \
|
||||||
|
{ png_uint_32 temp = ((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
||||||
|
(png_uint_32)(bg)*(png_uint_32)(65535L - \
|
||||||
|
(png_uint_32)(alpha)) + (png_uint_32)32768L); \
|
||||||
|
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
|
||||||
|
|
||||||
/* pixel and background should be in gamma 1.0 space */
|
#else /* standard method using integer division */
|
||||||
#define png_composite_16(composite, pixel, trans, background) \
|
|
||||||
{ png_uint_32 temp = ((png_uint_32)(pixel) * (png_uint_32)(trans) + \
|
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
|
||||||
(png_uint_32)(background)*(png_uint_32)(65535L - \
|
# define png_composite(composite, fg, alpha, bg) \
|
||||||
(png_uint_32)(trans)) + (png_uint_32)32767); \
|
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
||||||
(composite) = (png_uint_16)(((temp >> 16) + temp) >> 16); }
|
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
|
||||||
#else
|
(png_uint_16)127) / 255)
|
||||||
/* pixel and background should be in gamma 1.0 space */
|
# define png_composite_16(composite, fg, alpha, bg) \
|
||||||
#define png_composite(composite, pixel, trans, background) \
|
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
||||||
(composite) = (png_byte)(((png_uint_16)(pixel) * (png_uint_16)(trans) + \
|
(png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
|
||||||
(png_uint_16)(background) * (png_uint_16)(255 - (png_uint_16)(trans)) + \
|
(png_uint_32)32767) / (png_uint_32)65535L)
|
||||||
(png_uint_16)127) / 255)
|
|
||||||
|
#endif /* ?PNG_READ_COMPOSITE_NODIV_SUPPORTED */
|
||||||
|
|
||||||
/* pixel and background should be in gamma 1.0 space */
|
|
||||||
#define png_composite_16(composite, pixel, trans, background) \
|
|
||||||
(composite) = (png_uint_16)(((png_uint_32)(pixel) * (png_uint_32)(trans) + \
|
|
||||||
(png_uint_32)(background)*(png_uint_32)(65535L - (png_uint_32)(trans)) + \
|
|
||||||
(png_uint_32)32767) / (png_uint_32)65535L)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set the action on getting a CRC error for an ancillary or critical chunk. */
|
/* Set the action on getting a CRC error for an ancillary or critical chunk. */
|
||||||
void
|
void
|
||||||
@ -1344,6 +1350,16 @@ png_do_chop(png_row_infop row_info, png_bytep row)
|
|||||||
*dp = (((((png_uint_32)(*sp) << 8) |
|
*dp = (((((png_uint_32)(*sp) << 8) |
|
||||||
(png_uint_32)(*(sp + 1))) * 255 + 127) / (png_uint_32)65535L;
|
(png_uint_32)(*(sp + 1))) * 255 + 127) / (png_uint_32)65535L;
|
||||||
|
|
||||||
|
|
||||||
|
* GRR: no, I think this is what it really should be:
|
||||||
|
*dp = (((((png_uint_32)(*sp) << 8) |
|
||||||
|
(png_uint_32)(*(sp + 1))) + 128L) / (png_uint_32)257L;
|
||||||
|
|
||||||
|
* GRR: here's the exact calculation with shifts:
|
||||||
|
temp = (((png_uint_32)(*sp) << 8) | (png_uint_32)(*(sp + 1))) + 128L;
|
||||||
|
*dp = (temp - (temp >> 8)) >> 8;
|
||||||
|
|
||||||
|
|
||||||
* Approximate calculation with shift/add instead of multiply/divide:
|
* Approximate calculation with shift/add instead of multiply/divide:
|
||||||
*dp = ((((png_uint_32)(*sp) << 8) |
|
*dp = ((((png_uint_32)(*sp) << 8) |
|
||||||
(png_uint_32)((int)(*(sp + 1)) - *sp)) + 128) >> 8;
|
(png_uint_32)((int)(*(sp + 1)) - *sp)) + 128) >> 8;
|
||||||
@ -2558,6 +2574,22 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
|
|||||||
}
|
}
|
||||||
case PNG_COLOR_TYPE_GRAY:
|
case PNG_COLOR_TYPE_GRAY:
|
||||||
{
|
{
|
||||||
|
if (row_info->bit_depth == 2)
|
||||||
|
{
|
||||||
|
for (i = 0, sp = row; i < row_info->width; i += 4)
|
||||||
|
{
|
||||||
|
int a = *sp & 0xc0;
|
||||||
|
int b = *sp & 0x30;
|
||||||
|
int c = *sp & 0x0c;
|
||||||
|
int d = *sp & 0x03;
|
||||||
|
|
||||||
|
*sp = ((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)|
|
||||||
|
((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)|
|
||||||
|
((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)|
|
||||||
|
((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) );
|
||||||
|
sp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (row_info->bit_depth == 4)
|
if (row_info->bit_depth == 4)
|
||||||
{
|
{
|
||||||
for (i = 0, sp = row; i < row_info->width; i += 2)
|
for (i = 0, sp = row; i < row_info->width; i += 2)
|
||||||
|
101
pngrutil.c
101
pngrutil.c
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* This file contains routines which are only called from within
|
* This file contains routines which are only called from within
|
||||||
* libpng itself during the course of reading an image.
|
* libpng itself during the course of reading an image.
|
||||||
@ -373,7 +374,12 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
else if (png_ptr->mode & PNG_HAVE_PLTE)
|
else if (png_ptr->mode & PNG_HAVE_PLTE)
|
||||||
/* Should be an error, but we can cope with it */
|
/* Should be an error, but we can cope with it */
|
||||||
png_warning(png_ptr, "Out of place gAMA chunk");
|
png_warning(png_ptr, "Out of place gAMA chunk");
|
||||||
else if (info_ptr != NULL && info_ptr->valid & PNG_INFO_gAMA)
|
|
||||||
|
else if (info_ptr != NULL && info_ptr->valid & PNG_INFO_gAMA
|
||||||
|
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||||
|
&& !(info_ptr->valid & PNG_INFO_sRGB)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Duplicate gAMA chunk");
|
png_warning(png_ptr, "Duplicate gAMA chunk");
|
||||||
png_crc_finish(png_ptr, length);
|
png_crc_finish(png_ptr, length);
|
||||||
@ -397,21 +403,14 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||||
if ((png_ptr->mode & PNG_HAVE_sRGB))
|
if (info_ptr->valid & PNG_INFO_sRGB)
|
||||||
if(igamma != (png_uint_32)50000L)
|
if(igamma != (png_uint_32)45000L)
|
||||||
{
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"Ignoring incorrect gAMA value when sRGB is also present");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* PNG_READ_sRGB_SUPPORTED */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
|
||||||
if (png_ptr->mode & PNG_HAVE_sRGB)
|
|
||||||
if(igamma != (png_uint_32)50000L)
|
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Ignoring incorrect gAMA value when sRGB is also present");
|
"Ignoring incorrect gAMA value when sRGB is also present");
|
||||||
|
#ifndef PNG_NO_STDIO
|
||||||
|
fprintf(stderr, "igamma = %lu\n", igamma);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_sRGB_SUPPORTED */
|
#endif /* PNG_READ_sRGB_SUPPORTED */
|
||||||
@ -506,8 +505,12 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
else if (png_ptr->mode & PNG_HAVE_PLTE)
|
else if (png_ptr->mode & PNG_HAVE_PLTE)
|
||||||
/* Should be an error, but we can cope with it */
|
/* Should be an error, but we can cope with it */
|
||||||
png_warning(png_ptr, "Missing PLTE before cHRM");
|
png_warning(png_ptr, "Missing PLTE before cHRM");
|
||||||
|
|
||||||
else if (info_ptr != NULL && info_ptr->valid & PNG_INFO_cHRM
|
else if (info_ptr != NULL && info_ptr->valid & PNG_INFO_cHRM
|
||||||
&& !(info_ptr->valid & PNG_INFO_sRGB))
|
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||||
|
&& !(info_ptr->valid & PNG_INFO_sRGB)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Duplicate cHRM chunk");
|
png_warning(png_ptr, "Duplicate cHRM chunk");
|
||||||
png_crc_finish(png_ptr, length);
|
png_crc_finish(png_ptr, length);
|
||||||
@ -589,7 +592,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||||
if (png_ptr->mode & PNG_HAVE_sRGB)
|
if (info_ptr->valid & PNG_INFO_sRGB)
|
||||||
{
|
{
|
||||||
if (fabs(white_x - (float).3127) > (float).001 ||
|
if (fabs(white_x - (float).3127) > (float).001 ||
|
||||||
fabs(white_y - (float).3290) > (float).001 ||
|
fabs(white_y - (float).3290) > (float).001 ||
|
||||||
@ -598,10 +601,17 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
fabs(green_x - (float).3000) > (float).001 ||
|
fabs(green_x - (float).3000) > (float).001 ||
|
||||||
fabs(green_y - (float).6000) > (float).001 ||
|
fabs(green_y - (float).6000) > (float).001 ||
|
||||||
fabs( blue_x - (float).1500) > (float).001 ||
|
fabs( blue_x - (float).1500) > (float).001 ||
|
||||||
fabs( blue_y - (float).6000) > (float).001)
|
fabs( blue_y - (float).0600) > (float).001)
|
||||||
{
|
{
|
||||||
|
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Ignoring incorrect cHRM value when sRGB is also present");
|
"Ignoring incorrect cHRM value when sRGB is also present");
|
||||||
|
#ifndef PNG_NO_STDIO
|
||||||
|
fprintf(stderr,"wx=%f, wy=%f, rx=%f, ry=%f\n",
|
||||||
|
white_x, white_y, red_x, red_y);
|
||||||
|
fprintf(stderr,"gx=%f, gy=%f, bx=%f, by=%f\n",
|
||||||
|
green_x, green_y, blue_x, blue_y);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -618,8 +628,6 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
{
|
{
|
||||||
png_byte intent;
|
png_byte intent;
|
||||||
png_byte buf[1];
|
png_byte buf[1];
|
||||||
float file_gamma;
|
|
||||||
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
|
|
||||||
|
|
||||||
png_debug(1, "in png_handle_sRGB\n");
|
png_debug(1, "in png_handle_sRGB\n");
|
||||||
|
|
||||||
@ -634,6 +642,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
else if (png_ptr->mode & PNG_HAVE_PLTE)
|
else if (png_ptr->mode & PNG_HAVE_PLTE)
|
||||||
/* Should be an error, but we can cope with it */
|
/* Should be an error, but we can cope with it */
|
||||||
png_warning(png_ptr, "Out of place sRGB chunk");
|
png_warning(png_ptr, "Out of place sRGB chunk");
|
||||||
|
|
||||||
else if (info_ptr != NULL && info_ptr->valid & PNG_INFO_sRGB)
|
else if (info_ptr != NULL && info_ptr->valid & PNG_INFO_sRGB)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Duplicate sRGB chunk");
|
png_warning(png_ptr, "Duplicate sRGB chunk");
|
||||||
@ -660,28 +669,38 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we really want to be paranoid we could check for
|
#ifdef PNG_READ_gAMA_SUPPORTED
|
||||||
already defined gamma and chrm with values that are
|
if ((info_ptr->valid & PNG_INFO_gAMA))
|
||||||
inconsistent with sRGB -- for now, just ignore them */
|
if((png_uint_32)(png_ptr->gamma*(float)100000.+.5) != (png_uint_32)45000L)
|
||||||
|
{
|
||||||
file_gamma = (float)45000./(float)100000.;
|
png_warning(png_ptr,
|
||||||
png_set_gAMA(png_ptr, info_ptr, file_gamma);
|
"Ignoring incorrect gAMA value when sRGB is also present");
|
||||||
|
#ifndef PNG_NO_STDIO
|
||||||
white_x = (float)31270./(float)100000.;
|
fprintf(stderr,"gamma=%f\n",png_ptr->gamma);
|
||||||
white_y = (float)32900./(float)100000.;
|
|
||||||
red_x = (float)64000./(float)100000.;
|
|
||||||
red_y = (float)33000./(float)100000.;
|
|
||||||
green_x = (float)30000./(float)100000.;
|
|
||||||
green_y = (float)60000./(float)100000.;
|
|
||||||
blue_x = (float)15000./(float)100000.;
|
|
||||||
blue_y = (float) 6000./(float)100000.;
|
|
||||||
|
|
||||||
png_set_cHRM(png_ptr, info_ptr,
|
|
||||||
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
|
|
||||||
|
|
||||||
png_set_sRGB(png_ptr, info_ptr, intent);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* PNG_READ_gAMA_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_cHRM_SUPPORTED
|
||||||
|
if (info_ptr->valid & PNG_INFO_cHRM)
|
||||||
|
if (fabs(info_ptr->x_white - (float).3127) > (float).001 ||
|
||||||
|
fabs(info_ptr->y_white - (float).3290) > (float).001 ||
|
||||||
|
fabs( info_ptr->x_red - (float).6400) > (float).001 ||
|
||||||
|
fabs( info_ptr->y_red - (float).3300) > (float).001 ||
|
||||||
|
fabs(info_ptr->x_green - (float).3000) > (float).001 ||
|
||||||
|
fabs(info_ptr->y_green - (float).6000) > (float).001 ||
|
||||||
|
fabs( info_ptr->x_blue - (float).1500) > (float).001 ||
|
||||||
|
fabs( info_ptr->y_blue - (float).0600) > (float).001)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring incorrect cHRM value when sRGB is also present");
|
||||||
|
}
|
||||||
|
#endif /* PNG_READ_cHRM_SUPPORTED */
|
||||||
|
|
||||||
|
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent);
|
||||||
|
}
|
||||||
|
#endif /* PNG_READ_sRGB_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||||
void
|
void
|
||||||
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||||
|
5
pngset.c
5
pngset.c
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* The functions here are used during reads to store data from the file
|
* The functions here are used during reads to store data from the file
|
||||||
* into the info struct, and during writes to store application data
|
* into the info struct, and during writes to store application data
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* This program reads in a PNG image, writes it out again, and then
|
* This program reads in a PNG image, writes it out again, and then
|
||||||
* compares the two files. If the files are identical, this shows that
|
* compares the two files. If the files are identical, this shows that
|
||||||
@ -620,7 +621,10 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=2; i<argc; ++i)
|
for (i=2; i<argc; ++i)
|
||||||
|
{
|
||||||
|
fprintf(STDERR, "Testing %s:\n",argv[i]);
|
||||||
ierror += test(argv[i], outname);
|
ierror += test(argv[i], outname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
|
5
pngwio.c
5
pngwio.c
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all output. Users which need
|
* This file provides a location for all output. Users which need
|
||||||
* special handling are expected to write functions which have the same
|
* special handling are expected to write functions which have the same
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* get internal access to png.h */
|
/* get internal access to png.h */
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.00.97
|
* libpng 0.97
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* May 28, 1997
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
* January 7, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
|
Reference in New Issue
Block a user