Imported from libpng-1.0.2a.tar
This commit is contained in:
parent
345bc27e70
commit
5c6aeb25c1
89
ANNOUNCE
89
ANNOUNCE
@ -1,67 +1,38 @@
|
|||||||
|
|
||||||
Libpng 1.0.2 - June 14, 1998
|
Libpng 1.0.2a - December 29, 1998
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is not intended to be a public release. It will be replaced
|
||||||
|
within a few weeks by a public version or by another test version.
|
||||||
|
|
||||||
Changes since the previous public release (1.0.1):
|
Changes since the last public release:
|
||||||
|
|
||||||
Optimized Paeth calculations by replacing abs() function calls with intrinsics
|
libpng-1.0.2a:
|
||||||
plus other loop optimizations. Improves avg decoding speed by about 20%.
|
|
||||||
Commented out i386istic "align" compiler flags in makefile.lnx.
|
Replaced and extended code that was removed from png_set_filler() in 1.0.1a.
|
||||||
Reduced the default warning level in some makefiles, to make them consistent.
|
Fixed a bug in png_do_filler() that made it fail to write filler bytes in
|
||||||
Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
|
the left-most pixel of each row (Kevin Bracey).
|
||||||
Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation.
|
Changed "static pngcharp tIME_string" to "static char tIME_string[30]"
|
||||||
Added grayscale and 16-bit capability to png_do_read_filler().
|
in pngtest.c (Duncan Simpson).
|
||||||
Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes
|
Fixed a problem in pngrutil.c: gray_to_rgb didn't always work with 16-bit.
|
||||||
too large when writing an image with bit_depth < 8 (Bob Dellaca).
|
Fixed a problem in png_read_push_finish_row(), which would not skip some
|
||||||
Corrected some bugs in the experimental weighted filtering heuristics.
|
passes that it should skip, for images that are less than 3 pixels high.
|
||||||
Moved a misplaced pngrutil code block that truncates tRNS if it has more
|
Interchanged the order of calls to png_do_swap() and png_do_shift()
|
||||||
than num_palette entries -- test was done before num_palette was defined.
|
in pngwtran.c (John Cromer).
|
||||||
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
|
Added #ifdef PNG_DEBUG/#endif surrounding use of PNG_DEBUG in png.h .
|
||||||
Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen).
|
Changed "bad adaptive filter type" from error to warning in pngrutil.c .
|
||||||
Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg).
|
Fixed a documentation error about default filtering with 8-bit indexed-color.
|
||||||
Relocated the png_composite macros from pngrtran.c to png.h (Greg).
|
Separated the PNG_NO_STDIO macro into PNG_NO_STDIO and PNG_NO_CONSOLE_IO
|
||||||
Added makefile.sco (contributed by Mike Hopkirk).
|
(L. Peter Deutsch).
|
||||||
Fixed a bug in pngrtran.c that would set channels=5 under some circumstances.
|
Added png_set_rgb_to_gray() and png_get_rgb_to_gray_status() functions.
|
||||||
Added warnings when people try to use transforms they've defined out.
|
Added png_get_copyright() and png_get_header_version() functions.
|
||||||
Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran.
|
Revised comments on png_set_progressive_read_fn() in libpng.txt and example.c
|
||||||
Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg)
|
Added information about debugging in libpng.txt and libpng.3 .
|
||||||
Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images.
|
Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and makefile.sco.
|
||||||
Moved PNG_WRITE_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED
|
Removed lines after Dynamic Dependencies" in makefile.aco .
|
||||||
out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h
|
Revised makefile.dec to make a shared library (Jeremie Petit).
|
||||||
Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED,
|
Removed trailing blanks from all files.
|
||||||
for consistency, in pngconf.h
|
|
||||||
Added individual "ifndef PNG_NO_CAPABILITY" for the capabilities in pngconf.h
|
|
||||||
to make it easier to remove unwanted capabilities via the compile line
|
|
||||||
Made some corrections to grammar (which, it's) in documentation (Greg).
|
|
||||||
Corrected example.c, use of row_pointers in png_write_image().
|
|
||||||
Revised png_read_rows() to avoid repeated if-testing for NULL (A Kleinert)
|
|
||||||
More corrections to example.c, use of row_pointers in png_write_image()
|
|
||||||
and png_read_rows().
|
|
||||||
Added pngdll.mak and pngdef.pas to scripts directory, contributed by
|
|
||||||
Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5
|
|
||||||
Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.)
|
|
||||||
Changed several loops from count-down to count-up, for consistency.
|
|
||||||
Revised libpng.txt and libpng.3 description of png_set_read|write_fn(), and
|
|
||||||
added warnings when people try to set png_read_fn and png_write_fn in
|
|
||||||
the same structure.
|
|
||||||
Added a test such that png_do_gamma will be done when num_trans==0
|
|
||||||
for truecolor images that have defined a background. This corrects an
|
|
||||||
error that was introduced in libpng-0.90 that can cause gamma processing
|
|
||||||
to be skipped.
|
|
||||||
Added tests in png.h to include "trans" and "trans_values" in structures
|
|
||||||
when PNG_READ_BACKGROUND_SUPPORTED or PNG_READ_EXPAND_SUPPORTED is defined.
|
|
||||||
Add png_free(png_ptr->time_buffer) in png_destroy_read_struct()
|
|
||||||
Moved png_convert_to_rfc_1123() from pngwrite.c to png.c
|
|
||||||
Added capability for user-provided malloc_fn() and free_fn() functions,
|
|
||||||
and revised pngtest.c to demonstrate their use, replacing the
|
|
||||||
PNGTEST_DEBUG_MEM feature.
|
|
||||||
Added makefile.w32, for Microsoft C++ 4.0 and later (Tim Wegner).
|
|
||||||
Fixed two bugs in makefile.bor
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
Send comments/corrections/commendations to
|
||||||
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
|
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn R-P
|
||||||
libpng maintainer
|
|
||||||
PNG Development Group
|
|
||||||
|
29
CHANGES
29
CHANGES
@ -334,7 +334,7 @@ version 1.0.1d [May 24, 1998]
|
|||||||
Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5
|
Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5
|
||||||
Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.)
|
Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.)
|
||||||
Changed several loops from count-down to count-up, for consistency.
|
Changed several loops from count-down to count-up, for consistency.
|
||||||
version 1.0.2 [June 14, 1998]
|
version 1.0.1e [June 6, 1998]
|
||||||
Revised libpng.txt and libpng.3 description of png_set_read|write_fn(), and
|
Revised libpng.txt and libpng.3 description of png_set_read|write_fn(), and
|
||||||
added warnings when people try to set png_read_fn and png_write_fn in
|
added warnings when people try to set png_read_fn and png_write_fn in
|
||||||
the same structure.
|
the same structure.
|
||||||
@ -350,4 +350,29 @@ version 1.0.2 [June 14, 1998]
|
|||||||
and revised pngtest.c to demonstrate their use, replacing the
|
and revised pngtest.c to demonstrate their use, replacing the
|
||||||
PNGTEST_DEBUG_MEM feature.
|
PNGTEST_DEBUG_MEM feature.
|
||||||
Added makefile.w32, for Microsoft C++ 4.0 and later (Tim Wegner).
|
Added makefile.w32, for Microsoft C++ 4.0 and later (Tim Wegner).
|
||||||
Fixed two bugs in makefile.bor
|
version 1.0.2 [June 14, 1998]
|
||||||
|
Fixed two bugs in makefile.bor .
|
||||||
|
version 1.0.2a [December 29, 1998]
|
||||||
|
Replaced and extended code that was removed from png_set_filler() in 1.0.1a.
|
||||||
|
Fixed a bug in png_do_filler() that made it fail to write filler bytes in
|
||||||
|
the left-most pixel of each row (Kevin Bracey).
|
||||||
|
Changed "static pngcharp tIME_string" to "static char tIME_string[30]"
|
||||||
|
in pngtest.c (Duncan Simpson).
|
||||||
|
Fixed a problem in pngrutil.c: gray_to_rgb didn't always work with 16-bit.
|
||||||
|
Fixed a problem in png_read_push_finish_row(), which would not skip some
|
||||||
|
passes that it should skip, for images that are less than 3 pixels high.
|
||||||
|
Interchanged the order of calls to png_do_swap() and png_do_shift()
|
||||||
|
in pngwtran.c (John Cromer).
|
||||||
|
Added #ifdef PNG_DEBUG/#endif surrounding use of PNG_DEBUG in png.h .
|
||||||
|
Changed "bad adaptive filter type" from error to warning in pngrutil.c .
|
||||||
|
Fixed a documentation error about default filtering with 8-bit indexed-color.
|
||||||
|
Separated the PNG_NO_STDIO macro into PNG_NO_STDIO and PNG_NO_CONSOLE_IO
|
||||||
|
(L. Peter Deutsch).
|
||||||
|
Added png_set_rgb_to_gray() and png_get_rgb_to_gray_status() functions.
|
||||||
|
Added png_get_copyright() and png_get_header_version() functions.
|
||||||
|
Revised comments on png_set_progressive_read_fn() in libpng.txt and example.c
|
||||||
|
Added information about debugging in libpng.txt and libpng.3 .
|
||||||
|
Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and makefile.sco.
|
||||||
|
Removed lines after Dynamic Dependencies" in makefile.aco .
|
||||||
|
Revised makefile.dec to make a shared library (Jeremie Petit).
|
||||||
|
Removed trailing blanks from all files.
|
||||||
|
6
INSTALL
6
INSTALL
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng version 1.0.2 - June 14, 1998
|
Installing libpng version 1.0.2a - December 29, 1998
|
||||||
|
|
||||||
Before installing libpng, you must first install zlib. zlib
|
Before installing libpng, you must first install zlib. zlib
|
||||||
can usually be found wherever you got libpng. zlib can be
|
can usually be found wherever you got libpng. zlib can be
|
||||||
@ -10,8 +10,8 @@ zlib.h and zconf.h include files that correspond to the
|
|||||||
version of zlib that's installed.
|
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.0.2" or "lpng102" and "zlib-1.1.2"
|
might be called "libpng-1.0.2a" or "lpng103" and "zlib-1.1.3"
|
||||||
or "zlib112") so that you have directories called "zlib" and "libpng".
|
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
|
71
KNOWNBUG
71
KNOWNBUG
@ -14,6 +14,73 @@ Known bugs and suggested enhancements in libpng-1.0.2
|
|||||||
Question whether i-- or --i is better.
|
Question whether i-- or --i is better.
|
||||||
|
|
||||||
STATUS: Under investigation, postponed until after
|
STATUS: Under investigation, postponed until after
|
||||||
libpng-1.0.2. About 160 loops turned around
|
libpng-1.0.2. About 160 loops will be turned around
|
||||||
in libpng-1.0.2a, for testing.
|
in libpng-1.0.Nn, for testing.
|
||||||
|
|
||||||
|
2. June 15, 1998 -- BUG -- Evan Light
|
||||||
|
|
||||||
|
Under some conditions, 16-bit grayscale images aren't properly
|
||||||
|
expanded to rgb, because png_read_start_row() returns too small a
|
||||||
|
value of max_pixel_depth when png_set_filler() has also been called.
|
||||||
|
|
||||||
|
STATUS: Fixed in libpng-1.0.2a
|
||||||
|
|
||||||
|
3. June 16, 1998 -- BUG -- Matt McConnell
|
||||||
|
|
||||||
|
When reading interlaced images with a progressive reader, in some
|
||||||
|
cases (interlaced images less than 3 pixels high) some passes are
|
||||||
|
not skipped that should be.
|
||||||
|
|
||||||
|
STATUS: Fixed in libpng-1.0.2a
|
||||||
|
|
||||||
|
4. July 3, 1998 -- ENHANCEMENT -- Glenn R-P
|
||||||
|
|
||||||
|
Added png_set_rgb_to_gray() and png_get_rgb_to_gray_status() functions.
|
||||||
|
|
||||||
|
STATUS: Done in libpng-1.0.2a, awaiting comment on resulting test
|
||||||
|
images.
|
||||||
|
|
||||||
|
5. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
|
||||||
|
|
||||||
|
libpng-1.0.2 and earlier transform colors to gamma=1.0 space for
|
||||||
|
merging with background, and then back to the image's gamma. The
|
||||||
|
bit_depth of the intermediate (gamma=1.0) representation is probably
|
||||||
|
not sufficient. In the typical gamma=1/2.2 situation, the linear
|
||||||
|
pixels need about 4 more bits than the gamma-encoded ones, to avoid
|
||||||
|
loss of precision. A similar situation exists with the rgb_to_gray
|
||||||
|
operation.
|
||||||
|
|
||||||
|
STATUS: under development.
|
||||||
|
|
||||||
|
6. August 20, 1998 -- BUG -- Kevin Bracey
|
||||||
|
|
||||||
|
When using the filler transformation, the filler isn't written
|
||||||
|
into the leftmost pixel of each row.
|
||||||
|
|
||||||
|
Also, the filler operation isn't being done right when writing
|
||||||
|
files. Some code that was removed from png_set_filler() in
|
||||||
|
libpng 1.0.1a shouldn't have been removed.
|
||||||
|
|
||||||
|
STATUS: Fixed in libpng-1.0.2a
|
||||||
|
|
||||||
|
7. August 23, 1998 -- BUG -- Duncan Simpson
|
||||||
|
|
||||||
|
"static pngcharp tIME_string" should be changed to
|
||||||
|
"static char tIME_string[30]" in pngtest.c
|
||||||
|
|
||||||
|
STATUS: Fixed in libpng-1.0.2a
|
||||||
|
|
||||||
|
8. August 24, 1998 -- BUG -- John Cromer
|
||||||
|
|
||||||
|
Order of byte-swap and shift operations seems to be incorrect in
|
||||||
|
png_do_write_transformations()
|
||||||
|
|
||||||
|
STATUS: Under investigation.
|
||||||
|
|
||||||
|
9. September 11, 1998 -- ENHANCEMENT -- L. Peter Deutsch
|
||||||
|
|
||||||
|
The PNG_NO_STDIO macro should be split into PNG_NO_STDIO
|
||||||
|
and PNG_NO_CONSOLE_STDIO.
|
||||||
|
|
||||||
|
STATUS: Done in libpng-1.0.2a
|
||||||
|
|
||||||
|
2
README
2
README
@ -1,4 +1,4 @@
|
|||||||
README for libpng 1.0.2 - June 14, 1998 (shared library 2.1)
|
README for libpng 1.0.2a - December 29, 1998 (shared library 2.1)
|
||||||
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.
|
||||||
|
45
TODO
45
TODO
@ -1,23 +1,24 @@
|
|||||||
TODO - list of things to do for libpng
|
TODO - list of things to do for libpng:
|
||||||
|
|
||||||
fix problem with C++ and EXTERN "C"
|
Final bug fixes.
|
||||||
add "grayscale->palette" transformation and "palette->grayscale" detection
|
Fix problem with C++ and EXTERN "C".
|
||||||
color to gray transformation
|
Better C++ wrapper/full C++ implementation?
|
||||||
improved dithering
|
Keep up with public chunks.
|
||||||
multi-lingual error and warning message support
|
sPLT chunk handling.
|
||||||
sPLT chunk handling
|
cHRM transformation.
|
||||||
cHRM transformation
|
Support for application-defined chunk handlers.
|
||||||
complete sRGB transformation (presently it simply uses gamma=0.45)
|
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
|
||||||
man pages for function calls
|
High-level API for reading images.
|
||||||
high-level API for reading images
|
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
final bug fixes
|
Color to gray transformation.
|
||||||
better documentation
|
Improved dithering.
|
||||||
better filter selection
|
Multi-lingual error and warning message support.
|
||||||
(counting huffman bits/precompression? filter inertia? filter costs?)
|
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||||
optional palette creation
|
Man pages for function calls.
|
||||||
histogram creation
|
Better documentation.
|
||||||
support for application-defined chunk handlers
|
Better filter selection
|
||||||
keep up with public chunks
|
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||||
better C++ wrapper/full C++ implementation?
|
Optional palette (sPLT) creation.
|
||||||
text conversion between different code pages (Latin-1 -> Mac and DOS)
|
Histogram creation.
|
||||||
improve API by hiding the info_ptr
|
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||||
|
Improve API by hiding the info_ptr.
|
||||||
|
10
example.c
10
example.c
@ -221,10 +221,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
if (png_get_sRGB(png_ptr, info_ptr, &intent))
|
if (png_get_sRGB(png_ptr, info_ptr, &intent))
|
||||||
png_set_sRGB(png_ptr, intent, 0);
|
png_set_sRGB(png_ptr, intent, 0);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
double image_gamma;
|
||||||
if (png_get_gAMA(png_ptr, info_ptr, &image_gamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &image_gamma))
|
||||||
png_set_gamma(png_ptr, screen_gamma, image_gamma);
|
png_set_gamma(png_ptr, screen_gamma, image_gamma);
|
||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, screen_gamma, 0.50);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
|
}
|
||||||
|
|
||||||
/* Dither RGB files down to 8 bit palette or reduce palettes
|
/* Dither RGB files down to 8 bit palette or reduce palettes
|
||||||
* to the number of colors available on your screen.
|
* to the number of colors available on your screen.
|
||||||
@ -384,8 +387,11 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this one's new. You will need to provide all three
|
/* This one's new. You will need to provide all three
|
||||||
* function callbacks, even if you aren't using them all.
|
* function callbacks, even if you aren't using them all.
|
||||||
|
* If you aren't using all functions, you can specify NULL
|
||||||
|
* parameters. Even when all three functions are NULL,
|
||||||
|
* you need to call png_set_progressive_read_fn().
|
||||||
* These functions shouldn't be dependent on global or
|
* These functions shouldn't be dependent on global or
|
||||||
* static variables if you are decoding several images
|
* static variables if you are decoding several images
|
||||||
* simultaneously. You should store stream specific data
|
* simultaneously. You should store stream specific data
|
||||||
|
169
libpng.3
169
libpng.3
@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNG 3 "June 14, 1998"
|
.TH LIBPNG 3 "December 29, 1998"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.2 - June 14, 1998
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.2a - December 29, 1998
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
@ -27,7 +27,7 @@ png_structp png_create_read_struct (png_const_charp
|
|||||||
user_png_ver, voidp error_ptr, png_error_ptr error_fn,
|
user_png_ver, voidp error_ptr, png_error_ptr error_fn,
|
||||||
png_error_ptr warn_fn);
|
png_error_ptr warn_fn);
|
||||||
|
|
||||||
png_create_read_struct_2(png_const_charp user_png_ver,
|
png_structp png_create_read_struct_2(png_const_charp user_png_ver,
|
||||||
png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr
|
png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr
|
||||||
warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn,
|
warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn,
|
||||||
png_free_ptr free_fn)
|
png_free_ptr free_fn)
|
||||||
@ -41,8 +41,11 @@ user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
|
|||||||
png_error_ptr warn_fn, png_voidp mem_ptr,
|
png_error_ptr warn_fn, png_voidp mem_ptr,
|
||||||
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
|
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
|
||||||
|
|
||||||
png_voidp png_debug_malloc (png_structp png_ptr, png_uint_32
|
int png_debug(int level, png_const_charp message)
|
||||||
size);
|
|
||||||
|
int png_debug1(int level, png_const_charp message, p1)
|
||||||
|
|
||||||
|
int png_debug2(int level, png_const_charp message, p1, p2)
|
||||||
|
|
||||||
void png_destroy_info_struct (png_structp png_ptr, png_infopp
|
void png_destroy_info_struct (png_structp png_ptr, png_infopp
|
||||||
info_ptr_ptr);
|
info_ptr_ptr);
|
||||||
@ -79,6 +82,8 @@ info_ptr);
|
|||||||
png_byte png_get_compression_type (png_structp png_ptr,
|
png_byte png_get_compression_type (png_structp png_ptr,
|
||||||
png_infop info_ptr);
|
png_infop info_ptr);
|
||||||
|
|
||||||
|
png_byte png_get_copyright (png_structp png_ptr);
|
||||||
|
|
||||||
png_voidp png_get_error_ptr (png_structp png_ptr);
|
png_voidp png_get_error_ptr (png_structp png_ptr);
|
||||||
|
|
||||||
png_byte png_get_filter_type (png_structp png_ptr, png_infop
|
png_byte png_get_filter_type (png_structp png_ptr, png_infop
|
||||||
@ -87,6 +92,8 @@ info_ptr);
|
|||||||
png_uint_32 png_get_gAMA (png_structp png_ptr, png_infop
|
png_uint_32 png_get_gAMA (png_structp png_ptr, png_infop
|
||||||
info_ptr, double *file_gamma);
|
info_ptr, double *file_gamma);
|
||||||
|
|
||||||
|
png_byte png_get_header_version (png_structp png_ptr);
|
||||||
|
|
||||||
png_uint_32 png_get_hIST (png_structp png_ptr, png_infop
|
png_uint_32 png_get_hIST (png_structp png_ptr, png_infop
|
||||||
info_ptr, png_uint_16p *hist);
|
info_ptr, png_uint_16p *hist);
|
||||||
|
|
||||||
@ -131,6 +138,8 @@ png_voidp png_get_progressive_ptr (png_structp png_ptr);
|
|||||||
png_uint_32 png_get_PLTE (png_structp png_ptr, png_infop
|
png_uint_32 png_get_PLTE (png_structp png_ptr, png_infop
|
||||||
info_ptr, png_colorp *palette, int *num_palette);
|
info_ptr, png_colorp *palette, int *num_palette);
|
||||||
|
|
||||||
|
png_byte png_get_rgb_to_gray_status (png_structp png_ptr)
|
||||||
|
|
||||||
png_uint_32 png_get_rowbytes (png_structp png_ptr, png_infop
|
png_uint_32 png_get_rowbytes (png_structp png_ptr, png_infop
|
||||||
info_ptr);
|
info_ptr);
|
||||||
|
|
||||||
@ -325,7 +334,7 @@ read_row_fn);
|
|||||||
void png_set_read_user_transform_fn (png_structp png_ptr,
|
void png_set_read_user_transform_fn (png_structp png_ptr,
|
||||||
png_user_transform_ptr read_user_transform_fn);
|
png_user_transform_ptr read_user_transform_fn);
|
||||||
|
|
||||||
void png_set_rgb_to_gray (png_structp png_ptr);
|
void png_set_rgb_to_gray (png_structp png_ptr, int error_action);
|
||||||
|
|
||||||
void png_set_sBIT (png_structp png_ptr, png_infop info_ptr,
|
void png_set_sBIT (png_structp png_ptr, png_infop info_ptr,
|
||||||
png_color_8p sig_bit);
|
png_color_8p sig_bit);
|
||||||
@ -414,7 +423,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
|
|||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.0.2 - June 14, 1998
|
libpng version 1.0.2a - December 29, 1998
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<randeg@alumni.rpi.edu>
|
<randeg@alumni.rpi.edu>
|
||||||
Copyright (c) 1998, Glenn Randers-Pehrson
|
Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
@ -454,7 +463,8 @@ as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/> and as a
|
|||||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
|
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
|
||||||
additional chunks are described in the special-purpose public chunks
|
additional chunks are described in the special-purpose public chunks
|
||||||
documents at <ftp://ftp.uu.net/graphics/png/documents/>. Other information
|
documents at <ftp://ftp.uu.net/graphics/png/documents/>. Other information
|
||||||
about PNG can be found at the PNG home page, <http://www.cdrom.com/pub/png/>.
|
about PNG, and the latest version of libpng, can be found at the PNG home
|
||||||
|
page, <http://www.cdrom.com/pub/png/>.
|
||||||
|
|
||||||
Most users will not have to modify the library significantly; advanced
|
Most users will not have to modify the library significantly; advanced
|
||||||
users may want to modify it more. All attempts were made to make it as
|
users may want to modify it more. All attempts were made to make it as
|
||||||
@ -471,6 +481,8 @@ work to be done (see the TODO file), libpng should cover the
|
|||||||
majority of the needs of its users.
|
majority of the needs of its users.
|
||||||
|
|
||||||
Libpng uses zlib for its compression and decompression of PNG files.
|
Libpng uses zlib for its compression and decompression of PNG files.
|
||||||
|
Further information about zlib, and the latest version of zlib, can
|
||||||
|
be found at the zlib home page, <http://www.cdrom.com/pub/infozip/zlib/>.
|
||||||
The zlib compression utility is a general purpose utility that is
|
The zlib compression utility is a general purpose utility that is
|
||||||
useful for more than PNG files, and can be used without libpng.
|
useful for more than PNG files, and can be used without libpng.
|
||||||
See the documentation delivered with zlib for more details.
|
See the documentation delivered with zlib for more details.
|
||||||
@ -593,8 +605,8 @@ are only necessary if you are not using the libpng supplied error
|
|||||||
handling and memory alloc/free functions.
|
handling and memory alloc/free functions.
|
||||||
|
|
||||||
When libpng encounters an error, it expects to longjmp back
|
When libpng encounters an error, it expects to longjmp back
|
||||||
to your routine. Therefore, you will need to call setjmp and pass the
|
to your routine. Therefore, you will need to call setjmp and pass
|
||||||
jmpbuf field of your png_struct. If you read the file from different
|
your png_ptr->jmpbuf. If you read the file from different
|
||||||
routines, you will need to update the jmpbuf field every time you enter
|
routines, you will need to update the jmpbuf field every time you enter
|
||||||
a new routine that will call a png_ function.
|
a new routine that will call a png_ function.
|
||||||
|
|
||||||
@ -1002,6 +1014,63 @@ RGB. This code will do that conversion:
|
|||||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
png_set_gray_to_rgb(png_ptr);
|
png_set_gray_to_rgb(png_ptr);
|
||||||
|
|
||||||
|
Conversely, you can convert an RGB or RGBA image to grayscale or grayscale
|
||||||
|
with alpha. This is intended for conversion of images that really are
|
||||||
|
gray (red == green == blue), so the function simply strips out the red
|
||||||
|
and blue channels, leaving the green channel in the gray position.
|
||||||
|
|
||||||
|
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
|
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
png_set_rgb_to_gray(png_ptr, error_action,
|
||||||
|
float red_weight, float green_weight);
|
||||||
|
|
||||||
|
error_action = 1: silently do the conversion
|
||||||
|
error_action = 2: issue a warning if the original
|
||||||
|
image has any pixel where
|
||||||
|
red != green or red != blue
|
||||||
|
error_action = 3: issue an error and abort the
|
||||||
|
conversion if the original
|
||||||
|
image has any pixel where
|
||||||
|
red != green or red != blue
|
||||||
|
|
||||||
|
red_weight: weight of red component
|
||||||
|
(NULL -> default 54/256)
|
||||||
|
green_weight: weight of green component
|
||||||
|
(NULL -> default 183/256)
|
||||||
|
|
||||||
|
If you have set error_action = 1 or 2, you can
|
||||||
|
later check whether the image really was gray, after processing
|
||||||
|
the image rows, with the png_get_rgb_to_gray_status(png_ptr) function.
|
||||||
|
It will return a png_byte that is zero if the image was gray or
|
||||||
|
1 if there were any non-gray pixels. bKGD and sBIT data
|
||||||
|
will be silently converted to grayscale, using the green channel
|
||||||
|
data, regardless of the error_action setting.
|
||||||
|
|
||||||
|
With 0.0<=red_weight+green_weight<=1.0,
|
||||||
|
the normalized graylevel is computed:
|
||||||
|
|
||||||
|
int rw = red_weight * 256;
|
||||||
|
int gw = green_weight * 256;
|
||||||
|
int bw = 256 - (rw + gw);
|
||||||
|
gray = (rw*red + gw*green + bw*blue)/256;
|
||||||
|
|
||||||
|
The default values approximate those recommended in the Charles
|
||||||
|
Poynton's Color FAQ, <http://www.inforamp.net/~poynton/>
|
||||||
|
Copyright (c) 1998-01-04 Charles Poynton poynton@inforamp.net
|
||||||
|
|
||||||
|
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
|
||||||
|
|
||||||
|
Libpng approximates this with
|
||||||
|
|
||||||
|
Y = 0.211 * R + 0.715 * G + 0.074 * B
|
||||||
|
|
||||||
|
which can be expressed with integers as
|
||||||
|
|
||||||
|
Y = (54 * R + 183 * G + 19 * B)/256
|
||||||
|
|
||||||
|
The calculation is done in a linear colorspace, if the image gamma
|
||||||
|
is known.
|
||||||
|
|
||||||
If you have a grayscale and you are using png_set_expand() to change to
|
If you have a grayscale and you are using png_set_expand() to change to
|
||||||
a higher bit-depth, you must either supply the background color as a gray
|
a higher bit-depth, you must either supply the background color as a gray
|
||||||
value at the original file bit-depth (need_expand = 1) or else supply the
|
value at the original file bit-depth (need_expand = 1) or else supply the
|
||||||
@ -1061,7 +1130,7 @@ compensation other than the display_gamma is needed (viewing_gamma=1.0).
|
|||||||
The png_set_gamma() function handles gamma transformations of the data.
|
The png_set_gamma() function handles gamma transformations of the data.
|
||||||
Pass both the file gamma and the current screen_gamma. If the file does
|
Pass both the file gamma and the current screen_gamma. If the file does
|
||||||
not have a gamma value, you can pass one anyway if you have an idea what
|
not have a gamma value, you can pass one anyway if you have an idea what
|
||||||
it is (usually 0.50 is a good guess for GIF images on PCs). Note
|
it is (usually 0.45455 is a good guess for GIF images on PCs). Note
|
||||||
that file gammas are inverted from screen gammas. See the discussions
|
that file gammas are inverted from screen gammas. See the discussions
|
||||||
on gamma in the PNG specification for an excellent description of what
|
on gamma in the PNG specification for an excellent description of what
|
||||||
gamma is, and why all applications should support it. It is strongly
|
gamma is, and why all applications should support it. It is strongly
|
||||||
@ -1070,7 +1139,7 @@ recommended that PNG viewers support gamma correction.
|
|||||||
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
||||||
png_set_gamma(png_ptr, screen_gamma, gamma);
|
png_set_gamma(png_ptr, screen_gamma, gamma);
|
||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, screen_gamma, 0.50);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
|
|
||||||
If you need to reduce an RGB file to a paletted file, or if a paletted
|
If you need to reduce an RGB file to a paletted file, or if a paletted
|
||||||
file has more entries then will fit on your screen, png_set_dither()
|
file has more entries then will fit on your screen, png_set_dither()
|
||||||
@ -1321,7 +1390,9 @@ png_infop info_ptr;
|
|||||||
to be called when the header info is valid,
|
to be called when the header info is valid,
|
||||||
when each row is completed, and when the image
|
when each row is completed, and when the image
|
||||||
is finished. If you aren't using all functions,
|
is finished. If you aren't using all functions,
|
||||||
you can specify a NULL parameter. You can use
|
you can specify NULL parameters. Even when all
|
||||||
|
three functions are NULL, you need to call
|
||||||
|
png_set_progressive_read_fn(). You can use
|
||||||
any struct as the user_ptr (cast to a void pointer
|
any struct as the user_ptr (cast to a void pointer
|
||||||
for the function call), and retrieve the pointer
|
for the function call), and retrieve the pointer
|
||||||
from inside the callbacks using the function
|
from inside the callbacks using the function
|
||||||
@ -1367,7 +1438,7 @@ png_infop info_ptr;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called (as set by
|
/* This function is called (as set by
|
||||||
png_set_progressive_fn() above) when enough data
|
png_set_progressive_read_fn() above) when enough data
|
||||||
has been supplied so all of the header has been
|
has been supplied so all of the header has been
|
||||||
read.
|
read.
|
||||||
*/
|
*/
|
||||||
@ -1495,7 +1566,7 @@ png_create_write_struct_2() instead of png_create_read_struct():
|
|||||||
After you have these structures, you will need to set up the
|
After you have these structures, you will need to set up the
|
||||||
error handling. When libpng encounters an error, it expects to
|
error handling. When libpng encounters an error, it expects to
|
||||||
longjmp() back to your routine. Therefore, you will need to call
|
longjmp() back to your routine. Therefore, you will need to call
|
||||||
setjmp and pass the jmpbuf field of your png_struct. If you
|
setjmp() and pass the png_ptr->jmpbuf. If you
|
||||||
write the file from different routines, you will need to update
|
write the file from different routines, you will need to update
|
||||||
the jmpbuf field every time you enter a new routine that will
|
the jmpbuf field every time you enter a new routine that will
|
||||||
call a png_ function. See your documentation of setjmp/longjmp
|
call a png_ function. See your documentation of setjmp/longjmp
|
||||||
@ -1509,6 +1580,8 @@ section below for more information on the libpng error handling.
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
...
|
||||||
|
return;
|
||||||
|
|
||||||
Now you need to set up the output code. The default for libpng is to
|
Now you need to set up the output code. The default for libpng is to
|
||||||
use the C function fwrite(). If you use this, you will need to pass a
|
use the C function fwrite(). If you use this, you will need to pass a
|
||||||
@ -1739,7 +1812,7 @@ png_text structure holds a keyword-text value, and a compression type.
|
|||||||
The compression types have the same valid numbers as the compression
|
The compression types have the same valid numbers as the compression
|
||||||
types of the image data. Currently, the only valid number is zero.
|
types of the image data. Currently, the only valid number is zero.
|
||||||
However, you can store text either compressed or uncompressed, unlike
|
However, you can store text either compressed or uncompressed, unlike
|
||||||
images which always have to be compressed. So if you don't want the
|
images, which always have to be compressed. So if you don't want the
|
||||||
text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE.
|
text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE.
|
||||||
Until text gets around 1000 bytes, it is not worth compressing it.
|
Until text gets around 1000 bytes, it is not worth compressing it.
|
||||||
After the text has been written out to the file, the compression type
|
After the text has been written out to the file, the compression type
|
||||||
@ -1799,7 +1872,7 @@ depending on whether you mean the PNG file, the time the image was
|
|||||||
created in a non-PNG format, a still photo from which the image was
|
created in a non-PNG format, a still photo from which the image was
|
||||||
scanned, or possibly the subject matter itself. In order to facilitate
|
scanned, or possibly the subject matter itself. In order to facilitate
|
||||||
machine-readable dates, it is recommended that the "Creation Time"
|
machine-readable dates, it is recommended that the "Creation Time"
|
||||||
tEXt chunk use RFC 1123 format dates (e.g. 22 May 1997 18:07:10 GMT"),
|
tEXt chunk use RFC 1123 format dates (e.g. "22 May 1997 18:07:10 GMT"),
|
||||||
although this isn't a requirement. Unlike the tIME chunk, the
|
although this isn't a requirement. Unlike the tIME chunk, the
|
||||||
"Creation Time" tEXt chunk is not expected to be automatically changed
|
"Creation Time" tEXt chunk is not expected to be automatically changed
|
||||||
by the software. To facilitate the use of RFC 1123 dates, a function
|
by the software. To facilitate the use of RFC 1123 dates, a function
|
||||||
@ -2017,7 +2090,7 @@ The second deals with more complicated things like adding new chunks,
|
|||||||
adding new transformations, and generally changing how libpng works.
|
adding new transformations, and generally changing how libpng works.
|
||||||
|
|
||||||
All of the memory allocation, input/output, and error handling in libpng
|
All of the memory allocation, input/output, and error handling in libpng
|
||||||
goes through callbacks which are user settable. The default routines are
|
goes through callbacks that are user settable. The default routines are
|
||||||
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
|
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
|
||||||
these functions, call the appropriate png_set_???_fn() function.
|
these functions, call the appropriate png_set_???_fn() function.
|
||||||
|
|
||||||
@ -2126,7 +2199,7 @@ won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
|
|||||||
|
|
||||||
Configuring for DOS:
|
Configuring for DOS:
|
||||||
|
|
||||||
For DOS users which only have access to the lower 640K, you will
|
For DOS users who only have access to the lower 640K, you will
|
||||||
have to limit zlib's memory usage via a png_set_compression_mem_level()
|
have to limit zlib's memory usage via a png_set_compression_mem_level()
|
||||||
call. See zlib.h or zconf.h in the zlib library for more information.
|
call. See zlib.h or zconf.h in the zlib library for more information.
|
||||||
|
|
||||||
@ -2138,7 +2211,7 @@ defined, and FAR gets defined to far in pngconf.h, and you should be
|
|||||||
all set. Everything in the library (except for zlib's structure) is
|
all set. Everything in the library (except for zlib's structure) is
|
||||||
expecting far data. You must use the typedefs with the p or pp on
|
expecting far data. You must use the typedefs with the p or pp on
|
||||||
the end for pointers (or at least look at them and be careful). Make
|
the end for pointers (or at least look at them and be careful). Make
|
||||||
note that the row's of data are defined as png_bytepp which is a
|
note that the row's of data are defined as png_bytepp, which is an
|
||||||
unsigned char far * far *.
|
unsigned char far * far *.
|
||||||
|
|
||||||
Configuring for gui/windowing platforms:
|
Configuring for gui/windowing platforms:
|
||||||
@ -2198,8 +2271,8 @@ can call one of these functions. The selection and configuration
|
|||||||
of row filters can have a significant impact on the size and
|
of row filters can have a significant impact on the size and
|
||||||
encoding speed and a somewhat lesser impact on the decoding speed
|
encoding speed and a somewhat lesser impact on the decoding speed
|
||||||
of an image. Filtering is enabled by default for RGB and grayscale
|
of an image. Filtering is enabled by default for RGB and grayscale
|
||||||
images (with and without alpha), and for 8-bit paletted images, but
|
images (with and without alpha), but not for paletted images nor
|
||||||
not for paletted images with bit depths less than 8 bits/pixel.
|
for any images with bit depths less than 8 bits/pixel.
|
||||||
|
|
||||||
The 'method' parameter sets the main filtering method, which is
|
The 'method' parameter sets the main filtering method, which is
|
||||||
currently only '0' in the PNG 1.0 specification. The 'filters'
|
currently only '0' in the PNG 1.0 specification. The 'filters'
|
||||||
@ -2234,10 +2307,10 @@ by telling it the relative computational costs of the filters.
|
|||||||
PNG_FILTER_SELECTION_WEIGHTED, 3,
|
PNG_FILTER_SELECTION_WEIGHTED, 3,
|
||||||
weights, costs);
|
weights, costs);
|
||||||
|
|
||||||
The weights are multiplying factors which indicate to libpng that row
|
The weights are multiplying factors that indicate to libpng that the
|
||||||
should be the same for successive rows unless another row filter is that
|
row filter should be the same for successive rows unless another row filter
|
||||||
many times better than the previous filter. In the above example, if
|
is that many times better than the previous filter. In the above example,
|
||||||
the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a
|
if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a
|
||||||
"sum of absolute differences" 1.5 x 1.3 times higher than other filters
|
"sum of absolute differences" 1.5 x 1.3 times higher than other filters
|
||||||
and still be chosen, while the NONE filter could have a sum 1.1 times
|
and still be chosen, while the NONE filter could have a sum 1.1 times
|
||||||
higher than other filters and still be chosen. Unspecified weights are
|
higher than other filters and still be chosen. Unspecified weights are
|
||||||
@ -2292,10 +2365,46 @@ or DLL file), you should not remove or disable any parts of the library,
|
|||||||
as this will cause applications linked with different versions of the
|
as this will cause applications linked with different versions of the
|
||||||
library to fail if they call functions not available in your library.
|
library to fail if they call functions not available in your library.
|
||||||
The size of the library itself should not be an issue, because only
|
The size of the library itself should not be an issue, because only
|
||||||
those sections which are actually used will be loaded into memory.
|
those sections that are actually used will be loaded into memory.
|
||||||
|
|
||||||
|
Requesting debug printout:
|
||||||
|
|
||||||
Changes to Libpng from version 0.88
|
The macro definition PNG_DEBUG can be used to request debugging
|
||||||
|
printout. Set it to an integer value in the range 0 to 3. Higher
|
||||||
|
numbers result in increasing amounts of debugging information. The
|
||||||
|
information is printed to the "stderr" file, unless another file
|
||||||
|
name is specified in the PNG_DEBUG_FILE macro definition.
|
||||||
|
|
||||||
|
When PNG_DEBUG > 0, the following functions (macros) become available:
|
||||||
|
|
||||||
|
png_debug(level, message)
|
||||||
|
png_debug1(level, message, p1)
|
||||||
|
png_debug2(level, message, p1, p2)
|
||||||
|
|
||||||
|
in which "level" is compared to PNG_DEBUG to decide whether to print
|
||||||
|
the message, "message" is the formatted string to be printed,
|
||||||
|
and p1 and p2 are parameters that are to be embedded in the string
|
||||||
|
according to printf-style formatting directives. For example,
|
||||||
|
|
||||||
|
png_debug1(2, "foo=%d\n", foo);
|
||||||
|
|
||||||
|
is expanded to
|
||||||
|
|
||||||
|
if(PNG_DEBUG > 2)
|
||||||
|
fprintf(PNG_DEBUG_FILE, "foo=%d\n", foo);
|
||||||
|
|
||||||
|
When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
|
||||||
|
can still use PNG_DEBUG to control your own debugging:
|
||||||
|
|
||||||
|
#ifdef PNG_DEBUG
|
||||||
|
fprintf(stderr, ...
|
||||||
|
#endif
|
||||||
|
|
||||||
|
When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
||||||
|
having level = 0 will be printed. There aren't any such statements in
|
||||||
|
this version of libpng, but if you insert some they will be printed.
|
||||||
|
|
||||||
|
.SH VI. Changes to Libpng from version 0.88
|
||||||
|
|
||||||
It should be noted that versions of libpng later than 0.96 are not
|
It should be noted that versions of libpng later than 0.96 are not
|
||||||
distributed by the original libpng author, Guy Schalnat, nor by
|
distributed by the original libpng author, Guy Schalnat, nor by
|
||||||
@ -2321,7 +2430,7 @@ allocating and freeing the png_struct for each image read.
|
|||||||
|
|
||||||
Setting the error callbacks via png_set_message_fn() before
|
Setting the error callbacks via png_set_message_fn() before
|
||||||
png_read_init() as was suggested in libpng-0.88 is no longer supported
|
png_read_init() as was suggested in libpng-0.88 is no longer supported
|
||||||
because this caused applications which do not use custom error functions
|
because this caused applications that do not use custom error functions
|
||||||
to fail if the png_ptr was not initialized to zero. It is still possible
|
to fail if the png_ptr was not initialized to zero. It is still possible
|
||||||
to set the error callbacks AFTER png_read_init(), or to change them with
|
to set the error callbacks AFTER png_read_init(), or to change them with
|
||||||
png_set_error_fn(), which is essentially the same function, but with a
|
png_set_error_fn(), which is essentially the same function, but with a
|
||||||
@ -2413,7 +2522,7 @@ possible without all of you.
|
|||||||
|
|
||||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
|
||||||
Libpng version 1.0.2 - June 14, 1998:
|
Libpng version 1.0.2a - December 29, 1998:
|
||||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||||
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).
|
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).
|
||||||
|
|
||||||
|
146
libpng.txt
146
libpng.txt
@ -1,6 +1,6 @@
|
|||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.0.2 - June 14, 1998
|
libpng version 1.0.2a - December 29, 1998
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<randeg@alumni.rpi.edu>
|
<randeg@alumni.rpi.edu>
|
||||||
Copyright (c) 1998, Glenn Randers-Pehrson
|
Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
@ -40,7 +40,8 @@ as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/> and as a
|
|||||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
|
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
|
||||||
additional chunks are described in the special-purpose public chunks
|
additional chunks are described in the special-purpose public chunks
|
||||||
documents at <ftp://ftp.uu.net/graphics/png/documents/>. Other information
|
documents at <ftp://ftp.uu.net/graphics/png/documents/>. Other information
|
||||||
about PNG can be found at the PNG home page, <http://www.cdrom.com/pub/png/>.
|
about PNG, and the latest version of libpng, can be found at the PNG home
|
||||||
|
page, <http://www.cdrom.com/pub/png/>.
|
||||||
|
|
||||||
Most users will not have to modify the library significantly; advanced
|
Most users will not have to modify the library significantly; advanced
|
||||||
users may want to modify it more. All attempts were made to make it as
|
users may want to modify it more. All attempts were made to make it as
|
||||||
@ -57,6 +58,8 @@ work to be done (see the TODO file), libpng should cover the
|
|||||||
majority of the needs of its users.
|
majority of the needs of its users.
|
||||||
|
|
||||||
Libpng uses zlib for its compression and decompression of PNG files.
|
Libpng uses zlib for its compression and decompression of PNG files.
|
||||||
|
Further information about zlib, and the latest version of zlib, can
|
||||||
|
be found at the zlib home page, <http://www.cdrom.com/pub/infozip/zlib/>.
|
||||||
The zlib compression utility is a general purpose utility that is
|
The zlib compression utility is a general purpose utility that is
|
||||||
useful for more than PNG files, and can be used without libpng.
|
useful for more than PNG files, and can be used without libpng.
|
||||||
See the documentation delivered with zlib for more details.
|
See the documentation delivered with zlib for more details.
|
||||||
@ -179,8 +182,8 @@ are only necessary if you are not using the libpng supplied error
|
|||||||
handling and memory alloc/free functions.
|
handling and memory alloc/free functions.
|
||||||
|
|
||||||
When libpng encounters an error, it expects to longjmp back
|
When libpng encounters an error, it expects to longjmp back
|
||||||
to your routine. Therefore, you will need to call setjmp and pass the
|
to your routine. Therefore, you will need to call setjmp and pass
|
||||||
jmpbuf field of your png_struct. If you read the file from different
|
your png_ptr->jmpbuf. If you read the file from different
|
||||||
routines, you will need to update the jmpbuf field every time you enter
|
routines, you will need to update the jmpbuf field every time you enter
|
||||||
a new routine that will call a png_ function.
|
a new routine that will call a png_ function.
|
||||||
|
|
||||||
@ -588,6 +591,63 @@ RGB. This code will do that conversion:
|
|||||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
png_set_gray_to_rgb(png_ptr);
|
png_set_gray_to_rgb(png_ptr);
|
||||||
|
|
||||||
|
Conversely, you can convert an RGB or RGBA image to grayscale or grayscale
|
||||||
|
with alpha. This is intended for conversion of images that really are
|
||||||
|
gray (red == green == blue), so the function simply strips out the red
|
||||||
|
and blue channels, leaving the green channel in the gray position.
|
||||||
|
|
||||||
|
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
|
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
png_set_rgb_to_gray(png_ptr, error_action,
|
||||||
|
float red_weight, float green_weight);
|
||||||
|
|
||||||
|
error_action = 1: silently do the conversion
|
||||||
|
error_action = 2: issue a warning if the original
|
||||||
|
image has any pixel where
|
||||||
|
red != green or red != blue
|
||||||
|
error_action = 3: issue an error and abort the
|
||||||
|
conversion if the original
|
||||||
|
image has any pixel where
|
||||||
|
red != green or red != blue
|
||||||
|
|
||||||
|
red_weight: weight of red component
|
||||||
|
(NULL -> default 54/256)
|
||||||
|
green_weight: weight of green component
|
||||||
|
(NULL -> default 183/256)
|
||||||
|
|
||||||
|
If you have set error_action = 1 or 2, you can
|
||||||
|
later check whether the image really was gray, after processing
|
||||||
|
the image rows, with the png_get_rgb_to_gray_status(png_ptr) function.
|
||||||
|
It will return a png_byte that is zero if the image was gray or
|
||||||
|
1 if there were any non-gray pixels. bKGD and sBIT data
|
||||||
|
will be silently converted to grayscale, using the green channel
|
||||||
|
data, regardless of the error_action setting.
|
||||||
|
|
||||||
|
With 0.0<=red_weight+green_weight<=1.0,
|
||||||
|
the normalized graylevel is computed:
|
||||||
|
|
||||||
|
int rw = red_weight * 256;
|
||||||
|
int gw = green_weight * 256;
|
||||||
|
int bw = 256 - (rw + gw);
|
||||||
|
gray = (rw*red + gw*green + bw*blue)/256;
|
||||||
|
|
||||||
|
The default values approximate those recommended in the Charles
|
||||||
|
Poynton's Color FAQ, <http://www.inforamp.net/~poynton/>
|
||||||
|
Copyright (c) 1998-01-04 Charles Poynton poynton@inforamp.net
|
||||||
|
|
||||||
|
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
|
||||||
|
|
||||||
|
Libpng approximates this with
|
||||||
|
|
||||||
|
Y = 0.211 * R + 0.715 * G + 0.074 * B
|
||||||
|
|
||||||
|
which can be expressed with integers as
|
||||||
|
|
||||||
|
Y = (54 * R + 183 * G + 19 * B)/256
|
||||||
|
|
||||||
|
The calculation is done in a linear colorspace, if the image gamma
|
||||||
|
is known.
|
||||||
|
|
||||||
If you have a grayscale and you are using png_set_expand() to change to
|
If you have a grayscale and you are using png_set_expand() to change to
|
||||||
a higher bit-depth, you must either supply the background color as a gray
|
a higher bit-depth, you must either supply the background color as a gray
|
||||||
value at the original file bit-depth (need_expand = 1) or else supply the
|
value at the original file bit-depth (need_expand = 1) or else supply the
|
||||||
@ -647,7 +707,7 @@ compensation other than the display_gamma is needed (viewing_gamma=1.0).
|
|||||||
The png_set_gamma() function handles gamma transformations of the data.
|
The png_set_gamma() function handles gamma transformations of the data.
|
||||||
Pass both the file gamma and the current screen_gamma. If the file does
|
Pass both the file gamma and the current screen_gamma. If the file does
|
||||||
not have a gamma value, you can pass one anyway if you have an idea what
|
not have a gamma value, you can pass one anyway if you have an idea what
|
||||||
it is (usually 0.50 is a good guess for GIF images on PCs). Note
|
it is (usually 0.45455 is a good guess for GIF images on PCs). Note
|
||||||
that file gammas are inverted from screen gammas. See the discussions
|
that file gammas are inverted from screen gammas. See the discussions
|
||||||
on gamma in the PNG specification for an excellent description of what
|
on gamma in the PNG specification for an excellent description of what
|
||||||
gamma is, and why all applications should support it. It is strongly
|
gamma is, and why all applications should support it. It is strongly
|
||||||
@ -656,7 +716,7 @@ recommended that PNG viewers support gamma correction.
|
|||||||
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
||||||
png_set_gamma(png_ptr, screen_gamma, gamma);
|
png_set_gamma(png_ptr, screen_gamma, gamma);
|
||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, screen_gamma, 0.50);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
|
|
||||||
If you need to reduce an RGB file to a paletted file, or if a paletted
|
If you need to reduce an RGB file to a paletted file, or if a paletted
|
||||||
file has more entries then will fit on your screen, png_set_dither()
|
file has more entries then will fit on your screen, png_set_dither()
|
||||||
@ -907,7 +967,9 @@ png_infop info_ptr;
|
|||||||
to be called when the header info is valid,
|
to be called when the header info is valid,
|
||||||
when each row is completed, and when the image
|
when each row is completed, and when the image
|
||||||
is finished. If you aren't using all functions,
|
is finished. If you aren't using all functions,
|
||||||
you can specify a NULL parameter. You can use
|
you can specify NULL parameters. Even when all
|
||||||
|
three functions are NULL, you need to call
|
||||||
|
png_set_progressive_read_fn(). You can use
|
||||||
any struct as the user_ptr (cast to a void pointer
|
any struct as the user_ptr (cast to a void pointer
|
||||||
for the function call), and retrieve the pointer
|
for the function call), and retrieve the pointer
|
||||||
from inside the callbacks using the function
|
from inside the callbacks using the function
|
||||||
@ -953,7 +1015,7 @@ png_infop info_ptr;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called (as set by
|
/* This function is called (as set by
|
||||||
png_set_progressive_fn() above) when enough data
|
png_set_progressive_read_fn() above) when enough data
|
||||||
has been supplied so all of the header has been
|
has been supplied so all of the header has been
|
||||||
read.
|
read.
|
||||||
*/
|
*/
|
||||||
@ -1081,7 +1143,7 @@ png_create_write_struct_2() instead of png_create_read_struct():
|
|||||||
After you have these structures, you will need to set up the
|
After you have these structures, you will need to set up the
|
||||||
error handling. When libpng encounters an error, it expects to
|
error handling. When libpng encounters an error, it expects to
|
||||||
longjmp() back to your routine. Therefore, you will need to call
|
longjmp() back to your routine. Therefore, you will need to call
|
||||||
setjmp and pass the jmpbuf field of your png_struct. If you
|
setjmp() and pass the png_ptr->jmpbuf. If you
|
||||||
write the file from different routines, you will need to update
|
write the file from different routines, you will need to update
|
||||||
the jmpbuf field every time you enter a new routine that will
|
the jmpbuf field every time you enter a new routine that will
|
||||||
call a png_ function. See your documentation of setjmp/longjmp
|
call a png_ function. See your documentation of setjmp/longjmp
|
||||||
@ -1095,6 +1157,8 @@ section below for more information on the libpng error handling.
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
...
|
||||||
|
return;
|
||||||
|
|
||||||
Now you need to set up the output code. The default for libpng is to
|
Now you need to set up the output code. The default for libpng is to
|
||||||
use the C function fwrite(). If you use this, you will need to pass a
|
use the C function fwrite(). If you use this, you will need to pass a
|
||||||
@ -1325,7 +1389,7 @@ png_text structure holds a keyword-text value, and a compression type.
|
|||||||
The compression types have the same valid numbers as the compression
|
The compression types have the same valid numbers as the compression
|
||||||
types of the image data. Currently, the only valid number is zero.
|
types of the image data. Currently, the only valid number is zero.
|
||||||
However, you can store text either compressed or uncompressed, unlike
|
However, you can store text either compressed or uncompressed, unlike
|
||||||
images which always have to be compressed. So if you don't want the
|
images, which always have to be compressed. So if you don't want the
|
||||||
text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE.
|
text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE.
|
||||||
Until text gets around 1000 bytes, it is not worth compressing it.
|
Until text gets around 1000 bytes, it is not worth compressing it.
|
||||||
After the text has been written out to the file, the compression type
|
After the text has been written out to the file, the compression type
|
||||||
@ -1385,7 +1449,7 @@ depending on whether you mean the PNG file, the time the image was
|
|||||||
created in a non-PNG format, a still photo from which the image was
|
created in a non-PNG format, a still photo from which the image was
|
||||||
scanned, or possibly the subject matter itself. In order to facilitate
|
scanned, or possibly the subject matter itself. In order to facilitate
|
||||||
machine-readable dates, it is recommended that the "Creation Time"
|
machine-readable dates, it is recommended that the "Creation Time"
|
||||||
tEXt chunk use RFC 1123 format dates (e.g. 22 May 1997 18:07:10 GMT"),
|
tEXt chunk use RFC 1123 format dates (e.g. "22 May 1997 18:07:10 GMT"),
|
||||||
although this isn't a requirement. Unlike the tIME chunk, the
|
although this isn't a requirement. Unlike the tIME chunk, the
|
||||||
"Creation Time" tEXt chunk is not expected to be automatically changed
|
"Creation Time" tEXt chunk is not expected to be automatically changed
|
||||||
by the software. To facilitate the use of RFC 1123 dates, a function
|
by the software. To facilitate the use of RFC 1123 dates, a function
|
||||||
@ -1603,7 +1667,7 @@ The second deals with more complicated things like adding new chunks,
|
|||||||
adding new transformations, and generally changing how libpng works.
|
adding new transformations, and generally changing how libpng works.
|
||||||
|
|
||||||
All of the memory allocation, input/output, and error handling in libpng
|
All of the memory allocation, input/output, and error handling in libpng
|
||||||
goes through callbacks which are user settable. The default routines are
|
goes through callbacks that are user settable. The default routines are
|
||||||
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
|
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
|
||||||
these functions, call the appropriate png_set_???_fn() function.
|
these functions, call the appropriate png_set_???_fn() function.
|
||||||
|
|
||||||
@ -1712,7 +1776,7 @@ won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
|
|||||||
|
|
||||||
Configuring for DOS:
|
Configuring for DOS:
|
||||||
|
|
||||||
For DOS users which only have access to the lower 640K, you will
|
For DOS users who only have access to the lower 640K, you will
|
||||||
have to limit zlib's memory usage via a png_set_compression_mem_level()
|
have to limit zlib's memory usage via a png_set_compression_mem_level()
|
||||||
call. See zlib.h or zconf.h in the zlib library for more information.
|
call. See zlib.h or zconf.h in the zlib library for more information.
|
||||||
|
|
||||||
@ -1724,7 +1788,7 @@ defined, and FAR gets defined to far in pngconf.h, and you should be
|
|||||||
all set. Everything in the library (except for zlib's structure) is
|
all set. Everything in the library (except for zlib's structure) is
|
||||||
expecting far data. You must use the typedefs with the p or pp on
|
expecting far data. You must use the typedefs with the p or pp on
|
||||||
the end for pointers (or at least look at them and be careful). Make
|
the end for pointers (or at least look at them and be careful). Make
|
||||||
note that the row's of data are defined as png_bytepp which is a
|
note that the row's of data are defined as png_bytepp, which is an
|
||||||
unsigned char far * far *.
|
unsigned char far * far *.
|
||||||
|
|
||||||
Configuring for gui/windowing platforms:
|
Configuring for gui/windowing platforms:
|
||||||
@ -1784,8 +1848,8 @@ can call one of these functions. The selection and configuration
|
|||||||
of row filters can have a significant impact on the size and
|
of row filters can have a significant impact on the size and
|
||||||
encoding speed and a somewhat lesser impact on the decoding speed
|
encoding speed and a somewhat lesser impact on the decoding speed
|
||||||
of an image. Filtering is enabled by default for RGB and grayscale
|
of an image. Filtering is enabled by default for RGB and grayscale
|
||||||
images (with and without alpha), and for 8-bit paletted images, but
|
images (with and without alpha), but not for paletted images nor
|
||||||
not for paletted images with bit depths less than 8 bits/pixel.
|
for any images with bit depths less than 8 bits/pixel.
|
||||||
|
|
||||||
The 'method' parameter sets the main filtering method, which is
|
The 'method' parameter sets the main filtering method, which is
|
||||||
currently only '0' in the PNG 1.0 specification. The 'filters'
|
currently only '0' in the PNG 1.0 specification. The 'filters'
|
||||||
@ -1820,10 +1884,10 @@ by telling it the relative computational costs of the filters.
|
|||||||
PNG_FILTER_SELECTION_WEIGHTED, 3,
|
PNG_FILTER_SELECTION_WEIGHTED, 3,
|
||||||
weights, costs);
|
weights, costs);
|
||||||
|
|
||||||
The weights are multiplying factors which indicate to libpng that row
|
The weights are multiplying factors that indicate to libpng that the
|
||||||
should be the same for successive rows unless another row filter is that
|
row filter should be the same for successive rows unless another row filter
|
||||||
many times better than the previous filter. In the above example, if
|
is that many times better than the previous filter. In the above example,
|
||||||
the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a
|
if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a
|
||||||
"sum of absolute differences" 1.5 x 1.3 times higher than other filters
|
"sum of absolute differences" 1.5 x 1.3 times higher than other filters
|
||||||
and still be chosen, while the NONE filter could have a sum 1.1 times
|
and still be chosen, while the NONE filter could have a sum 1.1 times
|
||||||
higher than other filters and still be chosen. Unspecified weights are
|
higher than other filters and still be chosen. Unspecified weights are
|
||||||
@ -1878,10 +1942,46 @@ or DLL file), you should not remove or disable any parts of the library,
|
|||||||
as this will cause applications linked with different versions of the
|
as this will cause applications linked with different versions of the
|
||||||
library to fail if they call functions not available in your library.
|
library to fail if they call functions not available in your library.
|
||||||
The size of the library itself should not be an issue, because only
|
The size of the library itself should not be an issue, because only
|
||||||
those sections which are actually used will be loaded into memory.
|
those sections that are actually used will be loaded into memory.
|
||||||
|
|
||||||
|
Requesting debug printout:
|
||||||
|
|
||||||
Changes to Libpng from version 0.88
|
The macro definition PNG_DEBUG can be used to request debugging
|
||||||
|
printout. Set it to an integer value in the range 0 to 3. Higher
|
||||||
|
numbers result in increasing amounts of debugging information. The
|
||||||
|
information is printed to the "stderr" file, unless another file
|
||||||
|
name is specified in the PNG_DEBUG_FILE macro definition.
|
||||||
|
|
||||||
|
When PNG_DEBUG > 0, the following functions (macros) become available:
|
||||||
|
|
||||||
|
png_debug(level, message)
|
||||||
|
png_debug1(level, message, p1)
|
||||||
|
png_debug2(level, message, p1, p2)
|
||||||
|
|
||||||
|
in which "level" is compared to PNG_DEBUG to decide whether to print
|
||||||
|
the message, "message" is the formatted string to be printed,
|
||||||
|
and p1 and p2 are parameters that are to be embedded in the string
|
||||||
|
according to printf-style formatting directives. For example,
|
||||||
|
|
||||||
|
png_debug1(2, "foo=%d\n", foo);
|
||||||
|
|
||||||
|
is expanded to
|
||||||
|
|
||||||
|
if(PNG_DEBUG > 2)
|
||||||
|
fprintf(PNG_DEBUG_FILE, "foo=%d\n", foo);
|
||||||
|
|
||||||
|
When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
|
||||||
|
can still use PNG_DEBUG to control your own debugging:
|
||||||
|
|
||||||
|
#ifdef PNG_DEBUG
|
||||||
|
fprintf(stderr, ...
|
||||||
|
#endif
|
||||||
|
|
||||||
|
When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
||||||
|
having level = 0 will be printed. There aren't any such statements in
|
||||||
|
this version of libpng, but if you insert some they will be printed.
|
||||||
|
|
||||||
|
VI. Changes to Libpng from version 0.88
|
||||||
|
|
||||||
It should be noted that versions of libpng later than 0.96 are not
|
It should be noted that versions of libpng later than 0.96 are not
|
||||||
distributed by the original libpng author, Guy Schalnat, nor by
|
distributed by the original libpng author, Guy Schalnat, nor by
|
||||||
@ -1907,7 +2007,7 @@ allocating and freeing the png_struct for each image read.
|
|||||||
|
|
||||||
Setting the error callbacks via png_set_message_fn() before
|
Setting the error callbacks via png_set_message_fn() before
|
||||||
png_read_init() as was suggested in libpng-0.88 is no longer supported
|
png_read_init() as was suggested in libpng-0.88 is no longer supported
|
||||||
because this caused applications which do not use custom error functions
|
because this caused applications that do not use custom error functions
|
||||||
to fail if the png_ptr was not initialized to zero. It is still possible
|
to fail if the png_ptr was not initialized to zero. It is still possible
|
||||||
to set the error callbacks AFTER png_read_init(), or to change them with
|
to set the error callbacks AFTER png_read_init(), or to change them with
|
||||||
png_set_error_fn(), which is essentially the same function, but with a
|
png_set_error_fn(), which is essentially the same function, but with a
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNGPF 3 "June 14, 1998"
|
.TH LIBPNGPF 3 "December 29, 1998"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.2 - June 14, 1998
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.2a - December 29, 1998
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
@ -88,7 +88,7 @@ row);
|
|||||||
|
|
||||||
void png_do_read_transformations (png_structp png_ptr);
|
void png_do_read_transformations (png_structp png_ptr);
|
||||||
|
|
||||||
void png_do_rgb_to_gray (png_row_infop row_info, png_bytep
|
int png_do_rgb_to_gray (png_row_infop row_info, png_bytep
|
||||||
row);
|
row);
|
||||||
|
|
||||||
void png_do_shift (png_row_infop row_info, png_bytep row,
|
void png_do_shift (png_row_infop row_info, png_bytep row,
|
||||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "June 14, 1998"
|
.TH PNG 5 "December 29, 1998"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
21
png.c
21
png.c
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng version 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -15,7 +15,8 @@
|
|||||||
/* 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[12] = "1.0.2";
|
|
||||||
|
char png_libpng_ver[12] = "1.0.2a";
|
||||||
|
|
||||||
/* Place to hold the signature string for a PNG file. */
|
/* Place to hold the signature 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};
|
||||||
@ -317,8 +318,8 @@ png_charp
|
|||||||
png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||||
{
|
{
|
||||||
static PNG_CONST char short_months[12][4] =
|
static PNG_CONST char short_months[12][4] =
|
||||||
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||||
|
|
||||||
if (png_ptr->time_buffer == NULL)
|
if (png_ptr->time_buffer == NULL)
|
||||||
{
|
{
|
||||||
@ -345,3 +346,13 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
return ((png_charp)png_ptr->time_buffer);
|
return ((png_charp)png_ptr->time_buffer);
|
||||||
}
|
}
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||||
|
|
||||||
|
png_charp
|
||||||
|
png_get_copyright(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return("\n libpng version 1.0.2a - December 29, 1998\n\
|
||||||
|
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\
|
||||||
|
Copyright (c) 1996, 1997 Andreas Dilger\n\
|
||||||
|
Copyright (c) 1998, Glenn Randers-Pehrson\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
111
png.h
111
png.h
@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng version 1.0.2a - December 29, 1998
|
||||||
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
|
|
||||||
* 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
|
||||||
* Copyright (c) 1998 Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
*
|
*
|
||||||
@ -31,6 +30,9 @@
|
|||||||
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
|
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
|
||||||
* 1.0.1 1.0.1 10001 2.1.0
|
* 1.0.1 1.0.1 10001 2.1.0
|
||||||
* 1.0.1a-e 1.0.1a-e 10002 2.1.0.1a-e
|
* 1.0.1a-e 1.0.1a-e 10002 2.1.0.1a-e
|
||||||
|
* 1.0.2 1.0.2 10002 2.1.0.2
|
||||||
|
* 1.0.2a 1.0.2a 10003 2.1.0.2a
|
||||||
|
* 1.0.3 1.0.3 10003 2.1.0.3
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library minor
|
* Henceforth the source version will match the shared-library minor
|
||||||
* and patch numbers; the shared-library major version number will be
|
* and patch numbers; the shared-library major version number will be
|
||||||
@ -117,14 +119,14 @@ 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.0.2"
|
#define PNG_LIBPNG_VER_STRING "1.0.2a"
|
||||||
|
|
||||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||||
* We must not include leading zeros.
|
* We must not include leading zeros.
|
||||||
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
|
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
|
||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=bugfix */
|
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=bugfix */
|
||||||
#define PNG_LIBPNG_VER 10002 /* 1.0.2 */
|
#define PNG_LIBPNG_VER 10003 /* 1.0.3 */
|
||||||
|
|
||||||
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
|
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
|
||||||
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
|
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
|
||||||
@ -144,6 +146,7 @@ extern int FARDATA png_pass_dsp_mask[7];
|
|||||||
extern int FARDATA png_pass_width[7];
|
extern int FARDATA png_pass_width[7];
|
||||||
extern int FARDATA png_pass_height[7];
|
extern int FARDATA png_pass_height[7];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif /* PNG_NO_EXTERN */
|
#endif /* PNG_NO_EXTERN */
|
||||||
|
|
||||||
/* Three color definitions. The order of the red, green, and blue, (and the
|
/* Three color definitions. The order of the red, green, and blue, (and the
|
||||||
@ -689,6 +692,12 @@ struct png_struct_def
|
|||||||
png_malloc_ptr malloc_fn; /* function for allocating memory */
|
png_malloc_ptr malloc_fn; /* function for allocating memory */
|
||||||
png_free_ptr free_fn; /* function for freeing memory */
|
png_free_ptr free_fn; /* function for freeing memory */
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
png_byte rgb_to_gray_status;
|
||||||
|
png_byte rgb_to_gray_red_coeff;
|
||||||
|
png_byte rgb_to_gray_green_coeff;
|
||||||
|
png_byte rgb_to_gray_blue_coeff;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef png_struct FAR * FAR * png_structpp;
|
typedef png_struct FAR * FAR * png_structpp;
|
||||||
@ -800,8 +809,11 @@ extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
|
|||||||
#endif /* PNG_READ_GRAY_TO_RGB_SUPPORTED */
|
#endif /* PNG_READ_GRAY_TO_RGB_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
/* Reduce RGB to grayscale. (Not yet implemented) */
|
/* Reduce RGB to grayscale. */
|
||||||
extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr));
|
extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
|
||||||
|
int error_action, float red, float green ));
|
||||||
|
extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
|
||||||
|
png_ptr));
|
||||||
#endif /* PNG_READ_RGB_TO_GRAY_SUPPORTED */
|
#endif /* PNG_READ_RGB_TO_GRAY_SUPPORTED */
|
||||||
|
|
||||||
extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
|
extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
|
||||||
@ -1105,6 +1117,7 @@ extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, FILE *fp));
|
|||||||
* method of error handling. If error_fn or warning_fn is NULL, the
|
* method of error handling. If error_fn or warning_fn is NULL, the
|
||||||
* default function will be used.
|
* default function will be used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
|
||||||
png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
|
png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
|
||||||
|
|
||||||
@ -1449,28 +1462,42 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
|
|||||||
* only been added since version 0.95 so it is not implemented throughout
|
* only been added since version 0.95 so it is not implemented throughout
|
||||||
* libpng yet, but more support will be added as needed.
|
* libpng yet, but more support will be added as needed.
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_DEBUG
|
||||||
#if (PNG_DEBUG > 0)
|
#if (PNG_DEBUG > 0)
|
||||||
#ifdef PNG_NO_STDIO
|
|
||||||
#include <stdio.h>
|
|
||||||
#endif
|
|
||||||
#ifndef PNG_DEBUG_FILE
|
#ifndef PNG_DEBUG_FILE
|
||||||
#define PNG_DEBUG_FILE stderr
|
#define PNG_DEBUG_FILE stderr
|
||||||
#endif /* PNG_DEBUG_FILE */
|
#endif /* PNG_DEBUG_FILE */
|
||||||
|
|
||||||
#define png_debug(l,m) if (PNG_DEBUG > l) \
|
#define png_debug(l,m) if (PNG_DEBUG > l) \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
|
||||||
(l==2 ? "\t\t":(l==3 ? "\t\t\t":""))))
|
(l==2 ? "\t\t":(l>2 ? "\t\t\t":""))))
|
||||||
#define png_debug1(l,m,p1) if (PNG_DEBUG > l) \
|
#define png_debug1(l,m,p1) if (PNG_DEBUG > l) \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
|
||||||
(l==2 ? "\t\t":(l==3 ? "\t\t\t":""))),p1)
|
(l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1)
|
||||||
#define png_debug2(l,m,p1,p2) if (PNG_DEBUG > l) \
|
#define png_debug2(l,m,p1,p2) if (PNG_DEBUG > l) \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
|
||||||
(l==2 ? "\t\t":(l==3 ? "\t\t\t":""))),p1,p2)
|
(l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1,p2)
|
||||||
#else
|
|
||||||
#define png_debug(l, m)
|
|
||||||
#define png_debug1(l, m, p1)
|
|
||||||
#define png_debug2(l, m, p1, p2)
|
|
||||||
#endif /* (PNG_DEBUG > 0) */
|
#endif /* (PNG_DEBUG > 0) */
|
||||||
|
#endif /* PNG_DEBUG */
|
||||||
|
#ifndef png_debug
|
||||||
|
#define png_debug(l, m)
|
||||||
|
#endif
|
||||||
|
#ifndef png_debug1
|
||||||
|
#define png_debug1(l, m, p1)
|
||||||
|
#endif
|
||||||
|
#ifndef png_debug2
|
||||||
|
#define png_debug2(l, m, p1, p2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
|
||||||
|
#ifdef PNG_NO_EXTERN
|
||||||
|
extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
|
||||||
|
png_charp
|
||||||
|
png_get_header_version(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return("\n libpng version 1.0.2a - December 29, 1998 (header)\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||||
/* With these routines we avoid an integer divide, which will be slower on
|
/* With these routines we avoid an integer divide, which will be slower on
|
||||||
@ -1485,28 +1512,30 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
|
|||||||
* [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
|
* [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
|
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
|
||||||
# define png_composite(composite, fg, alpha, bg) \
|
|
||||||
{ png_uint_16 temp = ((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
# define png_composite(composite, fg, alpha, bg) \
|
||||||
(png_uint_16)(bg)*(png_uint_16)(255 - \
|
{ png_uint_16 temp = ((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
||||||
(png_uint_16)(alpha)) + (png_uint_16)128); \
|
(png_uint_16)(bg)*(png_uint_16)(255 - \
|
||||||
|
(png_uint_16)(alpha)) + (png_uint_16)128); \
|
||||||
(composite) = (png_byte)((temp + (temp >> 8)) >> 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) + \
|
# define png_composite_16(composite, fg, alpha, bg) \
|
||||||
(png_uint_32)(bg)*(png_uint_32)(65535L - \
|
{ png_uint_32 temp = ((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
||||||
(png_uint_32)(alpha)) + (png_uint_32)32768L); \
|
(png_uint_32)(bg)*(png_uint_32)(65535L - \
|
||||||
|
(png_uint_32)(alpha)) + (png_uint_32)32768L); \
|
||||||
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
|
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
|
||||||
|
|
||||||
#else /* standard method using integer division */
|
#else /* standard method using integer division */
|
||||||
|
|
||||||
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
|
# define png_composite(composite, fg, alpha, bg) \
|
||||||
# define png_composite(composite, fg, alpha, bg) \
|
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
||||||
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
|
||||||
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
|
|
||||||
(png_uint_16)127) / 255)
|
(png_uint_16)127) / 255)
|
||||||
# define png_composite_16(composite, fg, alpha, bg) \
|
|
||||||
|
# define png_composite_16(composite, fg, alpha, bg) \
|
||||||
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
||||||
(png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
|
(png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
|
||||||
(png_uint_32)32767) / (png_uint_32)65535L)
|
(png_uint_32)32767) / (png_uint_32)65535L)
|
||||||
|
|
||||||
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
|
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
|
||||||
@ -1552,7 +1581,7 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
|
|||||||
#define PNG_DITHER 0x0040
|
#define PNG_DITHER 0x0040
|
||||||
#define PNG_BACKGROUND 0x0080
|
#define PNG_BACKGROUND 0x0080
|
||||||
#define PNG_BACKGROUND_EXPAND 0x0100
|
#define PNG_BACKGROUND_EXPAND 0x0100
|
||||||
#define PNG_RGB_TO_GRAY 0x0200 /* Not currently implemented */
|
/* 0x0200 unused */
|
||||||
#define PNG_16_TO_8 0x0400
|
#define PNG_16_TO_8 0x0400
|
||||||
#define PNG_RGBA 0x0800
|
#define PNG_RGBA 0x0800
|
||||||
#define PNG_EXPAND 0x1000
|
#define PNG_EXPAND 0x1000
|
||||||
@ -1564,6 +1593,9 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
|
|||||||
#define PNG_STRIP_ALPHA 0x40000L
|
#define PNG_STRIP_ALPHA 0x40000L
|
||||||
#define PNG_INVERT_ALPHA 0x80000L
|
#define PNG_INVERT_ALPHA 0x80000L
|
||||||
#define PNG_USER_TRANSFORM 0x100000L
|
#define PNG_USER_TRANSFORM 0x100000L
|
||||||
|
#define PNG_RGB_TO_GRAY_ERR 0x200000L
|
||||||
|
#define PNG_RGB_TO_GRAY_WARN 0x400000L
|
||||||
|
#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
|
||||||
|
|
||||||
/* flags for png_create_struct */
|
/* flags for png_create_struct */
|
||||||
#define PNG_STRUCT_PNG 0x0001
|
#define PNG_STRUCT_PNG 0x0001
|
||||||
@ -1725,8 +1757,8 @@ PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
|
/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
|
||||||
* The only currently known PNG chunk that uses signed numbers is
|
* The only currently known PNG chunks that use signed numbers are
|
||||||
* the ancillary extension chunk, pCAL.
|
* the ancillary extension chunks, oFFs and pCAL.
|
||||||
*/
|
*/
|
||||||
PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
|
PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
|
||||||
|
|
||||||
@ -1922,8 +1954,8 @@ PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
PNG_EXTERN void png_do_rgb_to_gray PNGARG((png_row_infop row_info,
|
PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
|
||||||
png_bytep row));
|
row_info, png_bytep row));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
|
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
|
||||||
@ -2128,11 +2160,16 @@ PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
|
|||||||
|
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* PNG_INTERNAL */
|
#endif /* PNG_INTERNAL */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_NO_EXTERN
|
||||||
|
|
||||||
/* do not put anything past this line */
|
/* do not put anything past this line */
|
||||||
#endif /* _PNG_H */
|
#endif /* _PNG_H */
|
||||||
|
28
pngconf.h
28
pngconf.h
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -17,6 +17,7 @@
|
|||||||
#ifndef PNGCONF_H
|
#ifndef PNGCONF_H
|
||||||
#define PNGCONF_H
|
#define PNGCONF_H
|
||||||
|
|
||||||
|
|
||||||
/* This is the size of the compression buffer, and thus the size of
|
/* This is the size of the compression buffer, and thus the size of
|
||||||
* an IDAT chunk. Make this whatever size you feel is best for your
|
* an IDAT chunk. Make this whatever size you feel is best for your
|
||||||
* machine. One of these will be allocated per png_struct. When this
|
* machine. One of these will be allocated per png_struct. When this
|
||||||
@ -49,13 +50,28 @@
|
|||||||
/* This protects us against compilers that run on a windowing system
|
/* This protects us against compilers that run on a windowing system
|
||||||
* and thus don't have or would rather us not use the stdio types:
|
* and thus don't have or would rather us not use the stdio types:
|
||||||
* stdin, stdout, and stderr. The only one currently used is stderr
|
* stdin, stdout, and stderr. The only one currently used is stderr
|
||||||
* in png_error() and png_warning(). #defining PNG_NO_STDIO will
|
* in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
|
||||||
* prevent these from being compiled and used.
|
* prevent these from being compiled and used. #defining PNG_NO_STDIO
|
||||||
|
* will also prevent these, plus will prevent the entire set of stdio
|
||||||
|
* macros and functions (FILE *, printf, etc.) from being compiled and used,
|
||||||
|
* unless PNG_DEBUG has been #defined.
|
||||||
|
*
|
||||||
|
* #define PNG_NO_CONSOLE_IO
|
||||||
* #define PNG_NO_STDIO
|
* #define PNG_NO_STDIO
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PNG_NO_STDIO
|
#ifdef PNG_DEBUG
|
||||||
#include <stdio.h>
|
# if (PNG_DEBUG > 0)
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifdef PNG_NO_STDIO
|
||||||
|
# ifndef PNG_NO_CONSOLE_IO
|
||||||
|
# define PNG_NO_CONSOLE_IO
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This macro protects us against machines that don't have function
|
/* This macro protects us against machines that don't have function
|
||||||
@ -307,11 +323,9 @@ __dont__ include it again
|
|||||||
#ifndef PNG_NO_READ_USER_TRANSFORM
|
#ifndef PNG_NO_READ_USER_TRANSFORM
|
||||||
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
/* the following aren't implemented yet
|
|
||||||
#ifndef PNG_NO_READ_RGB_TO_GRAY
|
#ifndef PNG_NO_READ_RGB_TO_GRAY
|
||||||
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
|
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
|
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
|
||||||
|
|
||||||
#if !defined(PNG_NO_PROGRESSIVE_READ) && \
|
#if !defined(PNG_NO_PROGRESSIVE_READ) && \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -113,7 +113,7 @@ png_chunk_warning(png_structp png_ptr, png_const_charp message)
|
|||||||
static void
|
static void
|
||||||
png_default_error(png_structp png_ptr, png_const_charp message)
|
png_default_error(png_structp png_ptr, png_const_charp message)
|
||||||
{
|
{
|
||||||
#ifndef PNG_NO_STDIO
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
fprintf(stderr, "libpng error: %s\n", message);
|
fprintf(stderr, "libpng error: %s\n", message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ png_default_warning(png_structp png_ptr, png_const_charp message)
|
|||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef PNG_NO_STDIO
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
fprintf(stderr, "libpng warning: %s\n", message);
|
fprintf(stderr, "libpng warning: %s\n", message);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
9
pngget.c
9
pngget.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -641,3 +641,10 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
png_byte
|
||||||
|
png_get_rgb_to_gray_status (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return png_ptr->rgb_to_gray_status;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
4
pngmem.c
4
pngmem.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -130,7 +130,7 @@ png_voidp
|
|||||||
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
#endif PNG_USER_MEM_SUPPORTED
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if (size > (png_uint_32)65536L)
|
if (size > (png_uint_32)65536L)
|
||||||
|
20
pngpread.c
20
pngpread.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -781,6 +781,7 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
png_ptr->pass++;
|
png_ptr->pass++;
|
||||||
if (png_ptr->pass >= 7)
|
if (png_ptr->pass >= 7)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
png_ptr->iwidth = (png_ptr->width +
|
png_ptr->iwidth = (png_ptr->width +
|
||||||
png_pass_inc[png_ptr->pass] - 1 -
|
png_pass_inc[png_ptr->pass] - 1 -
|
||||||
png_pass_start[png_ptr->pass]) /
|
png_pass_start[png_ptr->pass]) /
|
||||||
@ -789,18 +790,15 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
png_ptr->irowbytes = ((png_ptr->iwidth *
|
png_ptr->irowbytes = ((png_ptr->iwidth *
|
||||||
png_ptr->pixel_depth + 7) >> 3) + 1;
|
png_ptr->pixel_depth + 7) >> 3) + 1;
|
||||||
|
|
||||||
if (!(png_ptr->transformations & PNG_INTERLACE))
|
|
||||||
{
|
|
||||||
png_ptr->num_rows = (png_ptr->height +
|
|
||||||
png_pass_yinc[png_ptr->pass] - 1 -
|
|
||||||
png_pass_ystart[png_ptr->pass]) /
|
|
||||||
png_pass_yinc[png_ptr->pass];
|
|
||||||
if (!(png_ptr->num_rows))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (png_ptr->transformations & PNG_INTERLACE)
|
if (png_ptr->transformations & PNG_INTERLACE)
|
||||||
break;
|
break;
|
||||||
} while (png_ptr->iwidth == 0);
|
|
||||||
|
png_ptr->num_rows = (png_ptr->height +
|
||||||
|
png_pass_yinc[png_ptr->pass] - 1 -
|
||||||
|
png_pass_ystart[png_ptr->pass]) /
|
||||||
|
png_pass_yinc[png_ptr->pass];
|
||||||
|
|
||||||
|
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
pngread.c
12
pngread.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -530,7 +530,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
|||||||
* not called png_set_interlace_handling(), the display_row buffer will
|
* not called png_set_interlace_handling(), the display_row buffer will
|
||||||
* be ignored, so pass NULL to it.
|
* be ignored, so pass NULL to it.
|
||||||
*
|
*
|
||||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.2.
|
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.2a.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -579,7 +579,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
|||||||
* only call this function once. If you desire to have an image for
|
* only call this function once. If you desire to have an image for
|
||||||
* each pass of a interlaced image, use png_read_rows() instead.
|
* each pass of a interlaced image, use png_read_rows() instead.
|
||||||
*
|
*
|
||||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.2.
|
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.2a.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
png_read_image(png_structp png_ptr, png_bytepp image)
|
png_read_image(png_structp png_ptr, png_bytepp image)
|
||||||
@ -820,9 +820,9 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
|||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->gamma_16_table[i]);
|
png_free(png_ptr, png_ptr->gamma_16_table[i]);
|
||||||
}
|
}
|
||||||
|
png_free(png_ptr, png_ptr->gamma_16_table);
|
||||||
}
|
}
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
png_free(png_ptr, png_ptr->gamma_16_table);
|
|
||||||
if (png_ptr->gamma_16_from_1 != NULL)
|
if (png_ptr->gamma_16_from_1 != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -831,8 +831,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
|||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
|
png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
png_free(png_ptr, png_ptr->gamma_16_from_1);
|
png_free(png_ptr, png_ptr->gamma_16_from_1);
|
||||||
|
}
|
||||||
if (png_ptr->gamma_16_to_1 != NULL)
|
if (png_ptr->gamma_16_to_1 != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -841,8 +841,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
|||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
|
png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
png_free(png_ptr, png_ptr->gamma_16_to_1);
|
png_free(png_ptr, png_ptr->gamma_16_to_1);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
||||||
|
2
pngrio.c
2
pngrio.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
|
447
pngrtran.c
447
pngrtran.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -284,8 +284,8 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
don't always behave themselves with only a few colors
|
don't always behave themselves with only a few colors
|
||||||
as input. So we will just find the closest two colors,
|
as input. So we will just find the closest two colors,
|
||||||
and throw out one of them (chosen somewhat randomly).
|
and throw out one of them (chosen somewhat randomly).
|
||||||
[I don't understand this at all, so if someone wants to
|
[We don't understand this at all, so if someone wants to
|
||||||
work on improving it, be my guest - AED]
|
work on improving it, be our guest - AED, GRP]
|
||||||
*/
|
*/
|
||||||
int i;
|
int i;
|
||||||
int max_d;
|
int max_d;
|
||||||
@ -544,17 +544,49 @@ png_set_gray_to_rgb(png_structp png_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
/* Convert a RGB image to a grayscale of the given width. This would
|
/* Convert a RGB image to a grayscale of the same width. This allows us,
|
||||||
* allow us, for example, to convert a 24 bpp RGB image into an 8 or
|
* for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image.
|
||||||
* 16 bpp grayscale image. (Not yet implemented.)
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
png_set_rgb_to_gray(png_structp png_ptr, int gray_bits)
|
png_set_rgb_to_gray(png_structp png_ptr, int error_action, float red,
|
||||||
|
float green)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_rgb_to_gray\n");
|
png_debug(1, "in png_set_rgb_to_gray\n");
|
||||||
png_ptr->transformations |= PNG_RGB_TO_GRAY;
|
switch(error_action)
|
||||||
/* Need to do something with gray_bits here. */
|
{
|
||||||
png_warning(png_ptr, "RGB to GRAY transformation is not yet implemented.");
|
case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY;
|
||||||
|
break;
|
||||||
|
case 2: png_ptr->transformations |= PNG_RGB_TO_GRAY_WARN;
|
||||||
|
break;
|
||||||
|
case 3: png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR;
|
||||||
|
}
|
||||||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
|
#if defined(PNG_READ_EXPAND_SUPPORTED)
|
||||||
|
png_ptr->transformations |= PNG_EXPAND;
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED.");
|
||||||
|
png_ptr->transformations &= ~PNG_RGB_TO_GRAY;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_byte red_byte = (png_byte)(red*255.0 + 0.5);
|
||||||
|
png_byte green_byte = (png_byte)(green*255.0 + 0.5);
|
||||||
|
if(red < 0.0 || green < 0.0)
|
||||||
|
{
|
||||||
|
red_byte = 54;
|
||||||
|
green_byte = 183;
|
||||||
|
}
|
||||||
|
else if(red_byte + green_byte > 255)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients");
|
||||||
|
red_byte = 54;
|
||||||
|
green_byte = 183;
|
||||||
|
}
|
||||||
|
png_ptr->rgb_to_gray_red_coeff = red_byte;
|
||||||
|
png_ptr->rgb_to_gray_green_coeff = green_byte;
|
||||||
|
png_ptr->rgb_to_gray_blue_coeff = 255 - red_byte - green_byte;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -649,7 +681,7 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
png_ptr->background_1 = png_ptr->background;
|
png_ptr->background_1 = png_ptr->background;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_GAMMA)
|
if (png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY))
|
||||||
{
|
{
|
||||||
png_build_gamma_table(png_ptr);
|
png_build_gamma_table(png_ptr);
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
@ -958,6 +990,11 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
|
info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
|
||||||
|
info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
info_ptr->channels = 1;
|
info_ptr->channels = 1;
|
||||||
else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
|
else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
|
||||||
@ -1035,6 +1072,22 @@ png_do_read_transformations(png_structp png_ptr)
|
|||||||
PNG_FLAG_FILLER_AFTER);
|
PNG_FLAG_FILLER_AFTER);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
|
||||||
|
{
|
||||||
|
int rgb_error =
|
||||||
|
png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
|
if(rgb_error)
|
||||||
|
{
|
||||||
|
png_ptr->rgb_to_gray_status=1;
|
||||||
|
if(png_ptr->transformations == PNG_RGB_TO_GRAY_WARN)
|
||||||
|
png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||||
|
if(png_ptr->transformations == PNG_RGB_TO_GRAY_ERR)
|
||||||
|
png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
||||||
|
|
||||||
@ -1099,11 +1152,6 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
|||||||
png_ptr->gamma_shift);
|
png_ptr->gamma_shift);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
|
|
||||||
png_do_rgb_to_gray(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_16_TO_8_SUPPORTED)
|
#if defined(PNG_READ_16_TO_8_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_16_TO_8)
|
if (png_ptr->transformations & PNG_16_TO_8)
|
||||||
png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
@ -1359,7 +1407,6 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef PNG_SLOW_SHIFT
|
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
png_bytep bp = row;
|
png_bytep bp = row;
|
||||||
@ -1387,43 +1434,6 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
case 8:
|
|
||||||
{
|
|
||||||
png_bytep bp;
|
|
||||||
png_uint_32 i;
|
|
||||||
int cstop;
|
|
||||||
|
|
||||||
cstop=(int)row_info->channels;
|
|
||||||
for (bp = row, i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
for (c = 0; c < cstop; c++, bp++)
|
|
||||||
{
|
|
||||||
*bp >>= shift[c];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 16:
|
|
||||||
{
|
|
||||||
png_bytep bp;
|
|
||||||
png_size_t i;
|
|
||||||
int cstop;
|
|
||||||
|
|
||||||
cstop=(int)row_info->channels;
|
|
||||||
for (bp = row, i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
for (c = 0; c < cstop; c++, bp += 2)
|
|
||||||
{
|
|
||||||
value = (png_uint_16)((*bp << 8) + *(bp + 1));
|
|
||||||
value >>= shift[c];
|
|
||||||
*bp = (png_byte)(value >> 8);
|
|
||||||
*(bp + 1) = (png_byte)(value & 0xff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1668,7 +1678,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
|
png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
|
||||||
png_byte low_filler = (png_byte)(filler & 0xff);
|
png_byte lo_filler = (png_byte)(filler & 0xff);
|
||||||
|
|
||||||
png_debug(1, "in png_do_read_filler\n");
|
png_debug(1, "in png_do_read_filler\n");
|
||||||
if (
|
if (
|
||||||
@ -1686,9 +1696,10 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
png_bytep dp = sp + (png_size_t)row_width;
|
png_bytep dp = sp + (png_size_t)row_width;
|
||||||
for (i = 1; i < row_width; i++)
|
for (i = 1; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(--dp) = low_filler;
|
*(--dp) = lo_filler;
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
}
|
}
|
||||||
|
*(--dp) = lo_filler;
|
||||||
row_info->channels = 2;
|
row_info->channels = 2;
|
||||||
row_info->pixel_depth = 16;
|
row_info->pixel_depth = 16;
|
||||||
row_info->rowbytes = row_width * 2;
|
row_info->rowbytes = row_width * 2;
|
||||||
@ -1701,7 +1712,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
for (i = 0; i < row_width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = low_filler;
|
*(--dp) = lo_filler;
|
||||||
}
|
}
|
||||||
row_info->channels = 2;
|
row_info->channels = 2;
|
||||||
row_info->pixel_depth = 16;
|
row_info->pixel_depth = 16;
|
||||||
@ -1718,10 +1729,12 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
for (i = 1; i < row_width; i++)
|
for (i = 1; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(--dp) = hi_filler;
|
*(--dp) = hi_filler;
|
||||||
*(--dp) = low_filler;
|
*(--dp) = lo_filler;
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
}
|
}
|
||||||
|
*(--dp) = hi_filler;
|
||||||
|
*(--dp) = lo_filler;
|
||||||
row_info->channels = 2;
|
row_info->channels = 2;
|
||||||
row_info->pixel_depth = 32;
|
row_info->pixel_depth = 32;
|
||||||
row_info->rowbytes = row_width * 2;
|
row_info->rowbytes = row_width * 2;
|
||||||
@ -1736,7 +1749,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = hi_filler;
|
*(--dp) = hi_filler;
|
||||||
*(--dp) = low_filler;
|
*(--dp) = lo_filler;
|
||||||
}
|
}
|
||||||
row_info->channels = 2;
|
row_info->channels = 2;
|
||||||
row_info->pixel_depth = 16;
|
row_info->pixel_depth = 16;
|
||||||
@ -1755,11 +1768,12 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
png_bytep dp = sp + (png_size_t)row_width;
|
png_bytep dp = sp + (png_size_t)row_width;
|
||||||
for (i = 1; i < row_width; i++)
|
for (i = 1; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(--dp) = low_filler;
|
*(--dp) = lo_filler;
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
}
|
}
|
||||||
|
*(--dp) = lo_filler;
|
||||||
row_info->channels = 4;
|
row_info->channels = 4;
|
||||||
row_info->pixel_depth = 32;
|
row_info->pixel_depth = 32;
|
||||||
row_info->rowbytes = row_width * 4;
|
row_info->rowbytes = row_width * 4;
|
||||||
@ -1774,7 +1788,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = low_filler;
|
*(--dp) = lo_filler;
|
||||||
}
|
}
|
||||||
row_info->channels = 4;
|
row_info->channels = 4;
|
||||||
row_info->pixel_depth = 32;
|
row_info->pixel_depth = 32;
|
||||||
@ -1791,7 +1805,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
for (i = 1; i < row_width; i++)
|
for (i = 1; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(--dp) = hi_filler;
|
*(--dp) = hi_filler;
|
||||||
*(--dp) = low_filler;
|
*(--dp) = lo_filler;
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
@ -1799,6 +1813,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
}
|
}
|
||||||
|
*(--dp) = hi_filler;
|
||||||
|
*(--dp) = lo_filler;
|
||||||
row_info->channels = 4;
|
row_info->channels = 4;
|
||||||
row_info->pixel_depth = 64;
|
row_info->pixel_depth = 64;
|
||||||
row_info->rowbytes = row_width * 4;
|
row_info->rowbytes = row_width * 4;
|
||||||
@ -1817,7 +1833,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
|||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = *(--sp);
|
*(--dp) = *(--sp);
|
||||||
*(--dp) = hi_filler;
|
*(--dp) = hi_filler;
|
||||||
*(--dp) = low_filler;
|
*(--dp) = lo_filler;
|
||||||
}
|
}
|
||||||
row_info->channels = 4;
|
row_info->channels = 4;
|
||||||
row_info->pixel_depth = 64;
|
row_info->pixel_depth = 64;
|
||||||
@ -1918,6 +1934,261 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
/* reduce RGB files to grayscale, with or without alpha
|
||||||
|
* using the equation given in Poynton's ColorFAQ at
|
||||||
|
* <http://www.inforamp.net/~poynton/>
|
||||||
|
* Copyright (c) 1998-01-04 Charles Poynton poynton@inforamp.net
|
||||||
|
*
|
||||||
|
* Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
|
||||||
|
*
|
||||||
|
* We approximate this with
|
||||||
|
*
|
||||||
|
* Y = 0.211 * R + 0.715 * G + 0.074 * B
|
||||||
|
*
|
||||||
|
* which can be expressed with integers as
|
||||||
|
*
|
||||||
|
* Y = (54 * R + 183 * G + 19 * B)/256
|
||||||
|
*
|
||||||
|
* The calculation is to be done in a linear colorspace.
|
||||||
|
*
|
||||||
|
* Other integer coefficents can be used via png_set_rgb_to_gray().
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||||
|
|
||||||
|
{
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
int rgb_error = 0;
|
||||||
|
|
||||||
|
png_debug(1, "in png_do_rgb_to_gray\n");
|
||||||
|
if (
|
||||||
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
|
row != NULL && row_info != NULL &&
|
||||||
|
#endif
|
||||||
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
|
{
|
||||||
|
png_byte rc = png_ptr->rgb_to_gray_red_coeff;
|
||||||
|
png_byte gc = png_ptr->rgb_to_gray_green_coeff;
|
||||||
|
png_byte bc = png_ptr->rgb_to_gray_blue_coeff;
|
||||||
|
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
{
|
||||||
|
if (row_info->bit_depth == 8)
|
||||||
|
{
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL)
|
||||||
|
{
|
||||||
|
png_bytep sp = row;
|
||||||
|
png_bytep dp = row;
|
||||||
|
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
png_byte red = png_ptr->gamma_to_1[*(sp++)];
|
||||||
|
png_byte green = png_ptr->gamma_to_1[*(sp++)];
|
||||||
|
png_byte blue = png_ptr->gamma_to_1[*(sp++)];
|
||||||
|
if(red != green || red != blue)
|
||||||
|
{
|
||||||
|
rgb_error |= 1;
|
||||||
|
*(dp++) = png_ptr->gamma_from_1[
|
||||||
|
(rc*red+gc*green+bc*blue)>>8];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*(dp++) = *(sp-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_bytep sp = row;
|
||||||
|
png_bytep dp = row;
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
png_byte red = *(sp++);
|
||||||
|
png_byte green = *(sp++);
|
||||||
|
png_byte blue = *(sp++);
|
||||||
|
if(red != green || red != blue)
|
||||||
|
{
|
||||||
|
rgb_error |= 1;
|
||||||
|
*(dp++) = (rc*red+gc*green+bc*blue)>>8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*(dp++) = *(sp-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else /* RGB bit_depth == 16 */
|
||||||
|
{
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
if (png_ptr->gamma_16_to_1 != NULL &&
|
||||||
|
png_ptr->gamma_16_from_1 != NULL)
|
||||||
|
{
|
||||||
|
png_bytep sp = row;
|
||||||
|
png_bytep dp = row;
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
png_uint_16 red, green, blue, w;
|
||||||
|
|
||||||
|
red = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
green = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
blue = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
|
||||||
|
if(red == green && red == blue)
|
||||||
|
w = red;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >>
|
||||||
|
png_ptr->gamma_shift][red>>8];
|
||||||
|
png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >>
|
||||||
|
png_ptr->gamma_shift][green>>8];
|
||||||
|
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >>
|
||||||
|
png_ptr->gamma_shift][blue>>8];
|
||||||
|
png_uint_16 gray16 = (rc * red_1 + gc * green_1
|
||||||
|
+ bc * blue_1)>>8;
|
||||||
|
w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
|
||||||
|
png_ptr->gamma_shift][gray16 >> 8];
|
||||||
|
rgb_error |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*(dp++) = (w>>8) & 0xff;
|
||||||
|
*(dp++) = w & 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_bytep sp = row;
|
||||||
|
png_bytep dp = row;
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
png_uint_16 red, green, blue, gray16;
|
||||||
|
|
||||||
|
red = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
green = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
blue = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
|
||||||
|
if(red != green || red != blue)
|
||||||
|
rgb_error |= 1;
|
||||||
|
gray16 = (rc * red + gc * green + bc * blue)>>8;
|
||||||
|
*(dp++) = (gray16>>8) & 0xff;
|
||||||
|
*(dp++) = gray16 & 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
{
|
||||||
|
if (row_info->bit_depth == 8)
|
||||||
|
{
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL)
|
||||||
|
{
|
||||||
|
png_bytep sp = row;
|
||||||
|
png_bytep dp = row;
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
png_byte red = png_ptr->gamma_to_1[*(sp++)];
|
||||||
|
png_byte green = png_ptr->gamma_to_1[*(sp++)];
|
||||||
|
png_byte blue = png_ptr->gamma_to_1[*(sp++)];
|
||||||
|
if(red != green || red != blue)
|
||||||
|
rgb_error |= 1;
|
||||||
|
*(dp++) = png_ptr->gamma_from_1
|
||||||
|
[(rc*red + gc*green + bc*blue)>>8];
|
||||||
|
*(dp++) = *(sp++); /* alpha */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_bytep sp = row;
|
||||||
|
png_bytep dp = row;
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
png_byte red = *(sp++);
|
||||||
|
png_byte green = *(sp++);
|
||||||
|
png_byte blue = *(sp++);
|
||||||
|
if(red != green || red != blue)
|
||||||
|
rgb_error |= 1;
|
||||||
|
*(dp++) = (gc*red + gc*green + bc*blue)>>8;
|
||||||
|
*(dp++) = *(sp++); /* alpha */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /* RGBA bit_depth == 16 */
|
||||||
|
{
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
if (png_ptr->gamma_16_to_1 != NULL &&
|
||||||
|
png_ptr->gamma_16_from_1 != NULL)
|
||||||
|
{
|
||||||
|
png_bytep sp = row;
|
||||||
|
png_bytep dp = row;
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
png_uint_16 red, green, blue, w;
|
||||||
|
|
||||||
|
red = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
green = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
blue = ((*(sp))<<8) | *(sp+1); sp+=2;
|
||||||
|
|
||||||
|
if(red == green && red == blue)
|
||||||
|
w = red;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >>
|
||||||
|
png_ptr->gamma_shift][red>>8];
|
||||||
|
png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >>
|
||||||
|
png_ptr->gamma_shift][green>>8];
|
||||||
|
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >>
|
||||||
|
png_ptr->gamma_shift][blue>>8];
|
||||||
|
png_uint_16 gray16 = (rc * red_1 + gc * green_1
|
||||||
|
+ bc * blue_1)>>8;
|
||||||
|
w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
|
||||||
|
png_ptr->gamma_shift][gray16 >> 8];
|
||||||
|
rgb_error |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*(dp++) = (w>>8) & 0xff;
|
||||||
|
*(dp++) = w & 0xff;
|
||||||
|
*(dp++) = *(sp++); /* alpha */
|
||||||
|
*(dp++) = *(sp++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_bytep sp = row;
|
||||||
|
png_bytep dp = row;
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
|
{
|
||||||
|
png_uint_16 red, green, blue, gray16;
|
||||||
|
red = (*(sp)<<8) | *(sp+1); sp+=2;
|
||||||
|
green = (*(sp)<<8) | *(sp+1); sp+=2;
|
||||||
|
blue = (*(sp)<<8) | *(sp+1); sp+=2;
|
||||||
|
if(red != green || red != blue)
|
||||||
|
rgb_error |= 1;
|
||||||
|
gray16 = (rc * red + gc * green + bc * blue)>>8;
|
||||||
|
*(dp++) = (gray16>>8) & 0xff;
|
||||||
|
*(dp++) = gray16 & 0xff;
|
||||||
|
*(dp++) = *(sp++); /* alpha */
|
||||||
|
*(dp++) = *(sp++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
row_info->channels -= (png_byte)2;
|
||||||
|
row_info->color_type &= ~PNG_COLOR_MASK_COLOR;
|
||||||
|
row_info->pixel_depth = (png_byte)(row_info->channels *
|
||||||
|
row_info->bit_depth);
|
||||||
|
row_info->rowbytes = ((row_width *
|
||||||
|
row_info->pixel_depth + 7) >> 3);
|
||||||
|
}
|
||||||
|
return rgb_error;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth
|
/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth
|
||||||
* large of png_color. This lets grayscale images be treated as
|
* large of png_color. This lets grayscale images be treated as
|
||||||
* paletted. Most useful for gamma correction and simplification
|
* paletted. Most useful for gamma correction and simplification
|
||||||
@ -1975,8 +2246,7 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
|
|||||||
{
|
{
|
||||||
png_debug(1, "in png_correct_palette\n");
|
png_debug(1, "in png_correct_palette\n");
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
if ((png_ptr->transformations & (PNG_GAMMA)) &&
|
if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND))
|
||||||
(png_ptr->transformations & (PNG_BACKGROUND)))
|
|
||||||
{
|
{
|
||||||
png_color back, back_1;
|
png_color back, back_1;
|
||||||
|
|
||||||
@ -3451,13 +3721,18 @@ static int png_gamma_shift[] =
|
|||||||
void
|
void
|
||||||
png_build_gamma_table(png_structp png_ptr)
|
png_build_gamma_table(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_build_gamma_table\n");
|
png_debug(1, "in png_build_gamma_table\n");
|
||||||
|
if(png_ptr->gamma != 0.0)
|
||||||
|
{
|
||||||
if (png_ptr->bit_depth <= 8)
|
if (png_ptr->bit_depth <= 8)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
double g;
|
double g;
|
||||||
|
|
||||||
g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
|
if (png_ptr->screen_gamma > .000001)
|
||||||
|
g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
|
||||||
|
else
|
||||||
|
g = 1.0;
|
||||||
|
|
||||||
png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
|
png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)256);
|
(png_uint_32)256);
|
||||||
@ -3468,9 +3743,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
g) * 255.0 + .5);
|
g) * 255.0 + .5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|
||||||
if (png_ptr->transformations & PNG_BACKGROUND)
|
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
if (png_ptr->transformations & (PNG_BACKGROUND | PNG_RGB_TO_GRAY))
|
||||||
{
|
{
|
||||||
|
|
||||||
g = 1.0 / (png_ptr->gamma);
|
g = 1.0 / (png_ptr->gamma);
|
||||||
|
|
||||||
png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
|
png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
|
||||||
@ -3482,18 +3759,23 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
g) * 255.0 + .5);
|
g) * 255.0 + .5);
|
||||||
}
|
}
|
||||||
|
|
||||||
g = 1.0 / (png_ptr->screen_gamma);
|
|
||||||
|
|
||||||
png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
|
png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)256);
|
(png_uint_32)256);
|
||||||
|
|
||||||
|
if(png_ptr->screen_gamma > 0.000001)
|
||||||
|
g = 1.0 / png_ptr->screen_gamma;
|
||||||
|
else
|
||||||
|
g = png_ptr->gamma; /* probably doing rgb_to_gray */
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0,
|
png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0,
|
||||||
g) * 255.0 + .5);
|
g) * 255.0 + .5);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_BACKGROUND_SUPPORTED */
|
#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3535,13 +3817,15 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
|
|
||||||
num = (1 << (8 - shift));
|
num = (1 << (8 - shift));
|
||||||
|
|
||||||
g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
|
if (png_ptr->screen_gamma > .000001)
|
||||||
|
g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
|
||||||
|
else
|
||||||
|
g = 1.0;
|
||||||
|
|
||||||
png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
|
png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num * sizeof (png_uint_16p)));
|
(png_uint_32)(num * sizeof (png_uint_16p)));
|
||||||
|
|
||||||
if ((png_ptr->transformations & PNG_16_TO_8) &&
|
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
|
||||||
!(png_ptr->transformations & PNG_BACKGROUND))
|
|
||||||
{
|
{
|
||||||
double fin, fout;
|
double fin, fout;
|
||||||
png_uint_32 last, max;
|
png_uint_32 last, max;
|
||||||
@ -3591,9 +3875,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|
||||||
if (png_ptr->transformations & PNG_BACKGROUND)
|
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
if (png_ptr->transformations & (PNG_BACKGROUND | PNG_RGB_TO_GRAY))
|
||||||
{
|
{
|
||||||
|
|
||||||
g = 1.0 / (png_ptr->gamma);
|
g = 1.0 / (png_ptr->gamma);
|
||||||
|
|
||||||
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
|
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
|
||||||
@ -3613,7 +3899,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
65535.0, g) * 65535.0 + .5);
|
65535.0, g) * 65535.0 + .5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g = 1.0 / (png_ptr->screen_gamma);
|
|
||||||
|
if(png_ptr->screen_gamma > 0.000001)
|
||||||
|
g = 1.0 / png_ptr->screen_gamma;
|
||||||
|
else
|
||||||
|
g = png_ptr->gamma; /* probably doing rgb_to_gray */
|
||||||
|
|
||||||
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
|
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num * sizeof (png_uint_16p)));
|
(png_uint_32)(num * sizeof (png_uint_16p)));
|
||||||
@ -3633,8 +3923,9 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_BACKGROUND_SUPPORTED */
|
#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
137
pngrutil.c
137
pngrutil.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -424,7 +424,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
{
|
{
|
||||||
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
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
fprintf(stderr, "igamma = %lu\n", igamma);
|
fprintf(stderr, "igamma = %lu\n", igamma);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
@ -496,6 +496,9 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_ptr->sig_bit.gray = buf[0];
|
png_ptr->sig_bit.gray = buf[0];
|
||||||
|
png_ptr->sig_bit.red = buf[0];
|
||||||
|
png_ptr->sig_bit.green = buf[0];
|
||||||
|
png_ptr->sig_bit.blue = buf[0];
|
||||||
png_ptr->sig_bit.alpha = buf[1];
|
png_ptr->sig_bit.alpha = buf[1];
|
||||||
}
|
}
|
||||||
png_set_sBIT(png_ptr, info_ptr, &(png_ptr->sig_bit));
|
png_set_sBIT(png_ptr, info_ptr, &(png_ptr->sig_bit));
|
||||||
@ -624,7 +627,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
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
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
fprintf(stderr,"wx=%f, wy=%f, rx=%f, ry=%f\n",
|
fprintf(stderr,"wx=%f, wy=%f, rx=%f, ry=%f\n",
|
||||||
white_x, white_y, red_x, red_y);
|
white_x, white_y, red_x, red_y);
|
||||||
fprintf(stderr,"gx=%f, gy=%f, bx=%f, by=%f\n",
|
fprintf(stderr,"gx=%f, gy=%f, bx=%f, by=%f\n",
|
||||||
@ -693,7 +696,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
{
|
{
|
||||||
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
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
fprintf(stderr,"gamma=%f\n",png_ptr->gamma);
|
fprintf(stderr,"gamma=%f\n",png_ptr->gamma);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1890,7 +1893,6 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PNG_READ_SLOW_FILTERING
|
|
||||||
void
|
void
|
||||||
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
||||||
png_bytep prev_row, int filter)
|
png_bytep prev_row, int filter)
|
||||||
@ -2010,118 +2012,11 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
png_error(png_ptr, "Bad adaptive filter type");
|
png_warning(png_ptr, "Ignoring bad adaptive filter type");
|
||||||
|
*row=0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* PNG_READ_SLOW_FILTERING */
|
|
||||||
void
|
|
||||||
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
|
||||||
png_bytep prev_row, int filter)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_read_filter_row\n");
|
|
||||||
png_debug2(2,"row = %d, filter = %d\n", png_ptr->row_number, filter);
|
|
||||||
|
|
||||||
|
|
||||||
switch (filter)
|
|
||||||
{
|
|
||||||
case PNG_FILTER_VALUE_NONE:
|
|
||||||
break;
|
|
||||||
case PNG_FILTER_VALUE_SUB:
|
|
||||||
{
|
|
||||||
png_uint_32 i;
|
|
||||||
int bpp = (row_info->pixel_depth + 7) / 8;
|
|
||||||
png_bytep rp;
|
|
||||||
png_bytep lp;
|
|
||||||
|
|
||||||
for (i = (png_uint_32)bpp, rp = row + bpp, lp = row;
|
|
||||||
i < row_info->rowbytes; i++, rp++, lp++)
|
|
||||||
{
|
|
||||||
*rp = (png_byte)(((int)(*rp) + (int)(*lp)) & 0xff);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PNG_FILTER_VALUE_UP:
|
|
||||||
{
|
|
||||||
png_uint_32 i;
|
|
||||||
png_bytep rp;
|
|
||||||
png_bytep pp;
|
|
||||||
|
|
||||||
for (i = 0, rp = row, pp = prev_row;
|
|
||||||
i < row_info->rowbytes; i++, rp++, pp++)
|
|
||||||
{
|
|
||||||
*rp = (png_byte)(((int)(*rp) + (int)(*pp)) & 0xff);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PNG_FILTER_VALUE_AVG:
|
|
||||||
{
|
|
||||||
png_uint_32 i;
|
|
||||||
int bpp = (row_info->pixel_depth + 7) / 8;
|
|
||||||
png_bytep rp;
|
|
||||||
png_bytep pp;
|
|
||||||
png_bytep lp;
|
|
||||||
|
|
||||||
for (i = 0, rp = row, pp = prev_row;
|
|
||||||
i < (png_uint_32)bpp; i++, rp++, pp++)
|
|
||||||
{
|
|
||||||
*rp = (png_byte)(((int)(*rp) +
|
|
||||||
((int)(*pp) / 2)) & 0xff);
|
|
||||||
}
|
|
||||||
for (lp = row; i < row_info->rowbytes; i++, rp++, lp++, pp++)
|
|
||||||
{
|
|
||||||
*rp = (png_byte)(((int)(*rp) +
|
|
||||||
(int)(*pp + *lp) / 2) & 0xff);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PNG_FILTER_VALUE_PAETH:
|
|
||||||
{
|
|
||||||
int bpp = (row_info->pixel_depth + 7) / 8;
|
|
||||||
png_uint_32 i;
|
|
||||||
png_bytep rp;
|
|
||||||
png_bytep pp;
|
|
||||||
png_bytep lp;
|
|
||||||
png_bytep cp;
|
|
||||||
|
|
||||||
for (i = 0, rp = row, pp = prev_row,
|
|
||||||
lp = row - bpp, cp = prev_row - bpp;
|
|
||||||
i < row_info->rowbytes; i++, rp++, pp++, lp++, cp++)
|
|
||||||
{
|
|
||||||
int a, b, c, pa, pb, pc, p;
|
|
||||||
|
|
||||||
b = *pp;
|
|
||||||
if (i >= (png_uint_32)bpp)
|
|
||||||
{
|
|
||||||
c = *cp;
|
|
||||||
a = *lp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
a = c = 0;
|
|
||||||
}
|
|
||||||
p = a + b - c;
|
|
||||||
pa = abs(p - a);
|
|
||||||
pb = abs(p - b);
|
|
||||||
pc = abs(p - c);
|
|
||||||
|
|
||||||
if (pa <= pb && pa <= pc)
|
|
||||||
p = a;
|
|
||||||
else if (pb <= pc)
|
|
||||||
p = b;
|
|
||||||
else
|
|
||||||
p = c;
|
|
||||||
|
|
||||||
*rp = (png_byte)(((int)(*rp) + p) & 0xff);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
png_error(png_ptr, "Bad adaptive filter type");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* PNG_READ_SLOW_FILTERING */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
png_read_finish_row(png_structp png_ptr)
|
png_read_finish_row(png_structp png_ptr)
|
||||||
@ -2320,19 +2215,25 @@ png_read_start_row(png_structp png_ptr)
|
|||||||
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
|
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_GRAY_TO_RGB)
|
if (png_ptr->transformations & PNG_GRAY_TO_RGB)
|
||||||
{
|
{
|
||||||
if ((png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND)) ||
|
if (
|
||||||
png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
#if defined(PNG_READ_EXPAND_SUPPORTED)
|
||||||
|
(png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND)) ||
|
||||||
|
#endif
|
||||||
|
#if defined(PNG_READ_FILLER_SUPPORTED)
|
||||||
|
(png_ptr->transformations & (PNG_FILLER)) ||
|
||||||
|
#endif
|
||||||
|
png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
{
|
{
|
||||||
if (max_pixel_depth <= 16)
|
if (max_pixel_depth <= 16)
|
||||||
max_pixel_depth = 32;
|
max_pixel_depth = 32;
|
||||||
else if (max_pixel_depth <= 32)
|
else
|
||||||
max_pixel_depth = 64;
|
max_pixel_depth = 64;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (max_pixel_depth <= 8)
|
if (max_pixel_depth <= 8)
|
||||||
max_pixel_depth = 24;
|
max_pixel_depth = 24;
|
||||||
else if (max_pixel_depth <= 16)
|
else
|
||||||
max_pixel_depth = 48;
|
max_pixel_depth = 48;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
pngset.c
2
pngset.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 -June 14, 1998
|
* libpng 1.0.2a -December 29, 1998
|
||||||
* 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
|
||||||
@ -538,10 +538,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
fclose(fpout);
|
fclose(fpout);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
#ifdef USE_FAR_KEYWORD
|
||||||
|
png_memcpy(read_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
||||||
|
#endif
|
||||||
|
|
||||||
png_debug(0, "Setting jmpbuf for write struct\n");
|
png_debug(0, "Setting jmpbuf for write struct\n");
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
png_memcpy(read_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
|
||||||
if (setjmp(jmpbuf))
|
if (setjmp(jmpbuf))
|
||||||
#else
|
#else
|
||||||
if (setjmp(write_ptr->jmpbuf))
|
if (setjmp(write_ptr->jmpbuf))
|
||||||
@ -554,10 +556,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
fclose(fpout);
|
fclose(fpout);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
png_memcpy(write_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
png_memcpy(write_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(0, "Initializing input and output streams\n");
|
png_debug(0, "Initializing input and output streams\n");
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
png_init_io(read_ptr, fpin);
|
png_init_io(read_ptr, fpin);
|
||||||
@ -900,6 +902,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
fprintf(STDERR, "Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
|
fprintf(STDERR, "Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
|
||||||
fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION);
|
fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION);
|
||||||
|
fprintf(STDERR,"%s",png_get_copyright(NULL));
|
||||||
|
|
||||||
/* Do some consistency checking on the memory allocation settings, I'm
|
/* Do some consistency checking on the memory allocation settings, I'm
|
||||||
not sure this matters, but it is nice to know, the first of these
|
not sure this matters, but it is nice to know, the first of these
|
||||||
|
20
pngtrans.c
20
pngtrans.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* 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.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -99,6 +99,24 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
||||||
else
|
else
|
||||||
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
||||||
|
|
||||||
|
/* This should probably go in the "do_filler" routine.
|
||||||
|
* I attempted to do that in libpng-1.0.1a but that caused problems
|
||||||
|
* so I restored it in libpng-1.0.2a
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
{
|
||||||
|
png_ptr->usr_channels = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Also I added this in libpng-1.0.2a (what happens when we expand
|
||||||
|
* a less-than-8-bit grayscale to GA? */
|
||||||
|
|
||||||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
|
||||||
|
{
|
||||||
|
png_ptr->usr_channels = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
2
pngwio.c
2
pngwio.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
|
10
pngwtran.c
10
pngwtran.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -47,15 +47,15 @@ png_do_write_transformations(png_structp png_ptr)
|
|||||||
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
||||||
(png_uint_32)png_ptr->bit_depth);
|
(png_uint_32)png_ptr->bit_depth);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
|
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
||||||
|
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
|
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_SHIFT)
|
if (png_ptr->transformations & PNG_SHIFT)
|
||||||
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
||||||
&(png_ptr->shift));
|
&(png_ptr->shift));
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_WRITE_SWAP_SUPPORTED)
|
|
||||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
|
||||||
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
||||||
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.2 - June 14, 1998
|
* libpng 1.0.2a - December 29, 1998
|
||||||
* 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
|
||||||
@ -376,7 +376,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
|
|||||||
{
|
{
|
||||||
png_byte maxbits;
|
png_byte maxbits;
|
||||||
|
|
||||||
maxbits = color_type==PNG_COLOR_TYPE_PALETTE ? 8:png_ptr->usr_bit_depth;
|
maxbits = color_type==PNG_COLOR_TYPE_PALETTE ? 8 : png_ptr->usr_bit_depth;
|
||||||
if (sbit->red == 0 || sbit->red > maxbits ||
|
if (sbit->red == 0 || sbit->red > maxbits ||
|
||||||
sbit->green == 0 || sbit->green > maxbits ||
|
sbit->green == 0 || sbit->green > maxbits ||
|
||||||
sbit->blue == 0 || sbit->blue > maxbits)
|
sbit->blue == 0 || sbit->blue > maxbits)
|
||||||
|
@ -49,173 +49,3 @@ Test: @.pngtest
|
|||||||
|
|
||||||
|
|
||||||
# Dynamic dependencies:
|
# Dynamic dependencies:
|
||||||
o.pngtest: c.pngtest
|
|
||||||
o.pngtest: h.png
|
|
||||||
o.pngtest: Zlib:h.zlib
|
|
||||||
o.pngtest: Zlib:h.zconf
|
|
||||||
o.pngtest: h.pngconf
|
|
||||||
mm.png: LibPng:c.png
|
|
||||||
mm.png: LibPng:h.png
|
|
||||||
mm.png: Zlib:h.zlib
|
|
||||||
mm.png: Zlib:h.zconf
|
|
||||||
mm.png: LibPng:h.pngconf
|
|
||||||
mm.png: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngerror: LibPng:c.pngerror
|
|
||||||
mm.pngerror: LibPng:h.png
|
|
||||||
mm.pngerror: Zlib:h.zlib
|
|
||||||
mm.pngerror: Zlib:h.zconf
|
|
||||||
mm.pngerror: LibPng:h.pngconf
|
|
||||||
mm.pngerror: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngrio: LibPng:c.pngrio
|
|
||||||
mm.pngrio: LibPng:h.png
|
|
||||||
mm.pngrio: Zlib:h.zlib
|
|
||||||
mm.pngrio: Zlib:h.zconf
|
|
||||||
mm.pngrio: LibPng:h.pngconf
|
|
||||||
mm.pngrio: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngwio: LibPng:c.pngwio
|
|
||||||
mm.pngwio: LibPng:h.png
|
|
||||||
mm.pngwio: Zlib:h.zlib
|
|
||||||
mm.pngwio: Zlib:h.zconf
|
|
||||||
mm.pngwio: LibPng:h.pngconf
|
|
||||||
mm.pngwio: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngmem: LibPng:c.pngmem
|
|
||||||
mm.pngmem: LibPng:h.png
|
|
||||||
mm.pngmem: Zlib:h.zlib
|
|
||||||
mm.pngmem: Zlib:h.zconf
|
|
||||||
mm.pngmem: LibPng:h.pngconf
|
|
||||||
mm.pngmem: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngpread: LibPng:c.pngpread
|
|
||||||
mm.pngpread: LibPng:h.png
|
|
||||||
mm.pngpread: Zlib:h.zlib
|
|
||||||
mm.pngpread: Zlib:h.zconf
|
|
||||||
mm.pngpread: LibPng:h.pngconf
|
|
||||||
mm.pngpread: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngset: LibPng:c.pngset
|
|
||||||
mm.pngset: LibPng:h.png
|
|
||||||
mm.pngset: Zlib:h.zlib
|
|
||||||
mm.pngset: Zlib:h.zconf
|
|
||||||
mm.pngset: LibPng:h.pngconf
|
|
||||||
mm.pngset: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngget: LibPng:c.pngget
|
|
||||||
mm.pngget: LibPng:h.png
|
|
||||||
mm.pngget: Zlib:h.zlib
|
|
||||||
mm.pngget: Zlib:h.zconf
|
|
||||||
mm.pngget: LibPng:h.pngconf
|
|
||||||
mm.pngget: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngread: LibPng:c.pngread
|
|
||||||
mm.pngread: LibPng:h.png
|
|
||||||
mm.pngread: Zlib:h.zlib
|
|
||||||
mm.pngread: Zlib:h.zconf
|
|
||||||
mm.pngread: LibPng:h.pngconf
|
|
||||||
mm.pngread: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngrtran: LibPng:c.pngrtran
|
|
||||||
mm.pngrtran: LibPng:h.png
|
|
||||||
mm.pngrtran: Zlib:h.zlib
|
|
||||||
mm.pngrtran: Zlib:h.zconf
|
|
||||||
mm.pngrtran: LibPng:h.pngconf
|
|
||||||
mm.pngrtran: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngrutil: LibPng:c.pngrutil
|
|
||||||
mm.pngrutil: LibPng:h.png
|
|
||||||
mm.pngrutil: Zlib:h.zlib
|
|
||||||
mm.pngrutil: Zlib:h.zconf
|
|
||||||
mm.pngrutil: LibPng:h.pngconf
|
|
||||||
mm.pngrutil: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngtrans: LibPng:c.pngtrans
|
|
||||||
mm.pngtrans: LibPng:h.png
|
|
||||||
mm.pngtrans: Zlib:h.zlib
|
|
||||||
mm.pngtrans: Zlib:h.zconf
|
|
||||||
mm.pngtrans: LibPng:h.pngconf
|
|
||||||
mm.pngtrans: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngwrite: LibPng:c.pngwrite
|
|
||||||
mm.pngwrite: LibPng:h.png
|
|
||||||
mm.pngwrite: Zlib:h.zlib
|
|
||||||
mm.pngwrite: Zlib:h.zconf
|
|
||||||
mm.pngwrite: LibPng:h.pngconf
|
|
||||||
mm.pngwrite: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngwtran: LibPng:c.pngwtran
|
|
||||||
mm.pngwtran: LibPng:h.png
|
|
||||||
mm.pngwtran: Zlib:h.zlib
|
|
||||||
mm.pngwtran: Zlib:h.zconf
|
|
||||||
mm.pngwtran: LibPng:h.pngconf
|
|
||||||
mm.pngwtran: MemCheck:ANSI.h.stdio
|
|
||||||
mm.pngwutil: LibPng:c.pngwutil
|
|
||||||
mm.pngwutil: LibPng:h.png
|
|
||||||
mm.pngwutil: Zlib:h.zlib
|
|
||||||
mm.pngwutil: Zlib:h.zconf
|
|
||||||
mm.pngwutil: LibPng:h.pngconf
|
|
||||||
mm.pngwutil: MemCheck:ANSI.h.stdio
|
|
||||||
o.png: c.png
|
|
||||||
o.png: h.png
|
|
||||||
o.png: Zlib:h.zlib
|
|
||||||
o.png: Zlib:h.zconf
|
|
||||||
o.png: h.pngconf
|
|
||||||
o.pngerror: c.pngerror
|
|
||||||
o.pngerror: h.png
|
|
||||||
o.pngerror: Zlib:h.zlib
|
|
||||||
o.pngerror: Zlib:h.zconf
|
|
||||||
o.pngerror: h.pngconf
|
|
||||||
o.pngrio: c.pngrio
|
|
||||||
o.pngrio: h.png
|
|
||||||
o.pngrio: Zlib:h.zlib
|
|
||||||
o.pngrio: Zlib:h.zconf
|
|
||||||
o.pngrio: h.pngconf
|
|
||||||
o.pngwio: c.pngwio
|
|
||||||
o.pngwio: h.png
|
|
||||||
o.pngwio: Zlib:h.zlib
|
|
||||||
o.pngwio: Zlib:h.zconf
|
|
||||||
o.pngwio: h.pngconf
|
|
||||||
o.pngmem: c.pngmem
|
|
||||||
o.pngmem: h.png
|
|
||||||
o.pngmem: Zlib:h.zlib
|
|
||||||
o.pngmem: Zlib:h.zconf
|
|
||||||
o.pngmem: h.pngconf
|
|
||||||
o.pngpread: c.pngpread
|
|
||||||
o.pngpread: h.png
|
|
||||||
o.pngpread: Zlib:h.zlib
|
|
||||||
o.pngpread: Zlib:h.zconf
|
|
||||||
o.pngpread: h.pngconf
|
|
||||||
o.pngset: c.pngset
|
|
||||||
o.pngset: h.png
|
|
||||||
o.pngset: Zlib:h.zlib
|
|
||||||
o.pngset: Zlib:h.zconf
|
|
||||||
o.pngset: h.pngconf
|
|
||||||
o.pngget: c.pngget
|
|
||||||
o.pngget: h.png
|
|
||||||
o.pngget: Zlib:h.zlib
|
|
||||||
o.pngget: Zlib:h.zconf
|
|
||||||
o.pngget: h.pngconf
|
|
||||||
o.pngread: c.pngread
|
|
||||||
o.pngread: h.png
|
|
||||||
o.pngread: Zlib:h.zlib
|
|
||||||
o.pngread: Zlib:h.zconf
|
|
||||||
o.pngread: h.pngconf
|
|
||||||
o.pngrtran: c.pngrtran
|
|
||||||
o.pngrtran: h.png
|
|
||||||
o.pngrtran: Zlib:h.zlib
|
|
||||||
o.pngrtran: Zlib:h.zconf
|
|
||||||
o.pngrtran: h.pngconf
|
|
||||||
o.pngrutil: c.pngrutil
|
|
||||||
o.pngrutil: h.png
|
|
||||||
o.pngrutil: Zlib:h.zlib
|
|
||||||
o.pngrutil: Zlib:h.zconf
|
|
||||||
o.pngrutil: h.pngconf
|
|
||||||
o.pngtrans: c.pngtrans
|
|
||||||
o.pngtrans: h.png
|
|
||||||
o.pngtrans: Zlib:h.zlib
|
|
||||||
o.pngtrans: Zlib:h.zconf
|
|
||||||
o.pngtrans: h.pngconf
|
|
||||||
o.pngwrite: c.pngwrite
|
|
||||||
o.pngwrite: h.png
|
|
||||||
o.pngwrite: Zlib:h.zlib
|
|
||||||
o.pngwrite: Zlib:h.zconf
|
|
||||||
o.pngwrite: h.pngconf
|
|
||||||
o.pngwtran: c.pngwtran
|
|
||||||
o.pngwtran: h.png
|
|
||||||
o.pngwtran: Zlib:h.zlib
|
|
||||||
o.pngwtran: Zlib:h.zconf
|
|
||||||
o.pngwtran: h.pngconf
|
|
||||||
o.pngwutil: c.pngwutil
|
|
||||||
o.pngwutil: h.png
|
|
||||||
o.pngwutil: Zlib:h.zlib
|
|
||||||
o.pngwutil: Zlib:h.zconf
|
|
||||||
o.pngwutil: h.pngconf
|
|
||||||
|
@ -9,6 +9,7 @@ LBR = png.lib
|
|||||||
LDFLAGS=-lpng -lz -lm
|
LDFLAGS=-lpng -lz -lm
|
||||||
|
|
||||||
# where make install puts libpng.a and png.h
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
|
OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
|
||||||
$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
|
$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
|
||||||
@ -28,4 +29,5 @@ install: libpng.a
|
|||||||
-@mkdir $(prefix)/lib
|
-@mkdir $(prefix)/lib
|
||||||
cp png.h $(prefix)/include
|
cp png.h $(prefix)/include
|
||||||
cp pngconf.h $(prefix)/include
|
cp pngconf.h $(prefix)/include
|
||||||
chmod 644 $(prefix)/include/p
|
chmod 644 $(prefix)/include/png.h
|
||||||
|
chmod 644 $(prefix)/include/pngconf.h
|
||||||
|
@ -100,7 +100,7 @@ LIBOBJS = \
|
|||||||
+pngtrans.$(O) \
|
+pngtrans.$(O) \
|
||||||
+pngwrite.$(O) \
|
+pngwrite.$(O) \
|
||||||
+pngwtran.$(O) \
|
+pngwtran.$(O) \
|
||||||
+pngwio.$(O)
|
+pngwio.$(O) \
|
||||||
+pngwutil.$(O)
|
+pngwutil.$(O)
|
||||||
|
|
||||||
LIBNAME=libpng$(MODEL).lib
|
LIBNAME=libpng$(MODEL).lib
|
||||||
@ -121,7 +121,7 @@ libpng: $(LIBNAME)
|
|||||||
|
|
||||||
pngtest: pngtest$(MODEL).exe
|
pngtest: pngtest$(MODEL).exe
|
||||||
|
|
||||||
test:
|
test: pngtest$(MODEL).exe
|
||||||
pngtest$(MODEL)
|
pngtest$(MODEL)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,12 +2,21 @@
|
|||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
#ZLIBLIB=/usr/local/lib
|
#ZLIBLIB=/usr/local/lib
|
||||||
#ZLIBINC=/usr/local/include
|
#ZLIBINC=/usr/local/include
|
||||||
ZLIBLIB=../zlib
|
ZLIBLIB=../zlib
|
||||||
ZLIBINC=../zlib
|
ZLIBINC=../zlib
|
||||||
|
|
||||||
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
|
# have to change it.
|
||||||
|
PNGMAJ = 2
|
||||||
|
PNGMIN = 1.0.2a
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
@ -15,26 +24,33 @@ LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
|||||||
#RANLIB=echo
|
#RANLIB=echo
|
||||||
RANLIB=ranlib
|
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 \
|
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.a pngtest
|
all: libpng.so libpng.a pngtest
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
libpng.so: libpng.so.$(PNGMAJ)
|
||||||
|
ln -s -f libpng.so.$(PNGMAJ) libpng.so
|
||||||
|
|
||||||
|
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
||||||
|
ln -s -f libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
||||||
|
|
||||||
|
libpng.so.$(PNGVER): $(OBJS)
|
||||||
|
$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) -lz -lm
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.a
|
pngtest: pngtest.o libpng.a
|
||||||
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
test: pngtest
|
test: pngtest
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install: libpng.a
|
install: libpng.a libpng.so.$(PNGVER)
|
||||||
-@mkdir $(prefix)/include
|
-@mkdir $(prefix)/include
|
||||||
-@mkdir $(prefix)/lib
|
-@mkdir $(prefix)/lib
|
||||||
cp png.h $(prefix)/include
|
cp png.h $(prefix)/include
|
||||||
@ -42,10 +58,15 @@ install: libpng.a
|
|||||||
chmod 644 $(prefix)/include/png.h
|
chmod 644 $(prefix)/include/png.h
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
chmod 644 $(prefix)/include/pngconf.h
|
||||||
cp libpng.a $(prefix)/lib
|
cp libpng.a $(prefix)/lib
|
||||||
|
cp libpng.so.$(PNGVER) $(prefix)/lib
|
||||||
chmod 644 $(prefix)/lib/libpng.a
|
chmod 644 $(prefix)/lib/libpng.a
|
||||||
|
chmod 644 $(prefix)/lib/libpng.so.$(PNGVER)
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
|
||||||
|
(cd $(LIBPATH); ln -s -f libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
||||||
|
ln -s -f libpng.so.$(PNGMAJ) libpng.so)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a pngtest pngout.png
|
rm -f *.o libpng.a pngtest pngout.png libpng.so*
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
#prefix=/usr/local
|
||||||
|
prefix=.
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-I../zlib -O
|
CFLAGS=-I../zlib -O
|
||||||
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
|
||||||
# where make install puts libpng.a and png.h
|
|
||||||
#prefix=/usr/local
|
|
||||||
prefix=.
|
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
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 \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o pngwtran.o \
|
||||||
pngmem.o pngerror.o pngpread.o
|
pngmem.o pngerror.o pngpread.o
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-I../zlib -O
|
CFLAGS=-I../zlib -O
|
||||||
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
||||||
@ -11,9 +14,6 @@ ANSI2KNRFLAGS=
|
|||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
#RANLIB=echo
|
#RANLIB=echo
|
||||||
|
|
||||||
# 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 \
|
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
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
|
|
||||||
|
# where make install puts libpng.a, libpng.so*, and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
#ZLIBLIB=/usr/local/lib
|
#ZLIBLIB=/usr/local/lib
|
||||||
#ZLIBINC=/usr/local/include
|
#ZLIBINC=/usr/local/include
|
||||||
@ -29,11 +32,9 @@ RANLIB=ranlib
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.2
|
PNGMIN = 1.0.2a
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng.so*, and png.h
|
|
||||||
prefix=/usr/local
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
LIBPATH=$(prefix)/lib
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
@ -55,14 +56,14 @@ libpng.a: $(OBJS)
|
|||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.so: libpng.so.$(PNGMAJ)
|
libpng.so: libpng.so.$(PNGMAJ)
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so
|
ln -s -f libpng.so.$(PNGMAJ) libpng.so
|
||||||
|
|
||||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
ln -s -f libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.so.$(PNGVER): $(OBJSDLL)
|
libpng.so.$(PNGVER): $(OBJSDLL)
|
||||||
$(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
|
$(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
|
||||||
$(OBJSDLL)
|
$(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.so
|
pngtest: pngtest.o libpng.so
|
||||||
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
@ -77,8 +78,8 @@ install: libpng.a libpng.so.$(PNGVER)
|
|||||||
cp libpng.a 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 -f $(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 -s -f libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
ln -s -f libpng.so.$(PNGMAJ) libpng.so)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-I../zlib -O -systype sysv -DSYSV -w -Dmips
|
CFLAGS=-I../zlib -O -systype sysv -DSYSV -w -Dmips
|
||||||
#CFLAGS=-O
|
#CFLAGS=-O
|
||||||
@ -10,9 +13,6 @@ LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
|||||||
#RANLIB=ranlib
|
#RANLIB=ranlib
|
||||||
RANLIB=echo
|
RANLIB=echo
|
||||||
|
|
||||||
# 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 \
|
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
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
|
|
||||||
|
# where make install puts libpng.a, libpng.so*, and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
# Changing these to ../zlib poses a security risk. If you want
|
# Changing these to ../zlib poses a security risk. If you want
|
||||||
# to have zlib in an adjacent directory, specify the full path instead of "..".
|
# to have zlib in an adjacent directory, specify the full path instead of "..".
|
||||||
@ -15,7 +18,6 @@ CC=gcc
|
|||||||
ZLIBLIB=/usr/local/lib
|
ZLIBLIB=/usr/local/lib
|
||||||
ZLIBINC=/usr/local/include
|
ZLIBINC=/usr/local/include
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
@ -29,11 +31,9 @@ RANLIB=echo
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.2
|
PNGMIN = 1.0.2a
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng.so*, and png.h
|
|
||||||
prefix=/usr/local
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
LIBPATH=$(prefix)/lib
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
@ -55,10 +55,10 @@ libpng.a: $(OBJS)
|
|||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.so: libpng.so.$(PNGMAJ)
|
libpng.so: libpng.so.$(PNGMAJ)
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so
|
ln -s -f libpng.so.$(PNGMAJ) libpng.so
|
||||||
|
|
||||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
ln -s -f libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.so.$(PNGVER): $(OBJSDLL)
|
libpng.so.$(PNGVER): $(OBJSDLL)
|
||||||
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.$(PNGMAJ) \
|
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.$(PNGMAJ) \
|
||||||
@ -77,8 +77,8 @@ install: libpng.a libpng.so.$(PNGVER)
|
|||||||
cp libpng.a 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 -f $(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 -s -f libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
ln -s -f libpng.so.$(PNGMAJ) libpng.so)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
|
|
||||||
|
# where make install puts libpng.a, libpng.so*, and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
#ZLIBLIB=/usr/local/lib
|
#ZLIBLIB=/usr/local/lib
|
||||||
#ZLIBINC=/usr/local/include
|
#ZLIBINC=/usr/local/include
|
||||||
@ -22,11 +25,9 @@ RANLIB=echo
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.2
|
PNGMIN = 1.0.2a
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng.so*, and png.h
|
|
||||||
prefix=/usr/local
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
LIBPATH=$(prefix)/lib
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
@ -48,10 +49,10 @@ libpng.a: $(OBJS)
|
|||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.so: libpng.so.$(PNGMAJ)
|
libpng.so: libpng.so.$(PNGMAJ)
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so
|
ln -s -f libpng.so.$(PNGMAJ) libpng.so
|
||||||
|
|
||||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
ln -s -f libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.so.$(PNGVER): $(OBJSDLL)
|
libpng.so.$(PNGVER): $(OBJSDLL)
|
||||||
$(CC) -G -Wl,-h,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
|
$(CC) -G -Wl,-h,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
|
||||||
@ -70,8 +71,8 @@ install: libpng.a libpng.so.$(PNGVER)
|
|||||||
cp libpng.a 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 -f $(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 -s -f libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
ln -s -f libpng.so.$(PNGMAJ) libpng.so)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
#ZLIBLIB=/usr/local/lib
|
#ZLIBLIB=/usr/local/lib
|
||||||
#ZLIBINC=/usr/local/include
|
#ZLIBINC=/usr/local/include
|
||||||
@ -17,9 +20,6 @@ LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
|||||||
RANLIB=echo
|
RANLIB=echo
|
||||||
#RANLIB=ranlib
|
#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 \
|
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
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
#ZLIBLIB=/usr/local/lib
|
#ZLIBLIB=/usr/local/lib
|
||||||
#ZLIBINC=/usr/local/include
|
#ZLIBINC=/usr/local/include
|
||||||
@ -15,9 +18,6 @@ LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
|||||||
#RANLIB=echo
|
#RANLIB=echo
|
||||||
RANLIB=ranlib
|
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 \
|
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
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
#ZLIBLIB=/usr/local/lib
|
#ZLIBLIB=/usr/local/lib
|
||||||
#ZLIBINC=/usr/local/include
|
#ZLIBINC=/usr/local/include
|
||||||
@ -19,9 +22,6 @@ LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
|||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
#RANLIB=echo
|
#RANLIB=echo
|
||||||
|
|
||||||
# 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 \
|
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
|
||||||
|
@ -14,7 +14,7 @@ LDFLAGS=
|
|||||||
O=.obj
|
O=.obj
|
||||||
|
|
||||||
#uncomment next to put error messages in a file
|
#uncomment next to put error messages in a file
|
||||||
ERRFILE= >> pngerrs
|
#ERRFILE= >> pngerrs
|
||||||
|
|
||||||
# variables
|
# variables
|
||||||
OBJS1 = png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)
|
OBJS1 = png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)
|
||||||
|
@ -3,7 +3,7 @@ unit pngdef;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
PNG_LIBPNG_VER_STRING = '1.0.2';
|
PNG_LIBPNG_VER_STRING = '1.0.2a';
|
||||||
PNG_LIBPNG_VER = 10001;
|
PNG_LIBPNG_VER = 10001;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -259,6 +259,10 @@ function png_create_read_struct(user_png_ver: png_charp;
|
|||||||
error_ptr: user_error_ptr; error_fn: png_error_ptr;
|
error_ptr: user_error_ptr; error_fn: png_error_ptr;
|
||||||
warn_fn: png_error_ptr): png_structp;
|
warn_fn: png_error_ptr): png_structp;
|
||||||
stdcall;
|
stdcall;
|
||||||
|
function png_get_copyright(png_ptr: png_structp): png_charp;
|
||||||
|
stdcall;
|
||||||
|
function png_get_header_version(png_ptr: png_structp): png_charp;
|
||||||
|
stdcall;
|
||||||
function png_create_write_struct(user_png_ver: png_charp;
|
function png_create_write_struct(user_png_ver: png_charp;
|
||||||
error_ptr: user_error_ptr; error_fn: png_error_ptr;
|
error_ptr: user_error_ptr; error_fn: png_error_ptr;
|
||||||
warn_fn: png_error_ptr): png_structp;
|
warn_fn: png_error_ptr): png_structp;
|
||||||
@ -343,6 +347,8 @@ function png_get_pixels_per_meter(png_ptr: png_structp;
|
|||||||
stdcall;
|
stdcall;
|
||||||
function png_get_progressive_ptr(png_ptr: png_structp): png_voidp;
|
function png_get_progressive_ptr(png_ptr: png_structp): png_voidp;
|
||||||
stdcall;
|
stdcall;
|
||||||
|
function png_get_rgb_to_gray_status(png_ptr: png_structp);
|
||||||
|
stdcall;
|
||||||
function png_get_rowbytes(png_ptr: png_structp; info_ptr: png_infop):
|
function png_get_rowbytes(png_ptr: png_structp; info_ptr: png_infop):
|
||||||
png_uint_32;
|
png_uint_32;
|
||||||
stdcall;
|
stdcall;
|
||||||
@ -510,6 +516,8 @@ procedure png_set_read_status_fn(png_ptr: png_structp;
|
|||||||
procedure png_set_read_user_transform_fn(png_ptr: png_structp;
|
procedure png_set_read_user_transform_fn(png_ptr: png_structp;
|
||||||
read_user_transform_fn: png_user_transform_ptr);
|
read_user_transform_fn: png_user_transform_ptr);
|
||||||
stdcall;
|
stdcall;
|
||||||
|
procedure png_set_rgb_to_gray(png_ptr: png_structp; int: error_action);
|
||||||
|
stdcall;
|
||||||
procedure png_set_sBIT(png_ptr: png_structp; info_ptr: png_infop;
|
procedure png_set_sBIT(png_ptr: png_structp; info_ptr: png_infop;
|
||||||
sig_bits: png_color_8p);
|
sig_bits: png_color_8p);
|
||||||
stdcall;
|
stdcall;
|
||||||
|
@ -29,7 +29,7 @@ EXPORTS
|
|||||||
png_set_expand
|
png_set_expand
|
||||||
png_set_bgr
|
png_set_bgr
|
||||||
png_set_gray_to_rgb
|
png_set_gray_to_rgb
|
||||||
; png_set_rgb_to_gray
|
png_set_rgb_to_gray
|
||||||
png_build_grayscale_palette
|
png_build_grayscale_palette
|
||||||
png_set_strip_alpha
|
png_set_strip_alpha
|
||||||
png_set_swap_alpha
|
png_set_swap_alpha
|
||||||
@ -72,8 +72,10 @@ EXPORTS
|
|||||||
png_set_compression_window_bits
|
png_set_compression_window_bits
|
||||||
png_set_compression_method
|
png_set_compression_method
|
||||||
png_init_io
|
png_init_io
|
||||||
|
png_get_copyright
|
||||||
png_set_error_fn
|
png_set_error_fn
|
||||||
png_get_error_ptr
|
png_get_error_ptr
|
||||||
|
png_get_header_version
|
||||||
; png_get_mem_fn
|
; png_get_mem_fn
|
||||||
; png_set_mem_fn
|
; png_set_mem_fn
|
||||||
png_set_write_fn
|
png_set_write_fn
|
||||||
@ -112,6 +114,7 @@ EXPORTS
|
|||||||
png_get_compression_type
|
png_get_compression_type
|
||||||
png_get_pixels_per_meter
|
png_get_pixels_per_meter
|
||||||
png_get_pixel_aspect_ratio
|
png_get_pixel_aspect_ratio
|
||||||
|
png_get_rgb_to_gray_status
|
||||||
png_get_x_offset_pixels
|
png_get_x_offset_pixels
|
||||||
png_get_y_offset_pixels
|
png_get_y_offset_pixels
|
||||||
png_get_x_offset_microns
|
png_get_x_offset_microns
|
||||||
@ -202,7 +205,7 @@ EXPORTS
|
|||||||
png_do_strip_filler
|
png_do_strip_filler
|
||||||
png_do_swap
|
png_do_swap
|
||||||
png_do_packswap
|
png_do_packswap
|
||||||
; png_do_rgb_to_gray
|
png_do_rgb_to_gray
|
||||||
png_do_gray_to_rgb
|
png_do_gray_to_rgb
|
||||||
png_do_unpack
|
png_do_unpack
|
||||||
png_do_unshift
|
png_do_unshift
|
||||||
|
Reference in New Issue
Block a user