import of libpng-1.2.4
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/LIBPNG@16093 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,53 +1,30 @@
|
|||||||
|
|
||||||
Libpng 1.0.3 - January 14, 1999
|
Libpng 1.2.4 - July 8, 2002
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
Changes since the previous public release (1.0.2):
|
Changes since the last public release (1.2.3):
|
||||||
|
|
||||||
libpng-1.0.3:
|
Added libpng.pc and libpng-config to "all:" target in 16 makefiles.
|
||||||
|
Fixed bug in 16 makefiles: $(DESTDIR)/$(LIBPATH) to $(DESTDIR)$(LIBPATH)
|
||||||
Replaced and extended code that was removed from png_set_filler() in 1.0.1a.
|
Added missing "\" before closing double quote in makefile.gcmmx.
|
||||||
Fixed a bug in png_do_filler() that made it fail to write filler bytes in
|
Plugged various memory leaks; added png_malloc_warn() and png_set_text_2()
|
||||||
the left-most pixel of each row (Kevin Bracey).
|
functions.
|
||||||
Changed "static pngcharp tIME_string" to "static char tIME_string[30]"
|
Plugged memory leak of png_ptr->current_text (Matt Holgate).
|
||||||
in pngtest.c (Duncan Simpson).
|
Check for buffer overflow before reading CRC in pngpread.c (Warwick Allison)
|
||||||
Fixed a bug in pngtest.c that caused pngtest to try to write a tIME chunk
|
Added -soname to the loader flags in makefile.dec, makefile.sgi, and
|
||||||
even when no tIME chunk was present in the source file.
|
makefile.sggcc.
|
||||||
Fixed a problem in pngrutil.c: gray_to_rgb didn't always work with 16-bit.
|
Added "test-installed" targets to makefile.linux, makefile.gcmmx,
|
||||||
Fixed a problem in png_read_push_finish_row(), which would not skip some
|
makefile.sgi, makefile.sggcc, makefile.32sunu, makefile.64sunu,
|
||||||
passes that it should skip, for images that are less than 3 pixels high.
|
makefile.beos, makefile.darwin, makefile.dec, makefile.macosx,
|
||||||
Interchanged the order of calls to png_do_swap() and png_do_shift()
|
makefile.solaris, makefile.sco, makefile.cygwin, makefile.hpux,
|
||||||
in pngwtran.c (John Cromer).
|
makefile.hpgcc, and makefile.so9.
|
||||||
Added #ifdef PNG_DEBUG/#endif surrounding use of PNG_DEBUG in png.h .
|
Plugged memory leak of row_buf in pngtest.c when there is a png_error().
|
||||||
Changed "bad adaptive filter type" from error to warning in pngrutil.c .
|
Detect buffer overflow in pngpread.c when IDAT is corrupted with extra data.
|
||||||
Fixed a documentation error about default filtering with 8-bit indexed-color.
|
Revised pnggccrd.c to be able to back out version 1.0.x via PNG_1_0_X macro.
|
||||||
Separated the PNG_NO_STDIO macro into PNG_NO_STDIO and PNG_NO_CONSOLE_IO
|
Changed png_warning() to png_error() when width is too large to process.
|
||||||
(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.
|
|
||||||
Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h
|
|
||||||
Added "if" tests to silence complaints about unused png_ptr in png.h and png.c
|
|
||||||
Changed "check_if_png" function in example.c to return true (nonzero) if PNG.
|
|
||||||
Changed libpng.txt to demonstrate png_sig_cmp() instead of png_check_sig()
|
|
||||||
which is obsolete.
|
|
||||||
Added makefile.hux, for Hewlett Packard HPUX 10.20 and 11.00 (Jim Rice)
|
|
||||||
Added a statement of Y2K compliance in png.h, libpng.1, and Y2KINFO.
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
Send comments/corrections/commendations to
|
||||||
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
|
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||||
|
|
||||||
Glenn R-P
|
Glenn R-P
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
|
||||||
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
|
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
|
||||||
libpng maintainer
|
|
||||||
PNG Development Group
|
|
||||||
|
870
src/png/CHANGES
870
src/png/CHANGES
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
CHANGES - changes for libpng
|
CHANGES - changes for libpng
|
||||||
|
|
||||||
version 0.2
|
version 0.2
|
||||||
@@ -123,6 +124,7 @@ version 0.90 [January, 1997]
|
|||||||
- all chunk handling routines have the same prototypes, so we will
|
- all chunk handling routines have the same prototypes, so we will
|
||||||
be able to handle all chunks via a callback mechanism
|
be able to handle all chunks via a callback mechanism
|
||||||
try to fix Linux "setjmp" buffer size problems
|
try to fix Linux "setjmp" buffer size problems
|
||||||
|
removed png_large_malloc, png_large_free, and png_realloc functions.
|
||||||
version 0.95 [March, 1997]
|
version 0.95 [March, 1997]
|
||||||
fixed bug in pngwutil.c allocating "up_row" twice and "avg_row" never
|
fixed bug in pngwutil.c allocating "up_row" twice and "avg_row" never
|
||||||
fixed bug in PNG file signature compares when start != 0
|
fixed bug in PNG file signature compares when start != 0
|
||||||
@@ -259,6 +261,7 @@ version 0.99h [March 6, 1998, evening]
|
|||||||
Minor changes to previous minor changes to pngtest.c
|
Minor changes to previous minor changes to pngtest.c
|
||||||
Changed PNG_READ_NOT_FULLY_SUPPORTED to PNG_READ_TRANSFORMS_NOT_SUPPORTED
|
Changed PNG_READ_NOT_FULLY_SUPPORTED to PNG_READ_TRANSFORMS_NOT_SUPPORTED
|
||||||
and added PNG_PROGRESSIVE_READ_NOT_SUPPORTED macro
|
and added PNG_PROGRESSIVE_READ_NOT_SUPPORTED macro
|
||||||
|
Added user transform capability
|
||||||
version 1.00 [March 7, 1998]
|
version 1.00 [March 7, 1998]
|
||||||
Changed several typedefs in pngrutil.c
|
Changed several typedefs in pngrutil.c
|
||||||
Added makefile.wat (Pawel Mrochen), updated makefile.tc3 (Willem van Schaik)
|
Added makefile.wat (Pawel Mrochen), updated makefile.tc3 (Willem van Schaik)
|
||||||
@@ -283,6 +286,871 @@ version 1.0.0b [March 13, 1998]
|
|||||||
Minor changes to makefile.s2x
|
Minor changes to makefile.s2x
|
||||||
Removed #ifdef/#endif around a png_free() in pngread.c
|
Removed #ifdef/#endif around a png_free() in pngread.c
|
||||||
version 1.0.1 [March 14, 1998]
|
version 1.0.1 [March 14, 1998]
|
||||||
Changes makefile.s2x to reduce security risk of using a relative pathname
|
Changed makefile.s2x to reduce security risk of using a relative pathname
|
||||||
Fixed some typos in the documentation (Greg).
|
Fixed some typos in the documentation (Greg).
|
||||||
Fixed a problem with value of "channels" returned by png_read_update_info()
|
Fixed a problem with value of "channels" returned by png_read_update_info()
|
||||||
|
version 1.0.1a [April 21, 1998]
|
||||||
|
Optimized Paeth calculations by replacing abs() function calls with intrinsics
|
||||||
|
plus other loop optimizations. Improves avg decoding speed by about 20%.
|
||||||
|
Commented out i386istic "align" compiler flags in makefile.lnx.
|
||||||
|
Reduced the default warning level in some makefiles, to make them consistent.
|
||||||
|
Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
|
||||||
|
Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation.
|
||||||
|
Added grayscale and 16-bit capability to png_do_read_filler().
|
||||||
|
Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes
|
||||||
|
too large when writing an image with bit_depth < 8 (Bob Dellaca).
|
||||||
|
Corrected some bugs in the experimental weighted filtering heuristics.
|
||||||
|
Moved a misplaced pngrutil code block that truncates tRNS if it has more
|
||||||
|
than num_palette entries -- test was done before num_palette was defined.
|
||||||
|
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
|
||||||
|
Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen).
|
||||||
|
version 1.0.1b [May 2, 1998]
|
||||||
|
Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg).
|
||||||
|
Relocated the png_composite macros from pngrtran.c to png.h (Greg).
|
||||||
|
Added makefile.sco (contributed by Mike Hopkirk).
|
||||||
|
Fixed two bugs (missing definitions of "istop") introduced in libpng-1.0.1a.
|
||||||
|
Fixed a bug in pngrtran.c that would set channels=5 under some circumstances.
|
||||||
|
More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
|
||||||
|
More work on loop optimization which may help when compiled with C++ compilers.
|
||||||
|
Added warnings when people try to use transforms they've defined out.
|
||||||
|
Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran.
|
||||||
|
Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg)
|
||||||
|
version 1.0.1c [May 11, 1998]
|
||||||
|
Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for
|
||||||
|
filler bytes should have been 0xff instead of 0xf.
|
||||||
|
Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images.
|
||||||
|
Moved PNG_WRITE_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED
|
||||||
|
out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h
|
||||||
|
Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED,
|
||||||
|
for consistency, in pngconf.h
|
||||||
|
Added individual "ifndef PNG_NO_[CAPABILITY]" 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().
|
||||||
|
version 1.0.1d [May 24, 1998]
|
||||||
|
Corrected several statements that used side effects illegally in pngrutil.c
|
||||||
|
and pngtrans.c, that were introduced in version 1.0.1b
|
||||||
|
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.
|
||||||
|
version 1.0.1e [June 6, 1998]
|
||||||
|
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).
|
||||||
|
version 1.0.2 [June 14, 1998]
|
||||||
|
Fixed two bugs in makefile.bor .
|
||||||
|
version 1.0.2a [December 30, 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 bug in pngtest.c that caused pngtest to try to write a tIME chunk
|
||||||
|
even when no tIME chunk was present in the source file.
|
||||||
|
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.
|
||||||
|
version 1.0.2a [January 6, 1999]
|
||||||
|
Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h
|
||||||
|
Added "if" tests to silence complaints about unused png_ptr in png.h and png.c
|
||||||
|
Changed "check_if_png" function in example.c to return true (nonzero) if PNG.
|
||||||
|
Changed libpng.txt to demonstrate png_sig_cmp() instead of png_check_sig()
|
||||||
|
which is obsolete.
|
||||||
|
version 1.0.3 [January 14, 1999]
|
||||||
|
Added makefile.hux, for Hewlett Packard HPUX 10.20 and 11.00 (Jim Rice)
|
||||||
|
Added a statement of Y2K compliance in png.h, libpng.3, and Y2KINFO.
|
||||||
|
version 1.0.3a [August 12, 1999]
|
||||||
|
Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning
|
||||||
|
if an attempt is made to read an interlaced image when it's not supported.
|
||||||
|
Added check if png_ptr->trans is defined before freeing it in pngread.c
|
||||||
|
Modified the Y2K statement to include versions back to version 0.71
|
||||||
|
Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c
|
||||||
|
Modified makefile.wat (added -zp8 flag, ".symbolic", changed some comments)
|
||||||
|
Replaced leading blanks with tab characters in makefile.hux
|
||||||
|
Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents.
|
||||||
|
Changed (float)red and (float)green to (double)red, (double)green
|
||||||
|
in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
|
||||||
|
Fixed a bug in pngconf.h that omitted <stdio.h> when PNG_DEBUG==0 (K Bracey).
|
||||||
|
Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt).
|
||||||
|
Updated documentation to refer to the PNG-1.2 specification.
|
||||||
|
Removed ansi2knr.c and left pointers to the latest source for ansi2knr.c
|
||||||
|
in makefile.knr, INSTALL, and README (L. Peter Deutsch)
|
||||||
|
Fixed bugs in calculation of the length of rowbytes when adding alpha
|
||||||
|
channels to 16-bit images, in pngrtran.c (Chris Nokleberg)
|
||||||
|
Added function png_set_user_transform_info() to store user_transform_ptr,
|
||||||
|
user_depth, and user_channels into the png_struct, and a function
|
||||||
|
png_get_user_transform_ptr() to retrieve the pointer (Chris Nokleberg)
|
||||||
|
Added function png_set_empty_plte_permitted() to make libpng useable
|
||||||
|
in MNG applications.
|
||||||
|
Corrected the typedef for png_free_ptr in png.h (Jesse Jones).
|
||||||
|
Correct gamma with srgb is 45455 instead of 45000 in pngrutil.c, to be
|
||||||
|
consistent with PNG-1.2, and allow variance of 500 before complaining.
|
||||||
|
Added assembler code contributed by Intel in file pngvcrd.c and modified
|
||||||
|
makefile.w32 to use it (Nirav Chhatrapati, INTEL Corporation, Gilles Vollant)
|
||||||
|
Changed "ln -s -f" to "ln -f -s" in the makefiles to make Solaris happy.
|
||||||
|
Added some aliases for png_set_expand() in pngrtran.c, namely
|
||||||
|
png_set_expand_PLTE(), png_set_expand_depth(), and png_set_expand_tRNS()
|
||||||
|
(Greg Roelofs, in "PNG: The Definitive Guide").
|
||||||
|
Added makefile.beo for BEOS on X86, contributed by Sander Stok.
|
||||||
|
version 1.0.3b [August 26, 1999]
|
||||||
|
Replaced 2147483647L several places with PNG_MAX_UINT macro, defined in png.h
|
||||||
|
Changed leading blanks to tabs in all makefiles.
|
||||||
|
Define PNG_USE_PNGVCRD in makefile.w32, to get MMX assembler code.
|
||||||
|
Made alternate versions of png_set_expand() in pngrtran.c, namely
|
||||||
|
png_set_gray_1_2_4_to_8, png_set_palette_to_rgb, and png_set_tRNS_to_alpha
|
||||||
|
(Greg Roelofs, in "PNG: The Definitive Guide"). Deleted the 1.0.3a aliases.
|
||||||
|
Relocated start of 'extern "C"' block in png.h so it doesn't include pngconf.h
|
||||||
|
Revised calculation of num_blocks in pngmem.c to avoid a potentially
|
||||||
|
negative shift distance, whose results are undefined in the C language.
|
||||||
|
Added a check in pngset.c to prevent writing multiple tIME chunks.
|
||||||
|
Added a check in pngwrite.c to detect invalid small window_bits sizes.
|
||||||
|
version 1.0.3d [September 4, 1999]
|
||||||
|
Fixed type casting of igamma in pngrutil.c
|
||||||
|
Added new png_expand functions to scripts/pngdef.pas and pngos2.def
|
||||||
|
Added a demo read_user_transform_fn that examines the row filters in pngtest.c
|
||||||
|
version 1.0.4 [September 24, 1999]
|
||||||
|
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
|
||||||
|
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
|
||||||
|
Made several minor corrections to pngtest.c
|
||||||
|
Renamed the makefiles with longer but more user friendly extensions.
|
||||||
|
Copied the PNG copyright and license to a separate LICENSE file.
|
||||||
|
Revised documentation, png.h, and example.c to remove reference to
|
||||||
|
"viewing_gamma" which no longer appears in the PNG specification.
|
||||||
|
Revised pngvcrd.c to use MMX code for interlacing only on the final pass.
|
||||||
|
Updated pngvcrd.c to use the faster C filter algorithms from libpng-1.0.1a
|
||||||
|
Split makefile.win32vc into two versions, makefile.vcawin32 (uses MMX
|
||||||
|
assembler code) and makefile.vcwin32 (doesn't).
|
||||||
|
Added a CPU timing report to pngtest.c (enabled by defining PNGTEST_TIMING)
|
||||||
|
Added a copy of pngnow.png to the distribution.
|
||||||
|
version 1.0.4a [September 25, 1999]
|
||||||
|
Increase max_pixel_depth in pngrutil.c if a user transform needs it.
|
||||||
|
Changed several division operations to right-shifts in pngvcrd.c
|
||||||
|
version 1.0.4b [September 30, 1999]
|
||||||
|
Added parentheses in line 3732 of pngvcrd.c
|
||||||
|
Added a comment in makefile.linux warning about buggy -O3 in pgcc 2.95.1
|
||||||
|
version 1.0.4c [October 1, 1999]
|
||||||
|
Added a "png_check_version" function in png.c and pngtest.c that will generate
|
||||||
|
a helpful compiler error if an old png.h is found in the search path.
|
||||||
|
Changed type of png_user_transform_depth|channels from int to png_byte.
|
||||||
|
version 1.0.4d [October 6, 1999]
|
||||||
|
Changed 0.45 to 0.45455 in png_set_sRGB()
|
||||||
|
Removed unused PLTE entries from pngnow.png
|
||||||
|
Re-enabled some parts of pngvcrd.c (png_combine_row) that work properly.
|
||||||
|
version 1.0.4e [October 10, 1999]
|
||||||
|
Fixed sign error in pngvcrd.c (Greg Roelofs)
|
||||||
|
Replaced some instances of memcpy with simple assignments in pngvcrd (GR-P)
|
||||||
|
version 1.0.4f [October 15, 1999]
|
||||||
|
Surrounded example.c code with #if 0 .. #endif to prevent people from
|
||||||
|
inadvertently trying to compile it.
|
||||||
|
Changed png_get_header_version() from a function to a macro in png.h
|
||||||
|
Added type casting mostly in pngrtran.c and pngwtran.c
|
||||||
|
Removed some pointless "ptr = NULL" in pngmem.c
|
||||||
|
Added a "contrib" directory containing the source code from Greg's book.
|
||||||
|
version 1.0.5 [October 15, 1999]
|
||||||
|
Minor editing of the INSTALL and README files.
|
||||||
|
version 1.0.5a [October 23, 1999]
|
||||||
|
Added contrib/pngsuite and contrib/pngminus (Willem van Schaik)
|
||||||
|
Fixed a typo in the png_set_sRGB() function call in example.c (Jan Nijtmans)
|
||||||
|
Further optimization and bugfix of pngvcrd.c
|
||||||
|
Revised pngset.c so that it does not allocate or free memory in the user's
|
||||||
|
text_ptr structure. Instead, it makes its own copy.
|
||||||
|
Created separate write_end_info_struct in pngtest.c for a more severe test.
|
||||||
|
Added code in pngwrite.c to free info_ptr->text[i].key to stop a memory leak.
|
||||||
|
version 1.0.5b [November 23, 1999]
|
||||||
|
Moved PNG_FLAG_HAVE_CHUNK_HEADER, PNG_FLAG_BACKGROUND_IS_GRAY and
|
||||||
|
PNG_FLAG_WROTE_tIME from flags to mode.
|
||||||
|
Added png_write_info_before_PLTE() function.
|
||||||
|
Fixed some typecasting in contrib/gregbook/*.c
|
||||||
|
Updated scripts/makevms.com and added makevms.com to contrib/gregbook
|
||||||
|
and contrib/pngminus (Martin Zinser)
|
||||||
|
version 1.0.5c [November 26, 1999]
|
||||||
|
Moved png_get_header_version from png.h to png.c, to accomodate ansi2knr.
|
||||||
|
Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to
|
||||||
|
accomodate making DLL's: Moved usr_png_ver from global variable to function
|
||||||
|
png_get_header_ver() in png.c. Moved png_sig to png_sig_bytes in png.c and
|
||||||
|
eliminated use of png_sig in pngwutil.c. Moved the various png_CHNK arrays
|
||||||
|
into pngtypes.h. Eliminated use of global png_pass arrays. Declared the
|
||||||
|
png_CHNK and png_pass arrays to be "const". Made the global arrays
|
||||||
|
available to applications (although none are used in libpng itself) when
|
||||||
|
PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined.
|
||||||
|
Removed some extraneous "-I" from contrib/pngminus/makefile.std
|
||||||
|
Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2.
|
||||||
|
Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3
|
||||||
|
version 1.0.5d [November 29, 1999]
|
||||||
|
Add type cast (png_const_charp) two places in png.c
|
||||||
|
Eliminated pngtypes.h; use macros instead to declare PNG_CHNK arrays.
|
||||||
|
Renamed "PNG_GLOBAL_ARRAYS" to "PNG_USE_GLOBAL_ARRAYS" and made available
|
||||||
|
to applications a macro "PNG_USE_LOCAL_ARRAYS".
|
||||||
|
#ifdef out all the new declarations when PNG_USE_GLOBAL_ARRAYS is defined.
|
||||||
|
Added PNG_EXPORT_VAR macro to accommodate making DLL's.
|
||||||
|
version 1.0.5e [November 30, 1999]
|
||||||
|
Added iCCP, iTXt, and sPLT support; added "lang" member to the png_text
|
||||||
|
structure; refactored the inflate/deflate support to make adding new chunks
|
||||||
|
with trailing compressed parts easier in the future, and added new functions
|
||||||
|
png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP,
|
||||||
|
png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond).
|
||||||
|
NOTE: Applications that write text chunks MUST define png_text->lang
|
||||||
|
before calling png_set_text(). It must be set to NULL if you want to
|
||||||
|
write tEXt or zTXt chunks. If you want your application to be able to
|
||||||
|
run with older versions of libpng, use
|
||||||
|
|
||||||
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
|
png_text[i].lang = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Changed png_get_oFFs() and png_set_oFFs() to use signed rather than unsigned
|
||||||
|
offsets (Eric S. Raymond).
|
||||||
|
Combined PNG_READ_cHNK_SUPPORTED and PNG_WRITE_cHNK_SUPPORTED macros into
|
||||||
|
PNG_cHNK_SUPPORTED and combined the three types of PNG_text_SUPPORTED
|
||||||
|
macros, leaving the separate macros also available.
|
||||||
|
Removed comments on #endifs at the end of many short, non-nested #if-blocks.
|
||||||
|
version 1.0.5f [December 6, 1999]
|
||||||
|
Changed makefile.solaris to issue a warning about potential problems when
|
||||||
|
the ucb "ld" is in the path ahead of the ccs "ld".
|
||||||
|
Removed "- [date]" from the "synopsis" line in libpng.3 and libpngpf.3.
|
||||||
|
Added sCAL chunk support (Eric S. Raymond).
|
||||||
|
version 1.0.5g [December 7, 1999]
|
||||||
|
Fixed "png_free_spallettes" typo in png.h
|
||||||
|
Added code to handle new chunks in pngpread.c
|
||||||
|
Moved PNG_CHNK string macro definitions outside of PNG_NO_EXTERN block
|
||||||
|
Added "translated_key" to png_text structure and png_write_iTXt().
|
||||||
|
Added code in pngwrite.c to work around a newly discovered zlib bug.
|
||||||
|
version 1.0.5h [December 10, 1999]
|
||||||
|
NOTE: regarding the note for version 1.0.5e, the following must also
|
||||||
|
be included in your code:
|
||||||
|
png_text[i].translated_key = NULL;
|
||||||
|
Unknown chunk handling is now supported.
|
||||||
|
Option to eliminate all floating point support was added. Some new
|
||||||
|
fixed-point functions such as png_set_gAMA_fixed() were added.
|
||||||
|
Expanded tabs and removed trailing blanks in source files.
|
||||||
|
version 1.0.5i [December 13, 1999]
|
||||||
|
Added some type casts to silence compiler warnings.
|
||||||
|
Renamed "png_free_spalette" to "png_free_spalettes" for consistency.
|
||||||
|
Removed leading blanks from a #define in pngvcrd.c
|
||||||
|
Added some parameters to the new png_set_keep_unknown_chunks() function.
|
||||||
|
Added a test for up->location != 0 in the first instance of writing
|
||||||
|
unknown chunks in pngwrite.c
|
||||||
|
Changed "num" to "i" in png_free_spalettes() and png_free_unknowns() to
|
||||||
|
prevent recursion.
|
||||||
|
Added png_free_hIST() function.
|
||||||
|
Various patches to fix bugs in the sCAL and integer cHRM processing,
|
||||||
|
and to add some convenience macros for use with sCAL.
|
||||||
|
version 1.0.5j [December 21, 1999]
|
||||||
|
Changed "unit" parameter of png_write_sCAL from png_byte to int, to work
|
||||||
|
around buggy compilers.
|
||||||
|
Added new type "png_fixed_point" for integers that hold float*100000 values
|
||||||
|
Restored backward compatibility of tEXt/zTXt chunk processing:
|
||||||
|
Restored the first four members of png_text to the same order as v.1.0.5d.
|
||||||
|
Added members "lang_key" and "itxt_length" to png_text struct. Set
|
||||||
|
text_length=0 when "text" contains iTXt data. Use the "compression"
|
||||||
|
member to distinguish among tEXt/zTXt/iTXt types. Added
|
||||||
|
PNG_ITXT_COMPRESSION_NONE (1) and PNG_ITXT_COMPRESSION_zTXt(2) macros.
|
||||||
|
The "Note" above, about backward incompatibility of libpng-1.0.5e, no
|
||||||
|
longer applies.
|
||||||
|
Fixed png_read|write_iTXt() to read|write parameters in the right order,
|
||||||
|
and to write the iTXt chunk after IDAT if it appears in the end_ptr.
|
||||||
|
Added pnggccrd.c, version of pngvcrd.c Intel assembler for gcc (Greg Roelofs)
|
||||||
|
Reversed the order of trying to write floating-point and fixed-point gAMA.
|
||||||
|
version 1.0.5k [December 27, 1999]
|
||||||
|
Added many parentheses, e.g., "if (a && b & c)" becomes "if (a && (b & c))"
|
||||||
|
Added png_handle_as_unknown() function (Glenn)
|
||||||
|
Added png_free_chunk_list() function and chunk_list and num_chunk_list members
|
||||||
|
of png_ptr.
|
||||||
|
Eliminated erroneous warnings about multiple sPLT chunks and sPLT-after-PLTE.
|
||||||
|
Fixed a libpng-1.0.5h bug in pngrutil.c that was issuing erroneous warnings
|
||||||
|
about ignoring incorrect gAMA with sRGB (gAMA was in fact not ignored)
|
||||||
|
Added png_free_tRNS(); png_set_tRNS() now malloc's its own trans array (ESR).
|
||||||
|
Define png_get_int_32 when oFFs chunk is supported as well as when pCAL is.
|
||||||
|
Changed type of proflen from png_int_32 to png_uint_32 in png_get_iCCP().
|
||||||
|
version 1.0.5l [January 1, 2000]
|
||||||
|
Added functions png_set_read_user_chunk_fn() and png_get_user_chunk_ptr()
|
||||||
|
for setting a callback function to handle unknown chunks and for
|
||||||
|
retrieving the associated user pointer (Glenn).
|
||||||
|
version 1.0.5m [January 7, 2000]
|
||||||
|
Added high-level functions png_read_png(), png_write_png(), png_free_pixels().
|
||||||
|
version 1.0.5n [January 9, 2000]
|
||||||
|
Added png_free_PLTE() function, and modified png_set_PLTE() to malloc its
|
||||||
|
own memory for info_ptr->palette. This makes it safe for the calling
|
||||||
|
application to free its copy of the palette any time after it calls
|
||||||
|
png_set_PLTE().
|
||||||
|
version 1.0.5o [January 20, 2000]
|
||||||
|
Cosmetic changes only (removed some trailing blanks and TABs)
|
||||||
|
version 1.0.5p [January 31, 2000]
|
||||||
|
Renamed pngdll.mak to makefile.bd32
|
||||||
|
Cosmetic changes in pngtest.c
|
||||||
|
version 1.0.5q [February 5, 2000]
|
||||||
|
Relocated the makefile.solaris warning about PATH problems.
|
||||||
|
Fixed pngvcrd.c bug by pushing/popping registers in mmxsupport (Bruce Oberg)
|
||||||
|
Revised makefile.gcmmx
|
||||||
|
Added PNG_SETJMP_SUPPORTED, PNG_SETJMP_NOT_SUPPORTED, and PNG_ABORT() macros
|
||||||
|
version 1.0.5r [February 7, 2000]
|
||||||
|
Removed superfluous prototype for png_get_itxt from png.h
|
||||||
|
Fixed a bug in pngrtran.c that improperly expanded the background color.
|
||||||
|
Return *num_text=0 from png_get_text() when appropriate, and fix documentation
|
||||||
|
of png_get_text() in libpng.txt/libpng.3.
|
||||||
|
version 1.0.5s [February 18, 2000]
|
||||||
|
Added "png_jmp_env()" macro to pngconf.h, to help people migrate to the
|
||||||
|
new error handler that's planned for the next libpng release, and changed
|
||||||
|
example.c, pngtest.c, and contrib programs to use this macro.
|
||||||
|
Revised some of the DLL-export macros in pngconf.h (Greg Roelofs)
|
||||||
|
Fixed a bug in png_read_png() that caused it to fail to expand some images
|
||||||
|
that it should have expanded.
|
||||||
|
Fixed some mistakes in the unused and undocumented INCH_CONVERSIONS functions
|
||||||
|
in pngget.c
|
||||||
|
Changed the allocation of palette, history, and trans arrays back to
|
||||||
|
the version 1.0.5 method (linking instead of copying) which restores
|
||||||
|
backward compatibility with version 1.0.5. Added some remarks about
|
||||||
|
that in example.c. Added "free_me" member to info_ptr and png_ptr
|
||||||
|
and added png_free_data() function.
|
||||||
|
Updated makefile.linux and makefile.gccmmx to make directories conditionally.
|
||||||
|
Made cosmetic changes to pngasmrd.h
|
||||||
|
Added png_set_rows() and png_get_rows(), for use with png_read|write_png().
|
||||||
|
Modified png_read_png() to allocate info_ptr->row_pointers only if it
|
||||||
|
hasn't already been allocated.
|
||||||
|
version 1.0.5t [March 4, 2000]
|
||||||
|
Changed png_jmp_env() migration aiding macro to png_jmpbuf().
|
||||||
|
Fixed "interlace" typo (should be "interlaced") in contrib/gregbook/read2-x.c
|
||||||
|
Fixed bug with use of PNG_BEFORE_IHDR bit in png_ptr->mode, introduced when
|
||||||
|
PNG_FLAG_HAVE_CHUNK_HEADER was moved into png_ptr->mode in version 1.0.5b
|
||||||
|
Files in contrib/gregbook were revised to use png_jmpbuf() and to select
|
||||||
|
a 24-bit visual if one is available, and to allow abbreviated options.
|
||||||
|
Files in contrib/pngminus were revised to use the png_jmpbuf() macro.
|
||||||
|
Removed spaces in makefile.linux and makefile.gcmmx, introduced in 1.0.5s
|
||||||
|
version 1.0.5u [March 5, 2000]
|
||||||
|
Simplified the code that detects old png.h in png.c and pngtest.c
|
||||||
|
Renamed png_spalette (_p, _pp) to png_sPLT_t (_tp, _tpp)
|
||||||
|
Increased precision of rgb_to_gray calculations from 8 to 15 bits and
|
||||||
|
added png_set_rgb_to_gray_fixed() function.
|
||||||
|
Added makefile.bc32 (32-bit Borland C++, C mode)
|
||||||
|
version 1.0.5v [March 11, 2000]
|
||||||
|
Added some parentheses to the png_jmpbuf macro definition.
|
||||||
|
Updated references to the zlib home page, which has moved to freesoftware.com.
|
||||||
|
Corrected bugs in documentation regarding png_read_row() and png_write_row().
|
||||||
|
Updated documentation of png_rgb_to_gray calculations in libpng.3/libpng.txt.
|
||||||
|
Renamed makefile.borland,turboc3 back to makefile.bor,tc3 as in version 1.0.3,
|
||||||
|
revised borland makefiles; added makefile.ibmvac3 and makefile.gcc (Cosmin)
|
||||||
|
version 1.0.6 [March 20, 2000]
|
||||||
|
Minor revisions of makefile.bor, libpng.txt, and gregbook/rpng2-win.c
|
||||||
|
Added makefile.sggcc (SGI IRIX with gcc)
|
||||||
|
version 1.0.6d [April 7, 2000]
|
||||||
|
Changed sprintf() to strcpy() in png_write_sCAL_s() to work without STDIO
|
||||||
|
Added data_length parameter to png_decompress_chunk() function
|
||||||
|
Revised documentation to remove reference to abandoned png_free_chnk functions
|
||||||
|
Fixed an error in png_rgb_to_gray_fixed()
|
||||||
|
Revised example.c, usage of png_destroy_write_struct().
|
||||||
|
Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file
|
||||||
|
Added a check for info_ptr->free_me&PNG_FREE_TEXT when freeing text in png.c
|
||||||
|
Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
|
||||||
|
version 1.0.6e [April 9, 2000]
|
||||||
|
Added png_data_freer() function.
|
||||||
|
In the code that checks for over-length tRNS chunks, added check of
|
||||||
|
info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)
|
||||||
|
Minor revisions of libpng.txt/libpng.3.
|
||||||
|
Check for existing data and free it if the free_me flag is set, in png_set_*()
|
||||||
|
and png_handle_*().
|
||||||
|
Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
is defined.
|
||||||
|
Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c
|
||||||
|
and mentioned the purposes of the two macros in libpng.txt/libpng.3.
|
||||||
|
version 1.0.6f [April 14, 2000]
|
||||||
|
Revised png_set_iCCP() and png_set_rows() to avoid prematurely freeing data.
|
||||||
|
Add checks in png_set_text() for NULL members of the input text structure.
|
||||||
|
Revised libpng.txt/libpng.3.
|
||||||
|
Removed superfluous prototype for png_set_itxt from png.h
|
||||||
|
Removed "else" from pngread.c, after png_error(), and changed "0" to "length".
|
||||||
|
Changed several png_errors about malformed ancillary chunks to png_warnings.
|
||||||
|
version 1.0.6g [April 24, 2000]
|
||||||
|
Added png_pass-* arrays to pnggccrd.c when PNG_USE_LOCAL_ARRAYS is defined.
|
||||||
|
Relocated paragraph about png_set_background() in libpng.3/libpng.txt
|
||||||
|
and other revisions (Matthias Benckmann)
|
||||||
|
Relocated info_ptr->free_me, png_ptr->free_me, and other info_ptr and
|
||||||
|
png_ptr members to restore binary compatibility with libpng-1.0.5
|
||||||
|
(breaks compatibility with libpng-1.0.6).
|
||||||
|
version 1.0.6h [April 24, 2000]
|
||||||
|
Changed shared library so-number pattern from 2.x.y.z to xy.z (this builds
|
||||||
|
libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h)
|
||||||
|
This is a temporary change for test purposes.
|
||||||
|
version 1.0.6i [May 2, 2000]
|
||||||
|
Rearranged some members at the end of png_info and png_struct, to put
|
||||||
|
unknown_chunks_num and free_me within the original size of the png_structs
|
||||||
|
and free_me, png_read_user_fn, and png_free_fn within the original png_info,
|
||||||
|
because some old applications allocate the structs directly instead of
|
||||||
|
using png_create_*().
|
||||||
|
Added documentation of user memory functions in libpng.txt/libpng.3
|
||||||
|
Modified png_read_png so that it will use user_allocated row_pointers
|
||||||
|
if present, unless free_me directs that it be freed, and added description
|
||||||
|
of the use of png_set_rows() and png_get_rows() in libpng.txt/libpng.3.
|
||||||
|
Added PNG_LEGACY_SUPPORTED macro, and #ifdef out all new (since version
|
||||||
|
1.00) members of png_struct and png_info, to regain binary compatibility
|
||||||
|
when you define this macro. Capabilities lost in this event
|
||||||
|
are user transforms (new in version 1.0.0),the user transform pointer
|
||||||
|
(new in version 1.0.2), rgb_to_gray (new in 1.0.5), iCCP, sCAL, sPLT,
|
||||||
|
the high-level interface, and unknown chunks support (all new in 1.0.6).
|
||||||
|
This was necessary because of old applications that allocate the structs
|
||||||
|
directly as authors were instructed to do in libpng-0.88 and earlier,
|
||||||
|
instead of using png_create_*().
|
||||||
|
Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which
|
||||||
|
can be used to detect codes that directly allocate the structs, and
|
||||||
|
code to check these modes in png_read_init() and png_write_init() and
|
||||||
|
generate a libpng error if the modes aren't set and PNG_LEGACY_SUPPORTED
|
||||||
|
was not defined.
|
||||||
|
Added makefile.intel and updated makefile.watcom (Pawel Mrochen)
|
||||||
|
version 1.0.6j [May 3, 2000]
|
||||||
|
Overloaded png_read_init() and png_write_init() with macros that convert
|
||||||
|
calls to png_read_init_2() or png_write_init_2() that check the version
|
||||||
|
and structure sizes.
|
||||||
|
version 1.0.7beta11 [May 7, 2000]
|
||||||
|
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
||||||
|
which are no longer used.
|
||||||
|
Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is
|
||||||
|
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED
|
||||||
|
is defined.
|
||||||
|
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
|
||||||
|
overrun when old applications fill the info_ptr->text structure directly.
|
||||||
|
Added PNGAPI macro, and added it to the definitions of all exported functions.
|
||||||
|
Relocated version macro definitions ahead of the includes of zlib.h and
|
||||||
|
pngconf.h in png.h.
|
||||||
|
version 1.0.7beta12 [May 12, 2000]
|
||||||
|
Revised pngset.c to avoid a problem with expanding the png_debug macro.
|
||||||
|
Deleted some extraneous defines from pngconf.h
|
||||||
|
Made PNG_NO_CONSOLE_IO the default condition when PNG_BUILD_DLL is defined.
|
||||||
|
Use MSC _RPTn debugging instead of fprintf if _MSC_VER is defined.
|
||||||
|
Added png_access_version_number() function.
|
||||||
|
Check for mask&PNG_FREE_CHNK (for TEXT, SCAL, PCAL) in png_free_data().
|
||||||
|
Expanded libpng.3/libpng.txt information about png_data_freer().
|
||||||
|
version 1.0.7beta14 [May 17, 2000] (beta13 was not published)
|
||||||
|
Changed pnggccrd.c and pngvcrd.c to handle bad adaptive filter types as
|
||||||
|
warnings instead of errors, as pngrutil.c does.
|
||||||
|
Set the PNG_INFO_IDAT valid flag in png_set_rows() so png_write_png()
|
||||||
|
will actually write IDATs.
|
||||||
|
Made the default PNG_USE_LOCAL_ARRAYS depend on PNG_DLL instead of WIN32.
|
||||||
|
Make png_free_data() ignore its final parameter except when freeing data
|
||||||
|
that can have multiple instances (text, sPLT, unknowns).
|
||||||
|
Fixed a new bug in png_set_rows().
|
||||||
|
Removed info_ptr->valid tests from png_free_data(), as in version 1.0.5.
|
||||||
|
Added png_set_invalid() function.
|
||||||
|
Fixed incorrect illustrations of png_destroy_write_struct() in example.c.
|
||||||
|
version 1.0.7beta15 [May 30, 2000]
|
||||||
|
Revised the deliberately erroneous Linux setjmp code in pngconf.h to produce
|
||||||
|
fewer error messages.
|
||||||
|
Rearranged checks for Z_OK to check the most likely path first in pngpread.c
|
||||||
|
and pngwutil.c.
|
||||||
|
Added checks in pngtest.c for png_create_*() returning NULL, and mentioned
|
||||||
|
in libpng.txt/libpng.3 the need for applications to check this.
|
||||||
|
Changed names of png_default_*() functions in pngtest to pngtest_*().
|
||||||
|
Changed return type of png_get_x|y_offset_*() from png_uint_32 to png_int_32.
|
||||||
|
Fixed some bugs in the unused PNG_INCH_CONVERSIONS functions in pngget.c
|
||||||
|
Set each pointer to NULL after freeing it in png_free_data().
|
||||||
|
Worked around a problem in pngconf.h; AIX's strings.h defines an "index"
|
||||||
|
macro that conflicts with libpng's png_color_16.index. (Dimitri Papadapoulos)
|
||||||
|
Added "msvc" directory with MSVC++ project files (Simon-Pierre Cadieux).
|
||||||
|
version 1.0.7beta16 [June 4, 2000]
|
||||||
|
Revised the workaround of AIX string.h "index" bug.
|
||||||
|
Added a check for overlength PLTE chunk in pngrutil.c.
|
||||||
|
Added PNG_NO_POINTER_INDEXING macro to use array-indexing instead of pointer
|
||||||
|
indexing in pngrutil.c and pngwutil.c to accommodate a buggy compiler.
|
||||||
|
Added a warning in png_decompress_chunk() when it runs out of data, e.g.
|
||||||
|
when it tries to read an erroneous PhotoShop iCCP chunk.
|
||||||
|
Added PNG_USE_DLL macro.
|
||||||
|
Revised the copyright/disclaimer/license notice.
|
||||||
|
Added contrib/msvctest directory
|
||||||
|
version 1.0.7rc1 [June 9, 2000]
|
||||||
|
Corrected the definition of PNG_TRANSFORM_INVERT_ALPHA (0x0400 not 0x0200)
|
||||||
|
Added contrib/visupng directory (Willem van Schaik)
|
||||||
|
version 1.0.7beta18 [June 23, 2000]
|
||||||
|
Revised PNGAPI definition, and pngvcrd.c to work with __GCC__
|
||||||
|
and do not redefine PNGAPI if it is passed in via a compiler directive.
|
||||||
|
Revised visupng/PngFile.c to remove returns from within the Try block.
|
||||||
|
Removed leading underscores from "_PNG_H" and "_PNG_SAVE_BSD_SOURCE" macros.
|
||||||
|
Updated contrib/visupng/cexcept.h to version 1.0.0.
|
||||||
|
Fixed bugs in pngwrite.c and pngwutil.c that prevented writing iCCP chunks.
|
||||||
|
version 1.0.7rc2 [June 28, 2000]
|
||||||
|
Updated license to include disclaimers required by UCITA.
|
||||||
|
Fixed "DJBPP" typo in pnggccrd.c introduced in beta18.
|
||||||
|
version 1.0.7 [July 1, 2000]
|
||||||
|
Revised the definition of "trans_values" in libpng.3/libpng.txt
|
||||||
|
version 1.0.8beta1 [July 8, 2000]
|
||||||
|
Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
|
||||||
|
Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
|
||||||
|
pngwutil.c.
|
||||||
|
Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h.
|
||||||
|
Removed unused "#include <assert.h>" from png.c
|
||||||
|
Added WindowsCE support.
|
||||||
|
Revised pnggccrd.c to work with gcc-2.95.2 and in the Cygwin environment.
|
||||||
|
version 1.0.8beta2 [July 10, 2000]
|
||||||
|
Added project files to the wince directory and made further revisions
|
||||||
|
of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE.
|
||||||
|
version 1.0.8beta3 [July 11, 2000]
|
||||||
|
Only set the PNG_FLAG_FREE_TRNS or PNG_FREE_TRNS flag in png_handle_tRNS()
|
||||||
|
for indexed-color input files to avoid potential double-freeing trans array
|
||||||
|
under some unusual conditions; problem was introduced in version 1.0.6f.
|
||||||
|
Further revisions to pngtest.c and files in the wince subdirectory.
|
||||||
|
version 1.0.8beta4 [July 14, 2000]
|
||||||
|
Added the files pngbar.png and pngbar.jpg to the distribution.
|
||||||
|
Added makefile.cygwin, and cygwin support in pngconf.h
|
||||||
|
Added PNG_NO_ZALLOC_ZERO macro (makes png_zalloc skip zeroing memory)
|
||||||
|
version 1.0.8rc1 [July 16, 2000]
|
||||||
|
Revised png_debug() macros and statements to eliminate compiler warnings.
|
||||||
|
version 1.0.8 [July 24, 2000]
|
||||||
|
Added png_flush() in pngwrite.c, after png_write_IEND().
|
||||||
|
Updated makefile.hpux to build a shared library.
|
||||||
|
version 1.0.9beta1 [November 10, 2000]
|
||||||
|
Fixed typo in scripts/makefile.hpux
|
||||||
|
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
|
||||||
|
Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
|
||||||
|
Changed "cdrom.com" in documentation to "libpng.org"
|
||||||
|
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
|
||||||
|
Changed type of "params" from voidp to png_voidp in png_read|write_png().
|
||||||
|
Make sure PNGAPI and PNG_IMPEXP are defined in pngconf.h.
|
||||||
|
Revised the 3 instances of WRITEFILE in pngtest.c.
|
||||||
|
Relocated "msvc" and "wince" project subdirectories into "dll" subdirectory.
|
||||||
|
Updated png.rc in dll/msvc project
|
||||||
|
Revised makefile.dec to define and use LIBPATH and INCPATH
|
||||||
|
Increased size of global png_libpng_ver[] array from 12 to 18 chars.
|
||||||
|
Made global png_libpng_ver[], png_sig[] and png_pass_*[] arrays const.
|
||||||
|
Removed duplicate png_crc_finish() from png_handle_bKGD() function.
|
||||||
|
Added a warning when application calls png_read_update_info() multiple times.
|
||||||
|
Revised makefile.cygwin
|
||||||
|
Fixed bugs in iCCP support in pngrutil.c and pngwutil.c.
|
||||||
|
Replaced png_set_empty_plte_permitted() with png_permit_mng_features().
|
||||||
|
version 1.0.9beta2 [November 19, 2000]
|
||||||
|
Renamed the "dll" subdirectory "projects".
|
||||||
|
Added borland project files to "projects" subdirectory.
|
||||||
|
Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate.
|
||||||
|
Add error message in png_set_compression_buffer_size() when malloc fails.
|
||||||
|
version 1.0.9beta3 [November 23, 2000]
|
||||||
|
Revised PNG_LIBPNG_BUILD_TYPE macro in png.h, used in the msvc project.
|
||||||
|
Removed the png_flush() in pngwrite.c that crashes some applications
|
||||||
|
that don't set png_output_flush_fn.
|
||||||
|
Added makefile.macosx and makefile.aix to scripts directory.
|
||||||
|
version 1.0.9beta4 [December 1, 2000]
|
||||||
|
Change png_chunk_warning to png_warning in png_check_keyword().
|
||||||
|
Increased the first part of msg buffer from 16 to 18 in png_chunk_error().
|
||||||
|
version 1.0.9beta5 [December 15, 2000]
|
||||||
|
Added support for filter method 64 (for PNG datastreams embedded in MNG).
|
||||||
|
version 1.0.9beta6 [December 18, 2000]
|
||||||
|
Revised png_set_filter() to accept filter method 64 when appropriate.
|
||||||
|
Added new PNG_HAVE_PNG_SIGNATURE bit to png_ptr->mode and use it to
|
||||||
|
help prevent applications from using MNG features in PNG datastreams.
|
||||||
|
Added png_permit_mng_features() function.
|
||||||
|
Revised libpng.3/libpng.txt. Changed "filter type" to "filter method".
|
||||||
|
version 1.0.9rc1 [December 23, 2000]
|
||||||
|
Revised test for PNG_HAVE_PNG_SIGNATURE in pngrutil.c
|
||||||
|
Fixed error handling of unknown compression type in png_decompress_chunk().
|
||||||
|
In pngconf.h, define __cdecl when _MSC_VER is defined.
|
||||||
|
version 1.0.9beta7 [December 28, 2000]
|
||||||
|
Changed PNG_TEXT_COMPRESSION_zTXt to PNG_COMPRESSION_TYPE_BASE several places.
|
||||||
|
Revised memory management in png_set_hIST and png_handle_hIST in a backward
|
||||||
|
compatible manner. PLTE and tRNS were revised similarly.
|
||||||
|
Revised the iCCP chunk reader to ignore trailing garbage.
|
||||||
|
version 1.0.9beta8 [January 12, 2001]
|
||||||
|
Moved pngasmrd.h into pngconf.h.
|
||||||
|
Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop.
|
||||||
|
version 1.0.9beta9 [January 15, 2001]
|
||||||
|
Added png_set_invalid, png_permit_mng_features, and png_mmx_supported to
|
||||||
|
wince and msvc project module definition files.
|
||||||
|
Minor revision of makefile.cygwin.
|
||||||
|
Fixed bug with progressive reading of narrow interlaced images in pngpread.c
|
||||||
|
version 1.0.9beta10 [January 16, 2001]
|
||||||
|
Do not typedef png_FILE_p in pngconf.h when PNG_NO_STDIO is defined.
|
||||||
|
Fixed "png_mmx_supported" typo in project definition files.
|
||||||
|
version 1.0.9beta11 [January 19, 2001]
|
||||||
|
Updated makefile.sgi to make shared library.
|
||||||
|
Removed png_mmx_support() function and disabled PNG_MNG_FEATURES_SUPPORTED
|
||||||
|
by default, for the benefit of DLL forward compatibility. These will
|
||||||
|
be re-enabled in version 1.2.0.
|
||||||
|
version 1.0.9rc2 [January 22, 2001]
|
||||||
|
Revised cygwin support.
|
||||||
|
version 1.0.9 [January 31, 2001]
|
||||||
|
Added check of cygwin's ALL_STATIC in pngconf.h
|
||||||
|
Added "-nommx" parameter to contrib/gregbook/rpng2-win and rpng2-x demos.
|
||||||
|
version 1.0.10beta1 [March 14, 2001]
|
||||||
|
Revised makefile.dec, makefile.sgi, and makefile.sggcc; added makefile.hpgcc.
|
||||||
|
Reformatted libpng.3 to eliminate bad line breaks.
|
||||||
|
Added checks for _mmx_supported in the read_filter_row function of pnggccrd.c
|
||||||
|
Added prototype for png_mmx_support() near the top of pnggccrd.c
|
||||||
|
Moved some error checking from png_handle_IHDR to png_set_IHDR.
|
||||||
|
Added PNG_NO_READ_SUPPORTED and PNG_NO_WRITE_SUPPORTED macros.
|
||||||
|
Revised png_mmx_support() function in pnggccrd.c
|
||||||
|
Restored version 1.0.8 PNG_WRITE_EMPTY_PLTE_SUPPORTED behavior in pngwutil.c
|
||||||
|
Fixed memory leak in contrib/visupng/PngFile.c
|
||||||
|
Fixed bugs in png_combine_row() in pnggccrd.c and pngvcrd.c (C version)
|
||||||
|
Added warnings when retrieving or setting gamma=0.
|
||||||
|
Increased the first part of msg buffer from 16 to 18 in png_chunk_warning().
|
||||||
|
version 1.0.10rc1 [March 23, 2001]
|
||||||
|
Changed all instances of memcpy, strcpy, and strlen to png_memcpy, png_strcpy,
|
||||||
|
and png_strlen.
|
||||||
|
Revised png_mmx_supported() function in pnggccrd.c to return proper value.
|
||||||
|
Fixed bug in progressive reading (pngpread.c) with small images (height < 8).
|
||||||
|
version 1.0.10 [March 30, 2001]
|
||||||
|
Deleted extraneous space (introduced in 1.0.9) from line 42 of makefile.cygwin
|
||||||
|
Added beos project files (Chris Herborth)
|
||||||
|
version 1.0.11beta1 [April 3, 2001]
|
||||||
|
Added type casts on several png_malloc() calls (Dimitri Papadapoulos).
|
||||||
|
Removed a no-longer needed AIX work-around from pngconf.h
|
||||||
|
Changed several "//" single-line comments to C-style in pnggccrd.c
|
||||||
|
version 1.0.11beta2 [April 11, 2001]
|
||||||
|
Removed PNGAPI from several functions whose prototypes did not have PNGAPI.
|
||||||
|
Updated scripts/pngos2.def
|
||||||
|
version 1.0.11beta3 [April 14, 2001]
|
||||||
|
Added checking the results of many instances of png_malloc() for NULL
|
||||||
|
version 1.0.11beta4 [April 20, 2001]
|
||||||
|
Undid the changes from version 1.0.11beta3. Added a check for NULL return
|
||||||
|
from user's malloc_fn().
|
||||||
|
Removed some useless type casts of the NULL pointer.
|
||||||
|
Added makefile.netbsd
|
||||||
|
version 1.0.11 [April 27, 2001]
|
||||||
|
Revised makefile.netbsd
|
||||||
|
version 1.0.12beta1 [May 14, 2001]
|
||||||
|
Test for Windows platform in pngconf.h when including malloc.h (Emmanuel Blot)
|
||||||
|
Updated makefile.cygwin and handling of Cygwin's ALL_STATIC in pngconf.h
|
||||||
|
Added some never-to-be-executed code in pnggccrd.c to quiet compiler warnings.
|
||||||
|
Eliminated the png_error about apps using png_read|write_init(). Instead,
|
||||||
|
libpng will reallocate the png_struct and info_struct if they are too small.
|
||||||
|
This retains future binary compatibility for old applications written for
|
||||||
|
libpng-0.88 and earlier.
|
||||||
|
version 1.2.0beta1 [May 6, 2001]
|
||||||
|
Bumped DLLNUM to 2.
|
||||||
|
Re-enabled PNG_MNG_FEATURES_SUPPORTED and enabled PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
by default.
|
||||||
|
Added runtime selection of MMX features.
|
||||||
|
Added png_set_strip_error_numbers function and related macros.
|
||||||
|
version 1.2.0beta2 [May 7, 2001]
|
||||||
|
Finished merging 1.2.0beta1 with version 1.0.11
|
||||||
|
Added a check for attempts to read or write PLTE in grayscale PNG datastreams.
|
||||||
|
version 1.2.0beta3 [May 17, 2001]
|
||||||
|
Enabled user memory function by default.
|
||||||
|
Modified png_create_struct so it passes user mem_ptr to user memory allocator.
|
||||||
|
Increased png_mng_features flag from png_byte to png_uint_32.
|
||||||
|
Bumped shared-library (so-number) and dll-number to 3.
|
||||||
|
version 1.2.0beta4 [June 23, 2001]
|
||||||
|
Check for missing profile length field in iCCP chunk and free chunk_data
|
||||||
|
in case of truncated iCCP chunk.
|
||||||
|
Bumped shared-library number to 3 in makefile.sgi and makefile.sggcc
|
||||||
|
Bumped dll-number from 2 to 3 in makefile.cygwin
|
||||||
|
Revised contrib/gregbook/rpng*-x.c to avoid a memory leak and to exit cleanly
|
||||||
|
if user attempts to run it on an 8-bit display.
|
||||||
|
Updated contrib/gregbook
|
||||||
|
Use png_malloc instead of png_zalloc to allocate palette in pngset.c
|
||||||
|
Updated makefile.ibmc
|
||||||
|
Added some typecasts to eliminate gcc 3.0 warnings. Changed prototypes
|
||||||
|
of png_write_oFFS width and height from png_uint_32 to png_int_32.
|
||||||
|
Updated example.c
|
||||||
|
Revised prototypes for png_debug_malloc and png_debug_free in pngtest.c
|
||||||
|
version 1.2.0beta5 [August 8, 2001]
|
||||||
|
Revised contrib/gregbook
|
||||||
|
Revised makefile.gcmmx
|
||||||
|
Revised pnggccrd.c to conditionally compile some thread-unsafe code only
|
||||||
|
when PNG_THREAD_UNSAFE_OK is defined.
|
||||||
|
Added tests to prevent pngwutil.c from writing a bKGD or tRNS chunk with
|
||||||
|
value exceeding 2^bit_depth-1
|
||||||
|
Revised makefile.sgi and makefile.sggcc
|
||||||
|
Replaced calls to fprintf(stderr,...) with png_warning() in pnggccrd.c
|
||||||
|
Removed restriction that do_invert_mono only operate on 1-bit opaque files
|
||||||
|
version 1.2.0 [September 1, 2001]
|
||||||
|
Changed a png_warning() to png_debug() in pnggccrd.c
|
||||||
|
Fixed contrib/gregbook/rpng-x.c, rpng2-x.c to avoid crash with XFreeGC().
|
||||||
|
version 1.2.1beta1 [October 19, 2001]
|
||||||
|
Revised makefile.std in contrib/pngminus
|
||||||
|
Include background_1 in png_struct regardless of gamma support.
|
||||||
|
Revised makefile.netbsd and makefile.macosx, added makefile.darwin.
|
||||||
|
Revised example.c to provide more details about using row_callback().
|
||||||
|
version 1.2.1beta2 [October 25, 2001]
|
||||||
|
Added type cast to each NULL appearing in a function call, except for
|
||||||
|
WINCE functions.
|
||||||
|
Added makefile.so9.
|
||||||
|
version 1.2.1beta3 [October 27, 2001]
|
||||||
|
Removed type casts from all NULLs.
|
||||||
|
Simplified png_create_struct_2().
|
||||||
|
version 1.2.1beta4 [November 7, 2001]
|
||||||
|
Revised png_create_info_struct() and png_creat_struct_2().
|
||||||
|
Added error message if png_write_info() was omitted.
|
||||||
|
Type cast NULLs appearing in function calls when _NO_PROTO or
|
||||||
|
PNG_TYPECAST_NULL is defined.
|
||||||
|
version 1.2.1rc1 [November 24, 2001]
|
||||||
|
Type cast NULLs appearing in function calls except when PNG_NO_TYPECAST_NULL
|
||||||
|
is defined.
|
||||||
|
Changed typecast of "size" argument to png_size_t in pngmem.c calls to
|
||||||
|
the user malloc_fn, to agree with the prototype in png.h
|
||||||
|
Added a pop/push operation to pnggccrd.c, to preserve Eflag (Maxim Sobolev)
|
||||||
|
Updated makefile.sgi to recognize LIBPATH and INCPATH.
|
||||||
|
Updated various makefiles so "make clean" does not remove previous major
|
||||||
|
version of the shared library.
|
||||||
|
version 1.2.1rc2 [December 4, 2001]
|
||||||
|
Always allocate 256-entry internal palette, hist, and trans arrays, to
|
||||||
|
avoid out-of-bounds memory reference caused by invalid PNG datastreams.
|
||||||
|
Added a check for prefix_length > data_length in iCCP chunk handler.
|
||||||
|
version 1.2.1 [December 7, 2001]
|
||||||
|
None.
|
||||||
|
version 1.2.2beta1 [February 22, 2002]
|
||||||
|
Fixed a bug with reading the length of iCCP profiles (Larry Reeves).
|
||||||
|
Revised makefile.linux, makefile.gcmmx, and makefile.sgi to generate
|
||||||
|
libpng.a, libpng12.so (not libpng.so.3), and libpng12/png.h
|
||||||
|
Revised makefile.darwin to remove "-undefined suppress" option.
|
||||||
|
Added checks for gamma and chromaticity values over 21474.83, which exceed
|
||||||
|
the limit for PNG unsigned 32-bit integers when encoded.
|
||||||
|
Revised calls to png_create_read_struct() and png_create_write_struct()
|
||||||
|
for simpler debugging.
|
||||||
|
Revised png_zalloc() so zlib handles errors (uses PNG_FLAG_MALLOC_NULL_MEM_OK)
|
||||||
|
version 1.2.2beta2 [February 23, 2002]
|
||||||
|
Check chunk_length and idat_size for invalid (over PNG_MAX_UINT) lengths.
|
||||||
|
Check for invalid image dimensions in png_get_IHDR.
|
||||||
|
Added missing "fi;" in the install target of the SGI makefiles.
|
||||||
|
Added install-static to all makefiles that make shared libraries.
|
||||||
|
Always do gamma compensation when image is partially transparent.
|
||||||
|
version 1.2.2beta3 [March 7, 2002]
|
||||||
|
Compute background.gray and background_1.gray even when color_type is RGB
|
||||||
|
in case image gets reduced to gray later.
|
||||||
|
Modified shared-library makefiles to install pkgconfig/libpngNN.pc.
|
||||||
|
Export (with PNGAPI) png_zalloc, png_zfree, and png_handle_as_unknown
|
||||||
|
Removed unused png_write_destroy_info prototype from png.h
|
||||||
|
Eliminated incorrect use of width_mmx from pnggccrd.c in pixel_bytes == 8 case
|
||||||
|
Added install-shared target to all makefiles that make shared libraries.
|
||||||
|
Stopped a double free of palette, hist, and trans when not using free_me.
|
||||||
|
Added makefile.32sunu for Sun Ultra 32 and makefile.64sunu for Sun Ultra 64.
|
||||||
|
version 1.2.2beta4 [March 8, 2002]
|
||||||
|
Compute background.gray and background_1.gray even when color_type is RGB
|
||||||
|
in case image gets reduced to gray later (Jason Summers).
|
||||||
|
Relocated a misplaced /bin/rm in the "install-shared" makefile targets
|
||||||
|
Added PNG_1_0_X macro which can be used to build a 1.0.x-compatible library.
|
||||||
|
version 1.2.2beta5 [March 26, 2002]
|
||||||
|
Added missing PNGAPI to several function definitions.
|
||||||
|
Check for invalid bit_depth or color_type in png_get_IHDR(), and
|
||||||
|
check for missing PLTE or IHDR in png_push_read_chunk() (Matthias Clasen).
|
||||||
|
Revised iTXt support to accept NULL for lang and lang_key.
|
||||||
|
Compute gamma for color components of background even when color_type is gray.
|
||||||
|
Changed "()" to "{}" in scripts/libpng.pc.in.
|
||||||
|
Revised makefiles to put png.h and pngconf.h only in $prefix/include/libpngNN
|
||||||
|
Revised makefiles to make symlink to libpng.so.NN in addition to libpngNN.so
|
||||||
|
version 1.2.2beta6 [March 31, 2002]
|
||||||
|
version 1.0.13beta1 [March 31, 2002]
|
||||||
|
Prevent png_zalloc() from trying to memset memory that it failed to acquire.
|
||||||
|
Add typecasts of PNG_MAX_UINT in pngset_cHRM_fixed() (Matt Holgate).
|
||||||
|
Ensure that the right function (user or default) is used to free the
|
||||||
|
png_struct after an error in png_create_read_struct_2().
|
||||||
|
version 1.2.2rc1 [April 7, 2002]
|
||||||
|
version 1.0.13rc1 [April 7, 2002]
|
||||||
|
Save the ebx register in pnggccrd.c (Sami Farin)
|
||||||
|
Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner).
|
||||||
|
Updated makefiles to put headers in include/libpng and remove old include/*.h.
|
||||||
|
version 1.2.2 [April 15, 2002]
|
||||||
|
version 1.0.13 [April 15, 2002]
|
||||||
|
Revised description of png_set_filter() in libpng.3/libpng.txt.
|
||||||
|
Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd
|
||||||
|
version 1.0.13patch01 [April 17, 2002]
|
||||||
|
version 1.2.2patch01 [April 17, 2002]
|
||||||
|
Changed ${PNGMAJ}.${PNGVER} bug to ${PNGVER} in makefile.sgi and makefile.sggcc
|
||||||
|
Fixed VER -> PNGVER typo in makefile.macosx and added install-static to install
|
||||||
|
Added install: target to makefile.32sunu and makefile.64sunu
|
||||||
|
version 1.0.13patch03 [April 18, 2002]
|
||||||
|
version 1.2.2patch03 [April 18, 2002]
|
||||||
|
Revised 15 makefiles to link libpng.a to libpngNN.a and the include libpng
|
||||||
|
subdirectory to libpngNN subdirectory without the full pathname.
|
||||||
|
Moved generation of libpng.pc from "install" to "all" in 15 makefiles.
|
||||||
|
version 1.2.3rc1 [April 28, 2002]
|
||||||
|
Added install-man target to 15 makefiles (Dimitri Papadopolous-Orfanos).
|
||||||
|
Added $(DESTDIR) feature to 24 makefiles (Tim Mooney)
|
||||||
|
Fixed bug with $prefix, should be $(prefix) in makefile.hpux.
|
||||||
|
Updated cygwin-specific portion of pngconf.h and revised makefile.cygwin
|
||||||
|
Added a link from libpngNN.pc to libpng.pc in 15 makefiles.
|
||||||
|
Added links from include/libpngNN/*.h to include/*.h in 24 makefiles.
|
||||||
|
Revised makefile.darwin to make relative links without full pathname.
|
||||||
|
Added setjmp() at the end of png_create_*_struct_2() in case user forgets
|
||||||
|
to put one in their application.
|
||||||
|
Restored png_zalloc() and png_zfree() prototypes to version 1.2.1 and
|
||||||
|
removed them from module definition files.
|
||||||
|
version 1.2.3rc2 [May 1, 2002]
|
||||||
|
Fixed bug in reporting number of channels in pngget.c and pngset.c,
|
||||||
|
that was introduced in version 1.2.2beta5.
|
||||||
|
Exported png_zalloc(), png_zfree(), png_default_read(), png_default_write(),
|
||||||
|
png_default_flush(), and png_push_fill_buffer() and included them in
|
||||||
|
module definition files.
|
||||||
|
Added "libpng.pc" dependency to the "install-shared" target in 15 makefiles.
|
||||||
|
version 1.2.3rc3 [May 1, 2002]
|
||||||
|
Revised prototype for png_default_flush()
|
||||||
|
Remove old libpng.pc and libpngNN.pc before installing new ones.
|
||||||
|
version 1.2.3rc4 [May 2, 2002]
|
||||||
|
Typos in *.def files (png_default_read|write -> png_default_read|write_data)
|
||||||
|
In makefiles, changed rm libpng.NN.pc to rm libpngNN.pc
|
||||||
|
Added libpng-config and libpngNN-config and modified makefiles to install them.
|
||||||
|
Changed $(MANPATH) to $(DESTDIR)$(MANPATH) in makefiles
|
||||||
|
Added "Win32 DLL VB" configuration to projects/msvc/libpng.dsp
|
||||||
|
version 1.2.3rc5 [May 11, 2002]
|
||||||
|
Changed "error" and "message" in prototypes to "error_message" and
|
||||||
|
"warning_message" to avoid namespace conflict.
|
||||||
|
Revised 15 makefiles to build libpng-config from libpng-config-*.in
|
||||||
|
Once more restored png_zalloc and png_zfree to regular nonexported form.
|
||||||
|
Restored png_default_read|write_data, png_default_flush, png_read_fill_buffer
|
||||||
|
to nonexported form, but with PNGAPI, and removed them from module def files.
|
||||||
|
version 1.2.3rc6 [May 14, 2002]
|
||||||
|
Removed "PNGAPI" from png_zalloc() and png_zfree() in png.c
|
||||||
|
Changed "Gz" to "Gd" in projects/msvc/libpng.dsp and zlib.dsp.
|
||||||
|
Removed leftover libpng-config "sed" script from four makefiles.
|
||||||
|
Revised libpng-config creating script in 16 makefiles.
|
||||||
|
version 1.2.3 [May 22, 2002]
|
||||||
|
Revised libpng-config target in makefile.cygwin.
|
||||||
|
Removed description of png_set_mem_fn() from documentation.
|
||||||
|
Revised makefile.freebsd.
|
||||||
|
Minor cosmetic changes to 15 makefiles, e.g., $(DI) = $(DESTDIR)/$(INCDIR).
|
||||||
|
Revised projects/msvc/README.txt
|
||||||
|
Changed -lpng to -lpngNN in LDFLAGS in several makefiles.
|
||||||
|
version 1.2.4beta1 [May 24, 2002]
|
||||||
|
Added libpng.pc and libpng-config to "all:" target in 16 makefiles.
|
||||||
|
Fixed bug in 16 makefiles: $(DESTDIR)/$(LIBPATH) to $(DESTDIR)$(LIBPATH)
|
||||||
|
Added missing "\" before closing double quote in makefile.gcmmx.
|
||||||
|
Plugged various memory leaks; added png_malloc_warn() and png_set_text_2()
|
||||||
|
functions.
|
||||||
|
version 1.2.4beta2 [June 25, 2002]
|
||||||
|
Plugged memory leak of png_ptr->current_text (Matt Holgate).
|
||||||
|
Check for buffer overflow before reading CRC in pngpread.c (Warwick Allison)
|
||||||
|
Added -soname to the loader flags in makefile.dec, makefile.sgi, and
|
||||||
|
makefile.sggcc.
|
||||||
|
Added "test-installed" target to makefile.linux, makefile.gcmmx,
|
||||||
|
makefile.sgi, and makefile.sggcc.
|
||||||
|
version 1.2.4beta3 [June 28, 2002]
|
||||||
|
Plugged memory leak of row_buf in pngtest.c when there is a png_error().
|
||||||
|
Detect buffer overflow in pngpread.c when IDAT is corrupted with extra data.
|
||||||
|
Added "test-installed" target to makefile.32sunu, makefile.64sunu,
|
||||||
|
makefile.beos, makefile.darwin, makefile.dec, makefile.macosx,
|
||||||
|
makefile.solaris, makefile.hpux, makefile.hpgcc, and makefile.so9.
|
||||||
|
version 1.2.4rc1 [July 2, 2002]
|
||||||
|
Added "test-installed" target to makefile.cygwin and makefile.sco.
|
||||||
|
Revised pnggccrd.c to be able to back out version 1.0.x via PNG_1_0_X macro.
|
||||||
|
version 1.2.4 [July 8, 2002]
|
||||||
|
Changed png_warning() to png_error() when width is too large to process.
|
||||||
|
|
||||||
|
Send comments/corrections/commendations to
|
||||||
|
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||||
|
|
||||||
|
Glenn R-P
|
||||||
|
131
src/png/INSTALL
131
src/png/INSTALL
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng version 1.0.1 March 15, 1998
|
Installing libpng version 1.2.4 - July 8, 2002
|
||||||
|
|
||||||
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.1 or "lpng100" and "zlib-1.1.1"
|
might be called "libpng-1.2.4" or "lpng109" and "zlib-1.1.4"
|
||||||
or "zlib111") so that you have directories called "zlib" and "libpng".
|
or "zlib114") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
@@ -21,8 +21,24 @@ Your directory structure should look like this:
|
|||||||
README
|
README
|
||||||
*.h
|
*.h
|
||||||
*.c
|
*.c
|
||||||
|
contrib
|
||||||
|
gregbook
|
||||||
|
msvctest
|
||||||
|
pngminus
|
||||||
|
pngsuite
|
||||||
|
visupng
|
||||||
|
projects
|
||||||
|
beos
|
||||||
|
borland
|
||||||
|
msvc
|
||||||
|
netware.txt
|
||||||
|
wince.txt
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
|
libpng*.in
|
||||||
|
mangle
|
||||||
|
makefile.*
|
||||||
|
mangle.in
|
||||||
pngtest.png
|
pngtest.png
|
||||||
etc.
|
etc.
|
||||||
zlib
|
zlib
|
||||||
@@ -32,40 +48,84 @@ Your directory structure should look like this:
|
|||||||
contrib
|
contrib
|
||||||
etc.
|
etc.
|
||||||
|
|
||||||
First enter the zlib directory and follow the instructions
|
If the line endings in the files look funny, you may wish to get the other
|
||||||
in zlib/README. Then come back here and choose the
|
distribution of libpng. It is available in both tar.gz (UNIX style line
|
||||||
appropriate makefile.sys in the scripts directory.
|
endings) and zip (DOS style line endings) formats.
|
||||||
|
|
||||||
|
If you are building libpng with MSVC, you can enter the libpng\msvc directory
|
||||||
|
and follow the instructions in msvc\README.txt.
|
||||||
|
|
||||||
|
You can build libpng for WindowsCE by entering the downloading and installing
|
||||||
|
the libpng\wince directory as instructed in the projects\wince.txt file, and
|
||||||
|
then following the instructions in the README* files. Similarly, you can
|
||||||
|
build libpng for Netware as instructed in projects\netware.txt.
|
||||||
|
|
||||||
|
Else enter the zlib directory and follow the instructions in zlib/README,
|
||||||
|
then come back here and choose the appropriate makefile.sys in the scripts
|
||||||
|
directory.
|
||||||
|
|
||||||
The files that are presently available in the scripts directory
|
The files that are presently available in the scripts directory
|
||||||
include
|
include
|
||||||
|
|
||||||
descrip.mms => VMS makefile for MMS or MMK
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.std => Generic UNIX makefile
|
makefile.linux => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.4)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with ansi2knr
|
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.4,
|
||||||
|
uses assembler code tuned for Intel MMX platform)
|
||||||
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
|
ansi2knr (Requires ansi2knr.c from
|
||||||
|
ftp://ftp.cs.wisc.edu/ghost)
|
||||||
|
makefile.aix => AIX makefile
|
||||||
|
makefile.cygwin => Cygwin/gcc makefile
|
||||||
|
makefile.darwin => Darwin makefile
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile
|
makefile.hpgcc => FreeBSD makefile
|
||||||
makefile.sun => Sun makefile
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
makefile.s2x => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0)
|
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||||
makefile.lnx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0)
|
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||||
makefile.mip => MIPS makefile
|
makefile.intel => Intel C/C++ version 4.0 and later
|
||||||
makefile.aco => Acorn makefile
|
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
||||||
makefile.ama => Amiga makefile
|
makefile.macosx => MACOS X Makefile
|
||||||
|
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
|
||||||
|
makefile.ne0bsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng0.so
|
||||||
|
makefile.openbsd => OpenBSD makefile
|
||||||
|
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||||
|
makefile.sggcc => Silicon Graphics (gcc, creates libpng12.so.0.1.2.4)
|
||||||
|
makefile.sunos => Sun makefile
|
||||||
|
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.4)
|
||||||
|
makefile.so9 => Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.4)
|
||||||
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||||
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
|
makefile.mips => MIPS makefile
|
||||||
|
makefile.acorn => Acorn makefile
|
||||||
|
makefile.amiga => Amiga makefile
|
||||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
|
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
|
||||||
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
|
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
|
||||||
makefile.atr => Atari makefile
|
makefile.atari => Atari makefile
|
||||||
makefile.bor => Borland makefile
|
makefile.beos => BEOS makefile for X86
|
||||||
build.bat => MS-DOS batch file for Borland compiler
|
makefile.bor => Borland makefile (uses bcc)
|
||||||
|
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
||||||
|
makefile.bd32 => To make a png32bd.dll with Borland C++ 4.5
|
||||||
|
makefile.tc3 => Turbo C 3.0 makefile
|
||||||
makefile.dj2 => DJGPP 2 makefile
|
makefile.dj2 => DJGPP 2 makefile
|
||||||
makefile.msc => Microsoft C makefile
|
makefile.msc => Microsoft C makefile
|
||||||
makefile.tc3 => Turbo C 3.0 makefile
|
makefile.vcawin32 => makefile for Microsoft Visual C++ 5.0 and later (uses
|
||||||
|
assembler code tuned for Intel MMX platform)
|
||||||
|
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later (does
|
||||||
|
not use assembler code)
|
||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
pngos2.def => OS/2 module definition file used by makefile.os2
|
||||||
makefile.wat => Watcom 10a+ Makefile, 32-bit flat memory model
|
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
||||||
makevms.com => VMS build script
|
makevms.com => VMS build script
|
||||||
|
descrip.mms => VMS makefile for MMS or MMK
|
||||||
|
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
|
||||||
|
SCOPTIONS.ppc => Used with smakefile.ppc
|
||||||
|
|
||||||
Copy the file (or files) that you need from the
|
Copy the file (or files) that you need from the
|
||||||
scripts directory into this directory, for example
|
scripts directory into this directory, for example
|
||||||
|
|
||||||
MSDOS example: copy scripts\makefile.msd makefile
|
MSDOS example: copy scripts\makefile.msc makefile
|
||||||
UNIX example: cp scripts/makefile.std makefile
|
UNIX example: cp scripts/makefile.std makefile
|
||||||
|
|
||||||
Read the makefile to see if you need to change any source or
|
Read the makefile to see if you need to change any source or
|
||||||
@@ -77,11 +137,34 @@ changes.
|
|||||||
Then just run "make test" which will create the libpng library in
|
Then just run "make test" which will create the libpng library in
|
||||||
this directory and run a quick test that reads the "pngtest.png"
|
this directory and run a quick test that reads the "pngtest.png"
|
||||||
file and writes a "pngout.png" file that should be identical to it.
|
file and writes a "pngout.png" file that should be identical to it.
|
||||||
|
Look for "9782 zero samples" in the output of the test. For more
|
||||||
|
confidence, you can run another test by typing "pngtest pngnow.png"
|
||||||
|
and looking for "289 zero samples" in the output. Also, you can
|
||||||
|
run "pngtest -m *.png" in the "contrib/pngsuite" directory and compare
|
||||||
|
your output with the result shown in contrib/pngsuite/README.
|
||||||
|
|
||||||
Most of the makefiles will allow you to run "make install" to
|
Most of the makefiles will allow you to run "make install" to
|
||||||
put the library in its final resting place (if you want to
|
put the library in its final resting place (if you want to
|
||||||
do that, run "make install" in the zlib directory first if necessary).
|
do that, run "make install" in the zlib directory first if necessary).
|
||||||
|
Some also allow you to run "make test-installed" after you have
|
||||||
|
run "make install". This will build and run executables called "pngtesti"
|
||||||
|
and "mangle/pngtestm".
|
||||||
|
|
||||||
|
The files that are presently available in the mangle directory include the
|
||||||
|
following. The makefiles are automatically run by the corresponding makefiles
|
||||||
|
in the scripts directory when you run "make", "make install", or
|
||||||
|
"make test-installed".
|
||||||
|
|
||||||
|
mangle.in => Function-decoration macros added to png.h by the
|
||||||
|
makefiles.
|
||||||
|
makefile.linux => Linux/ELF makefile
|
||||||
|
(gcc, creates libpng12m.so.0.1.2.4)
|
||||||
|
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||||
|
libpng12.so.0m.1.2.4, uses assembler code
|
||||||
|
tuned for Intel MMX platform)
|
||||||
|
makefile.sgi => Silicon Graphics (cc, creates libpng12m.so)
|
||||||
|
makefile.sggcc => Silicon Graphics (gcc, creates libpng12m.so)
|
||||||
|
|
||||||
Further information can be found in the README and libpng.txt
|
Further information can be found in the README and libpng.txt
|
||||||
files, in the individual makefiles, and in png.h, and the manual
|
files, in the individual makefiles, in png.h, in the README files in
|
||||||
pages libpng.3 and png.5.
|
subdirectories of the LIB directory, and the manual pages libpng.3 and png.5.
|
||||||
|
147
src/png/README
147
src/png/README
@@ -1,14 +1,19 @@
|
|||||||
README for libpng 1.0.1 (shared library 2.1)
|
README for libpng 1.2.4 - July 8, 2002 (shared library 12.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
This is the first official release of libpng. Don't let the fact that
|
Libpng comes in two distribution formats. Get libpng-*.tar.gz if you
|
||||||
it's the first release fool you. The libpng library has been in
|
want UNIX-style line endings in the text files, or lpng*.zip if you want
|
||||||
extensive use and testing for about two and a half years. However, it's
|
DOS-style line endings.
|
||||||
finally gotten to the stage where there haven't been significant
|
|
||||||
|
Version 0.89 was the first official release of libpng. Don't let the
|
||||||
|
fact that it's the first release fool you. The libpng library has been in
|
||||||
|
extensive use and testing since mid-1995. By late 1997 it had
|
||||||
|
finally gotten to the stage where there hadn't been significant
|
||||||
changes to the API in some time, and people have a bad feeling about
|
changes to the API in some time, and people have a bad feeling about
|
||||||
libraries with versions < 1.0.
|
libraries with versions < 1.0. Version 1.0.0 was released in
|
||||||
|
March 1998.
|
||||||
|
|
||||||
****
|
****
|
||||||
Note that some of the changes to the png_info structure render this
|
Note that some of the changes to the png_info structure render this
|
||||||
@@ -28,8 +33,8 @@ directly, to avoid such problems in the future.
|
|||||||
It is important to note that the APIs do not make current programs
|
It is important to note that the APIs do not make current programs
|
||||||
that access the info struct directly incompatible with the new
|
that access the info struct directly incompatible with the new
|
||||||
library. However, it is strongly suggested that new programs use
|
library. However, it is strongly suggested that new programs use
|
||||||
the new APIs (as shown in example.c), and older programs be converted
|
the new APIs (as shown in example.c and pngtest.c), and older programs
|
||||||
to the new format, to facilitate upgrades in the future.
|
be converted to the new format, to facilitate upgrades in the future.
|
||||||
****
|
****
|
||||||
|
|
||||||
Additions since 0.90 include the ability to compile libpng as a
|
Additions since 0.90 include the ability to compile libpng as a
|
||||||
@@ -49,8 +54,9 @@ to set different actions based on whether the CRC error occurred in a
|
|||||||
critical or an ancillary chunk.
|
critical or an ancillary chunk.
|
||||||
|
|
||||||
The changes made to the library, and bugs fixed are based on discussions
|
The changes made to the library, and bugs fixed are based on discussions
|
||||||
on the PNG implementation mailing list <png-implement@dworking.wustl.edu>
|
on the PNG implementation mailing list <png-implement@ccrc.wustl.edu>
|
||||||
and not on material submitted to Guy.
|
and not on material submitted privately to Guy, Andreas, or Glenn. They will
|
||||||
|
forward any good suggestions to the list.
|
||||||
|
|
||||||
For a detailed description on using libpng, read libpng.txt. For
|
For a detailed description on using libpng, read libpng.txt. For
|
||||||
examples of libpng in a program, see example.c and pngtest.c. For usage
|
examples of libpng in a program, see example.c and pngtest.c. For usage
|
||||||
@@ -98,8 +104,8 @@ fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
|||||||
This release was created and will be supported by myself (of course
|
This release was created and will be supported by myself (of course
|
||||||
based in a large way on Guy's and Andreas' earlier work), and the PNG group.
|
based in a large way on Guy's and Andreas' earlier work), and the PNG group.
|
||||||
|
|
||||||
randeg@alumni.rpi.edu
|
randeg@alum.rpi.edu
|
||||||
png-implement@dworkin.wustl.edu
|
png-implement@ccrc.wustl.edu
|
||||||
|
|
||||||
You can't reach Guy, the original libpng author, at the addresses
|
You can't reach Guy, the original libpng author, at the addresses
|
||||||
given in previous versions of this document. He and Andreas will read mail
|
given in previous versions of this document. He and Andreas will read mail
|
||||||
@@ -108,7 +114,7 @@ addressed to the png-implement list, however.
|
|||||||
Please do not send general questions about PNG. Send them to
|
Please do not send general questions about PNG. Send them to
|
||||||
the address in the specification (png-group@w3.org). At the same
|
the address in the specification (png-group@w3.org). At the same
|
||||||
time, please do not send libpng questions to that address, send them to me
|
time, please do not send libpng questions to that address, send them to me
|
||||||
or to png-implement@dworkin.wustl.edu. I'll
|
or to png-implement@ccrc.wustl.edu. I'll
|
||||||
get them in the end anyway. If you have a question about something
|
get them in the end anyway. If you have a question about something
|
||||||
in the PNG specification that is related to using libpng, send it
|
in the PNG specification that is related to using libpng, send it
|
||||||
to me. Send me any questions that start with "I was using libpng,
|
to me. Send me any questions that start with "I was using libpng,
|
||||||
@@ -123,24 +129,27 @@ gladly listen. Even if your suggestion is not used for version
|
|||||||
|
|
||||||
Files in this distribution:
|
Files in this distribution:
|
||||||
|
|
||||||
|
ANNOUNCE => Announcement of this version, with recent changes
|
||||||
CHANGES => Description of changes between libpng versions
|
CHANGES => Description of changes between libpng versions
|
||||||
|
KNOWNBUG => List of known bugs and deficiencies
|
||||||
|
LICENSE => License to use and redistribute libpng
|
||||||
README => This file
|
README => This file
|
||||||
TODO => Things not implemented in the current library
|
TODO => Things not implemented in the current library
|
||||||
ansi2knr.1 => Manual page for ansi2knr
|
Y2KINFO => Statement of Y2K compliance
|
||||||
ansi2knr.c => Converts files to K&R style function declarations
|
|
||||||
build.bat => MS-DOS batch file for Borland compiler
|
|
||||||
descrip.mms => VMS project file
|
|
||||||
example.c => Example code for using libpng functions
|
example.c => Example code for using libpng functions
|
||||||
libpng.3 => manual page for libpng
|
libpng.3 => manual page for libpng (includes libpng.txt)
|
||||||
libpng.txt => Description of libpng and its functions
|
libpng.txt => Description of libpng and its functions
|
||||||
libpngpf.3 => manual page for libpng's private functions
|
libpngpf.3 => manual page for libpng's private functions
|
||||||
png.5 => manual page for the PNG format
|
png.5 => manual page for the PNG format
|
||||||
png.c => Basic interface functions common to library
|
png.c => Basic interface functions common to library
|
||||||
png.h => Library function and interface declarations
|
png.h => Library function and interface declarations
|
||||||
pngconf.h => System specific library configuration
|
pngconf.h => System specific library configuration
|
||||||
|
pngasmrd.h => Header file for assembler-coded functions
|
||||||
pngerror.c => Error/warning message I/O functions
|
pngerror.c => Error/warning message I/O functions
|
||||||
pngget.c => Functions for retrieving info from struct
|
pngget.c => Functions for retrieving info from struct
|
||||||
pngmem.c => Memory handling functions
|
pngmem.c => Memory handling functions
|
||||||
|
pngbar.png => PNG logo, 88x31
|
||||||
|
pngnow.png => PNG logo, 98x31
|
||||||
pngpread.c => Progressive reading functions
|
pngpread.c => Progressive reading functions
|
||||||
pngread.c => Read data/helper high-level functions
|
pngread.c => Read data/helper high-level functions
|
||||||
pngrio.c => Lowest-level data read I/O functions
|
pngrio.c => Lowest-level data read I/O functions
|
||||||
@@ -154,36 +163,102 @@ Files in this distribution:
|
|||||||
pngwrite.c => High-level write functions
|
pngwrite.c => High-level write functions
|
||||||
pngwtran.c => Write data transformations
|
pngwtran.c => Write data transformations
|
||||||
pngwutil.c => Write utility functions
|
pngwutil.c => Write utility functions
|
||||||
|
contrib => Contributions
|
||||||
|
gregbook => source code for PNG reading and writing, from
|
||||||
|
Greg Roelofs' "PNG: The Definitive Guide",
|
||||||
|
O'Reilly, 1999
|
||||||
|
msvctest => Builds and runs pngtest using a MSVC workspace
|
||||||
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
|
pngsuite => Test images
|
||||||
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
|
projects => Contains project files and workspaces for building DLL
|
||||||
|
beos => Contains a Beos workspace for building libpng
|
||||||
|
borland => Contains a Borland workspace for building libpng
|
||||||
|
and zlib
|
||||||
|
msvc => Contains a Microsoft Visual C++ (MSVC) workspace
|
||||||
|
for building libpng and zlib
|
||||||
|
netware.txt => Contains instructions for downloading a set of
|
||||||
|
project files for building libpng and zlib on
|
||||||
|
Netware.
|
||||||
|
wince.txt => Contains instructions for downloading a Microsoft
|
||||||
|
Visual C++ (Windows CD Toolkit) workspace for
|
||||||
|
building libpng and zlib on WindowsCE
|
||||||
scripts => Directory containing scripts for building libpng:
|
scripts => Directory containing scripts for building libpng:
|
||||||
descrip.mms => VMS makefile for MMS or MMK
|
descrip.mms => VMS makefile for MMS or MMK
|
||||||
makefile.std => Generic UNIX makefile
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with ansi2knr
|
makefile.linux => Linux/ELF makefile
|
||||||
|
(gcc, creates libpng12.so.0.1.2.4)
|
||||||
|
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||||
|
libpng12.so.0.1.2.4, uses assembler code
|
||||||
|
tuned for Intel MMX platform)
|
||||||
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
|
ansi2knr (Requires ansi2knr.c from
|
||||||
|
ftp://ftp.cs.wisc.edu/ghost)
|
||||||
|
makefile.aix => AIX makefile
|
||||||
|
makefile.cygwin => Cygwin/gcc makefile
|
||||||
|
makefile.darwin => Darwin makefile
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile
|
makefile.freebsd => FreeBSD makefile
|
||||||
makefile.sun => Sun makefile
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
makefile.s2x => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0)
|
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||||
makefile.lnx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0)
|
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||||
makefile.mip => MIPS makefile
|
makefile.intel => Intel C/C++ version 4.0 and later
|
||||||
makefile.aco => Acorn makefile
|
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
||||||
makefile.ama => Amiga makefile
|
makefile.macosx => MACOS X Makefile
|
||||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
|
makefile.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so.
|
||||||
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
|
makefile.ne0bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng0.so
|
||||||
makefile.atr => Atari makefile
|
makefile.openbsd => OpenBSD makefile
|
||||||
makefile.bor => Borland makefile
|
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||||
build.bat => MS-DOS batch file for Borland compiler
|
makefile.sggcc => Silicon Graphics (gcc, creates libpng12.so.0.1.2.4)
|
||||||
|
makefile.sunos => Sun makefile
|
||||||
|
makefile.solaris => Solaris 2.X makefile
|
||||||
|
(gcc, creates libpng12.so.0.1.2.4)
|
||||||
|
makefile.so9 => Solaris 9 makefile
|
||||||
|
(gcc, creates libpng12.so.0.1.2.4)
|
||||||
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||||
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
|
makefile.mips => MIPS makefile
|
||||||
|
makefile.acorn => Acorn makefile
|
||||||
|
makefile.amiga => Amiga makefile
|
||||||
|
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC
|
||||||
|
compiler (Requires SCOPTIONS, copied from
|
||||||
|
scripts/SCOPTIONS.ppc)
|
||||||
|
makefile.atari => Atari makefile
|
||||||
|
makefile.beos => BEOS makefile for X86
|
||||||
|
makefile.bor => Borland makefile (uses bcc)
|
||||||
|
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
||||||
|
makefile.bd32 => To make a png32bd.dll with Borland C++ 4.5
|
||||||
|
makefile.tc3 => Turbo C 3.0 makefile
|
||||||
makefile.dj2 => DJGPP 2 makefile
|
makefile.dj2 => DJGPP 2 makefile
|
||||||
makefile.msc => Microsoft C makefile
|
makefile.msc => Microsoft C makefile
|
||||||
makefile.tc3 => Turbo C 3.0 makefile
|
makefile.vcawin32 => makefile for Microsoft Visual C++ 5.0 and
|
||||||
|
later (uses assembler code tuned for Intel MMX
|
||||||
|
platform)
|
||||||
|
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
|
||||||
|
later (does not use assembler code)
|
||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||||
makefile.wat => Watcom 10a+ Makefile, 32-bit flat memory model
|
|
||||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
pngos2.def => OS/2 module definition file used by makefile.os2
|
||||||
|
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
||||||
makevms.com => VMS build script
|
makevms.com => VMS build script
|
||||||
|
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
|
||||||
|
SCOPTIONS.ppc => Used with smakefile.ppc
|
||||||
|
mangle => Directory containing scripts to build libpng12m.so:
|
||||||
|
mangle.in => Function-decoration macros added to png.h by the
|
||||||
|
makefiles.
|
||||||
|
makefile.linux => Linux/ELF makefile
|
||||||
|
(gcc, creates libpng12m.so.0.1.2.4)
|
||||||
|
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||||
|
libpng12.so.0m.1.2.4, uses assembler code
|
||||||
|
tuned for Intel MMX platform)
|
||||||
|
makefile.sgi => Silicon Graphics (cc, creates libpng12m.so)
|
||||||
|
makefile.sggcc => Silicon Graphics (gcc, creates libpng12m.so)
|
||||||
|
|
||||||
Good luck, and happy coding.
|
Good luck, and happy coding.
|
||||||
|
|
||||||
-Glenn Randers-Pehrson
|
-Glenn Randers-Pehrson
|
||||||
Internet: randeg@alumni.rpi.edu
|
Internet: randeg@alum.rpi.edu
|
||||||
Web: http://www.rpi.edu/~randeg/index.html
|
|
||||||
|
|
||||||
-Andreas Eric Dilger
|
-Andreas Eric Dilger
|
||||||
Internet: adilger@enel.ucalgary.ca
|
Internet: adilger@enel.ucalgary.ca
|
||||||
|
44
src/png/TODO
44
src/png/TODO
@@ -1,22 +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
|
Improve API by hiding the png_struct and png_info structs.
|
||||||
add "grayscale" -> "grayscale+alpha" and "grayscale+FILLER" transformations
|
Finish work on the no-floating-point version (including gamma compensation)
|
||||||
improved dithering
|
Better C++ wrapper/full C++ implementation?
|
||||||
multi-lingual error and warning message support
|
Fix problem with C++ and EXTERN "C".
|
||||||
sPLT chunk handling
|
cHRM transformation.
|
||||||
cHRM transformation
|
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
|
||||||
complete sRGB transformation (presently it simply uses gamma=0.45)
|
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
man pages for function calls
|
Improved dithering.
|
||||||
high-level API for reading images
|
Multi-lingual error and warning message support.
|
||||||
final bug fixes
|
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||||
better documentation
|
Man pages for function calls.
|
||||||
better filter selection
|
Better documentation.
|
||||||
(counting huffman bits/precompression? filter inertia? filter costs?)
|
Better filter selection
|
||||||
optional palette creation
|
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||||
histogram creation
|
Histogram creation.
|
||||||
support for application-defined chunk handlers
|
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||||
keep up with public chunks
|
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
|
||||||
better C++ wrapper/full C++ implementation?
|
Build gamma tables using fixed point (and do away with floating point entirely).
|
||||||
text conversion between different code pages (Latin-1 -> Mac and DOS)
|
Use greater precision when changing to linear gamma for compositing against
|
||||||
|
background and doing rgb-to-gray transformation.
|
||||||
|
Investigate pre-incremented loop counters and other loop constructions.
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
Y2K compliance in libpng:
|
Y2K compliance in libpng:
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
January 13, 1999
|
July 8, 2002
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.81 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward are Y2K compliant. It is my belief that earlier versions were
|
upward through 1.2.4 are Y2K compliant. It is my belief that earlier
|
||||||
also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer
|
Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||||
that will hold years up to 65535. The other two hold the date in text
|
that will hold years up to 65535. The other two hold the date in text
|
||||||
@@ -37,15 +37,18 @@
|
|||||||
clock time, which returns (year - 1900), which we properly convert to
|
clock time, which returns (year - 1900), which we properly convert to
|
||||||
the full 4-digit year. There is a possibility that applications using
|
the full 4-digit year. There is a possibility that applications using
|
||||||
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
||||||
function, or incorrectly passing only a 2-digit year instead of
|
function, or that they are incorrectly passing only a 2-digit year
|
||||||
"year - 1900" into the png_convert_from_struct_tm() function, but this
|
instead of "year - 1900" into the png_convert_from_struct_tm() function,
|
||||||
is not under our control. The libpng documentation has always stated
|
but this is not under our control. The libpng documentation has always
|
||||||
that it works with 4-digit years, and the APIs have been documented as
|
stated that it works with 4-digit years, and the APIs have been
|
||||||
such.
|
documented as such.
|
||||||
|
|
||||||
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
||||||
integer to hold the year, and can hold years as large as 65535.
|
integer to hold the year, and can hold years as large as 65535.
|
||||||
|
|
||||||
|
zlib, upon which libpng depends, is also Y2K compliant. It contains
|
||||||
|
no date-related code.
|
||||||
|
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
libpng maintainer
|
libpng maintainer
|
||||||
|
@@ -1,22 +1,38 @@
|
|||||||
|
|
||||||
|
#if 0 /* in case someone actually tries to compile this */
|
||||||
|
|
||||||
/* example.c - an example of using libpng */
|
/* example.c - an example of using libpng */
|
||||||
|
|
||||||
/* This is an example of how to use libpng to read and write PNG files.
|
/* This is an example of how to use libpng to read and write PNG files.
|
||||||
* The file libpng.txt is much more verbose then this. If you have not
|
* The file libpng.txt is much more verbose then this. If you have not
|
||||||
* read it, do so first. This was designed to be a starting point of an
|
* read it, do so first. This was designed to be a starting point of an
|
||||||
* implementation. This is not officially part of libpng, and therefore
|
* implementation. This is not officially part of libpng, is hereby placed
|
||||||
* does not require a copyright notice.
|
* in the public domain, and therefore does not require a copyright notice.
|
||||||
*
|
*
|
||||||
* This file does not currently compile, because it is missing certain
|
* This file does not currently compile, because it is missing certain
|
||||||
* parts, like allocating memory to hold an image. You will have to
|
* parts, like allocating memory to hold an image. You will have to
|
||||||
* supply these parts to get it to compile. For an example of a minimal
|
* supply these parts to get it to compile. For an example of a minimal
|
||||||
* working PNG reader/writer, see pngtest.c, included in this distribution.
|
* working PNG reader/writer, see pngtest.c, included in this distribution;
|
||||||
|
* see also the programs in the contrib directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* Check to see if a file is a PNG file using png_sig_cmp(). Returns
|
/* The png_jmpbuf() macro, used in error handling, became available in
|
||||||
* non-zero if the image is a PNG, and 0 if it isn't a PNG.
|
* libpng version 1.0.6. If you want to be able to run your code with older
|
||||||
|
* versions of libpng, you must define the macro yourself (but only if it
|
||||||
|
* is not already defined by libpng!).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef png_jmpbuf
|
||||||
|
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
||||||
|
* returns zero if the image is a PNG and nonzero if it isn't a PNG.
|
||||||
|
*
|
||||||
|
* The function check_if_png() shown here, but not used, returns nonzero (true)
|
||||||
|
* if the file can be opened and is a PNG, 0 (false) otherwise.
|
||||||
*
|
*
|
||||||
* If this call is successful, and you are going to keep the file open,
|
* If this call is successful, and you are going to keep the file open,
|
||||||
* you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once
|
* you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once
|
||||||
@@ -38,15 +54,17 @@ int check_if_png(char *file_name, FILE **fp)
|
|||||||
char buf[PNG_BYTES_TO_CHECK];
|
char buf[PNG_BYTES_TO_CHECK];
|
||||||
|
|
||||||
/* Open the prospective PNG file. */
|
/* Open the prospective PNG file. */
|
||||||
if ((*fp = fopen(file_name, "rb")) != NULL);
|
if ((*fp = fopen(file_name, "rb")) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Read in the signature bytes */
|
/* Read in some of the signature bytes */
|
||||||
if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK)
|
if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Compare the first PNG_BYTES_TO_CHECK bytes of the signature. */
|
/* Compare the first PNG_BYTES_TO_CHECK bytes of the signature.
|
||||||
return(png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK));
|
Return nonzero (true) if they match */
|
||||||
|
|
||||||
|
return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a PNG file. You may want to return an error code if the read
|
/* Read a PNG file. You may want to return an error code if the read
|
||||||
@@ -66,7 +84,7 @@ void read_png(char *file_name) /* We need to open the file */
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if ((fp = fopen(file_name, "rb")) == NULL)
|
if ((fp = fopen(file_name, "rb")) == NULL)
|
||||||
return;
|
return (ERROR);
|
||||||
#else no_open_file /* prototype 2 */
|
#else no_open_file /* prototype 2 */
|
||||||
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||||
{
|
{
|
||||||
@@ -83,12 +101,12 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
* was compiled with a compatible version of the library. REQUIRED
|
* was compiled with a compatible version of the library. REQUIRED
|
||||||
*/
|
*/
|
||||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||||
(void *)user_error_ptr, user_error_fn, user_warning_fn);
|
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate/initialize the memory for image information. REQUIRED. */
|
/* Allocate/initialize the memory for image information. REQUIRED. */
|
||||||
@@ -96,21 +114,22 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
|
||||||
return;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set error handling if you are using the setjmp/longjmp method (this is
|
/* Set error handling if you are using the setjmp/longjmp method (this is
|
||||||
* the normal method of doing things with libpng). REQUIRED unless you
|
* the normal method of doing things with libpng). REQUIRED unless you
|
||||||
* set up your own error handlers in the png_create_read_struct() earlier.
|
* set up your own error handlers in the png_create_read_struct() earlier.
|
||||||
*/
|
*/
|
||||||
if (setjmp(png_ptr->jmpbuf))
|
|
||||||
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* Free all of the memory associated with the png_ptr and info_ptr */
|
/* Free all of the memory associated with the png_ptr and info_ptr */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
/* If we get here, we had a problem reading the file */
|
/* If we get here, we had a problem reading the file */
|
||||||
return;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One of the following I/O initialization methods is REQUIRED */
|
/* One of the following I/O initialization methods is REQUIRED */
|
||||||
@@ -129,24 +148,37 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
/* If we have already read some of the signature */
|
/* If we have already read some of the signature */
|
||||||
png_set_sig_bytes(png_ptr, sig_read);
|
png_set_sig_bytes(png_ptr, sig_read);
|
||||||
|
|
||||||
|
#ifdef hilevel
|
||||||
|
/*
|
||||||
|
* If you have enough memory to read in the entire image at once,
|
||||||
|
* and you need to specify only transforms that can be controlled
|
||||||
|
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
||||||
|
* dithering, filling, setting background, and doing gamma
|
||||||
|
* adjustment), then you can read the entire image (including
|
||||||
|
* pixels) into the info structure with this call:
|
||||||
|
*/
|
||||||
|
png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
|
||||||
|
#else
|
||||||
|
/* OK, you're doing it the hard way, with the lower-level functions */
|
||||||
|
|
||||||
/* The call to png_read_info() gives us all of the information from the
|
/* The call to png_read_info() gives us all of the information from the
|
||||||
* PNG file before the first IDAT (image data chunk). REQUIRED
|
* PNG file before the first IDAT (image data chunk). REQUIRED
|
||||||
*/
|
*/
|
||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||||
&interlace_type, NULL, NULL);
|
&interlace_type, int_p_NULL, int_p_NULL);
|
||||||
|
|
||||||
/**** Set up the data transformations you want. Note that these are all
|
/* Set up the data transformations you want. Note that these are all
|
||||||
**** optional. Only call them if you want/need them. Many of the
|
* optional. Only call them if you want/need them. Many of the
|
||||||
**** transformations only work on specific types of images, and many
|
* transformations only work on specific types of images, and many
|
||||||
**** are mutually exclusive.
|
* are mutually exclusive.
|
||||||
****/
|
*/
|
||||||
|
|
||||||
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
|
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
|
|
||||||
/* Strip alpha bytes from the input data without combining with th
|
/* Strip alpha bytes from the input data without combining with the
|
||||||
* background (not recommended).
|
* background (not recommended).
|
||||||
*/
|
*/
|
||||||
png_set_strip_alpha(png_ptr);
|
png_set_strip_alpha(png_ptr);
|
||||||
@@ -162,17 +194,17 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
|
|
||||||
/* Expand paletted colors into true RGB triplets */
|
/* Expand paletted colors into true RGB triplets */
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_expand(png_ptr);
|
png_set_palette_rgb(png_ptr);
|
||||||
|
|
||||||
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
png_set_expand(png_ptr);
|
png_set_gray_1_2_4_to_8(png_ptr);
|
||||||
|
|
||||||
/* Expand paletted or RGB images with transparency to full alpha channels
|
/* Expand paletted or RGB images with transparency to full alpha channels
|
||||||
* so the data will be available as RGBA quartets.
|
* so the data will be available as RGBA quartets.
|
||||||
*/
|
*/
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
png_set_expand(png_ptr);
|
png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
|
||||||
/* Set the background color to draw transparent and alpha images over.
|
/* Set the background color to draw transparent and alpha images over.
|
||||||
* It is possible to set the red, green, and blue components directly
|
* It is possible to set the red, green, and blue components directly
|
||||||
@@ -192,7 +224,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
|
|
||||||
/* Some suggestions as to how to get a screen gamma value */
|
/* Some suggestions as to how to get a screen gamma value */
|
||||||
|
|
||||||
/* Note that screen gamma is (display_gamma/viewing_gamma) */
|
/* Note that screen gamma is the display_exponent, which includes
|
||||||
|
* the CRT_exponent and any correction for viewing conditions */
|
||||||
if (/* We have a user-defined screen gamma value */)
|
if (/* We have a user-defined screen gamma value */)
|
||||||
{
|
{
|
||||||
screen_gamma = user-defined screen_gamma;
|
screen_gamma = user-defined screen_gamma;
|
||||||
@@ -210,7 +243,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell libpng to handle the gamma conversion for you. The second call
|
/* Tell libpng to handle the gamma conversion for you. The final call
|
||||||
* is a good guess for PC generated images, but it should be configurable
|
* is a good guess for PC generated images, but it should be configurable
|
||||||
* by the user at run time by the user. It is strongly suggested that
|
* by the user at run time by the user. It is strongly suggested that
|
||||||
* your application support gamma correction.
|
* your application support gamma correction.
|
||||||
@@ -219,19 +252,22 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
int intent;
|
int intent;
|
||||||
|
|
||||||
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_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
{
|
{
|
||||||
png_uint_32 num_palette;
|
int num_palette;
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
|
|
||||||
/* This reduces the image to the application supplied palette */
|
/* This reduces the image to the application supplied palette */
|
||||||
@@ -241,12 +277,12 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
png_color std_color_cube[MAX_SCREEN_COLORS];
|
png_color std_color_cube[MAX_SCREEN_COLORS];
|
||||||
|
|
||||||
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
||||||
MAX_SCREEN_COLORS, NULL, 0);
|
MAX_SCREEN_COLORS, png_uint_16p_NULL, 0);
|
||||||
}
|
}
|
||||||
/* This reduces the image to the palette supplied in the file */
|
/* This reduces the image to the palette supplied in the file */
|
||||||
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
||||||
{
|
{
|
||||||
png_color16p histogram;
|
png_uint_16p histogram;
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr, &histogram);
|
png_get_hIST(png_ptr, info_ptr, &histogram);
|
||||||
|
|
||||||
@@ -255,7 +291,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* invert monocrome files to have 0 as white and 1 as black */
|
/* invert monochrome files to have 0 as white and 1 as black */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
/* If you want to shift the pixel values from the range [0,255] or
|
/* If you want to shift the pixel values from the range [0,255] or
|
||||||
@@ -264,13 +300,14 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
*/
|
*/
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
||||||
{
|
{
|
||||||
png_color8p sig_bit;
|
png_color_8p sig_bit;
|
||||||
|
|
||||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||||
png_set_shift(png_ptr, sig_bit);
|
png_set_shift(png_ptr, sig_bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flip the RGB pixels to BGR (or RGBA to BGRA) */
|
/* flip the RGB pixels to BGR (or RGBA to BGRA) */
|
||||||
|
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
||||||
@@ -301,7 +338,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
|
|
||||||
for (row = 0; row < height; row++)
|
for (row = 0; row < height; row++)
|
||||||
{
|
{
|
||||||
row_pointers[row] = malloc(png_get_rowbytes(png_ptr, info_ptr));
|
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||||
|
info_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now it's time to read the image. One of these methods is REQUIRED */
|
/* Now it's time to read the image. One of these methods is REQUIRED */
|
||||||
@@ -316,18 +354,18 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
#ifdef single /* Read the image a single row at a time */
|
#ifdef single /* Read the image a single row at a time */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
png_bytep row_pointers = row[y];
|
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, 1);
|
||||||
png_read_rows(png_ptr, &row_pointers, NULL, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else no_single /* Read the image several rows at a time */
|
#else no_single /* Read the image several rows at a time */
|
||||||
for (y = 0; y < height; y += number_of_rows)
|
for (y = 0; y < height; y += number_of_rows)
|
||||||
{
|
{
|
||||||
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
||||||
png_read_rows(png_ptr, row_pointers, NULL, number_of_rows);
|
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL,
|
||||||
|
number_of_rows);
|
||||||
#else no_sparkle /* Read the image using the "rectangle" effect */
|
#else no_sparkle /* Read the image using the "rectangle" effect */
|
||||||
png_read_rows(png_ptr, NULL, row_pointers, number_of_rows);
|
png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y],
|
||||||
|
number_of_rows);
|
||||||
#endif no_sparkle /* use only one of these two methods */
|
#endif no_sparkle /* use only one of these two methods */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,15 +377,18 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
|
|
||||||
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
||||||
png_read_end(png_ptr, info_ptr);
|
png_read_end(png_ptr, info_ptr);
|
||||||
|
#endif hilevel
|
||||||
|
|
||||||
|
/* At this point you have read the entire image */
|
||||||
|
|
||||||
/* clean up after the read, and free any memory allocated - REQUIRED */
|
/* clean up after the read, and free any memory allocated - REQUIRED */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||||
|
|
||||||
/* close the file */
|
/* close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* that's it */
|
/* that's it */
|
||||||
return;
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* progressively read a file */
|
/* progressively read a file */
|
||||||
@@ -362,30 +403,33 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
|||||||
* linked libraries.
|
* linked libraries.
|
||||||
*/
|
*/
|
||||||
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||||
(void *)user_error_ptr, user_error_fn, user_warning_fn);
|
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||||
|
|
||||||
if (*png_ptr == NULL)
|
if (*png_ptr == NULL)
|
||||||
{
|
{
|
||||||
*info_ptr = NULL;
|
*info_ptr = NULL;
|
||||||
return ERROR;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
*info_ptr = png_create_info_struct(png_ptr);
|
*info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
|
||||||
if (*info_ptr == NULL)
|
if (*info_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
return ERROR;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp((*png_ptr)->jmpbuf))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
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
|
||||||
@@ -396,18 +440,18 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
|||||||
png_set_progressive_read_fn(*png_ptr, (void *)stream_data,
|
png_set_progressive_read_fn(*png_ptr, (void *)stream_data,
|
||||||
info_callback, row_callback, end_callback);
|
info_callback, row_callback, end_callback);
|
||||||
|
|
||||||
return OK;
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
process_data(png_structp *png_ptr, png_infop *info_ptr,
|
process_data(png_structp *png_ptr, png_infop *info_ptr,
|
||||||
png_bytep buffer, png_uint_32 length)
|
png_bytep buffer, png_uint_32 length)
|
||||||
{
|
{
|
||||||
if (setjmp((*png_ptr)->jmpbuf))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
/* Free the png_ptr and info_ptr memory on error */
|
/* Free the png_ptr and info_ptr memory on error */
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
return ERROR;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This one's new also. Simply give it chunks of data as
|
/* This one's new also. Simply give it chunks of data as
|
||||||
@@ -421,7 +465,7 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
|
|||||||
* callback, if you aren't already displaying them there.
|
* callback, if you aren't already displaying them there.
|
||||||
*/
|
*/
|
||||||
png_process_data(*png_ptr, *info_ptr, buffer, length);
|
png_process_data(*png_ptr, *info_ptr, buffer, length);
|
||||||
return OK;
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
info_callback(png_structp png_ptr, png_infop info)
|
info_callback(png_structp png_ptr, png_infop info)
|
||||||
@@ -438,21 +482,47 @@ info_callback(png_structp png_ptr, png_infop info)
|
|||||||
row_callback(png_structp png_ptr, png_bytep new_row,
|
row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
png_uint_32 row_num, int pass)
|
png_uint_32 row_num, int pass)
|
||||||
{
|
{
|
||||||
/* this function is called for every row in the image. If the
|
/*
|
||||||
* image is interlacing, and you turned on the interlace handler,
|
* This function is called for every row in the image. If the
|
||||||
|
* image is interlaced, and you turned on the interlace handler,
|
||||||
* this function will be called for every row in every pass.
|
* this function will be called for every row in every pass.
|
||||||
* Some of these rows will not be changed from the previous pass.
|
*
|
||||||
* When the row is not changed, the new_row variable will be NULL.
|
* In this function you will receive a pointer to new row data from
|
||||||
|
* libpng called new_row that is to replace a corresponding row (of
|
||||||
|
* the same data format) in a buffer allocated by your application.
|
||||||
|
*
|
||||||
|
* The new row data pointer new_row may be NULL, indicating there is
|
||||||
|
* no new data to be replaced (in cases of interlace loading).
|
||||||
|
*
|
||||||
|
* If new_row is not NULL then you need to call
|
||||||
|
* png_progressive_combine_row() to replace the corresponding row as
|
||||||
|
* shown below:
|
||||||
|
*/
|
||||||
|
/* Check if row_num is in bounds. */
|
||||||
|
if((row_num >= 0) && (row_num < height))
|
||||||
|
{
|
||||||
|
/* Get pointer to corresponding row in our
|
||||||
|
* PNG read buffer.
|
||||||
|
*/
|
||||||
|
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
||||||
|
|
||||||
|
/* If both rows are allocated then copy the new row
|
||||||
|
* data to the corresponding row data.
|
||||||
|
*/
|
||||||
|
if((old_row != NULL) && (new_row != NULL))
|
||||||
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
|
}
|
||||||
|
/*
|
||||||
* The rows and passes are called in order, so you don't really
|
* The rows and passes are called in order, so you don't really
|
||||||
* need the row_num and pass, but I'm supplying them because it
|
* need the row_num and pass, but I'm supplying them because it
|
||||||
* may make your life easier.
|
* may make your life easier.
|
||||||
*
|
*
|
||||||
* For the non-NULL rows of interlaced images, you must call
|
* For the non-NULL rows of interlaced images, you must call
|
||||||
* png_progressive_combine_row() passing in the row and the
|
* png_progressive_combine_row() passing in the new row and the
|
||||||
* old row. You can call this function for NULL rows (it will
|
* old row, as demonstrated above. You can call this function for
|
||||||
* just return) and for non-interlaced images (it just does the
|
* NULL rows (it will just return) and for non-interlaced images
|
||||||
* memcpy for you) if it will make the code easier. Thus, you
|
* (it just does the png_memcpy for you) if it will make the code
|
||||||
* can just do this for all cases:
|
* easier. Thus, you can just do this for all cases:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
@@ -461,8 +531,8 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
|||||||
* that the first pass (pass == 0 really) will completely cover
|
* that the first pass (pass == 0 really) will completely cover
|
||||||
* the old row, so the rows do not have to be initialized. After
|
* the old row, so the rows do not have to be initialized. After
|
||||||
* the first pass (and only for interlaced images), you will have
|
* the first pass (and only for interlaced images), you will have
|
||||||
* to pass the current row, and the function will combine the
|
* to pass the current row as new_row, and the function will combine
|
||||||
* old row and the new row.
|
* the old row and the new row.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,11 +555,12 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
png_structp png_ptr;
|
png_structp png_ptr;
|
||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
|
png_colorp palette;
|
||||||
|
|
||||||
/* open the file */
|
/* open the file */
|
||||||
fp = fopen(file_name, "wb");
|
fp = fopen(file_name, "wb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return;
|
return (ERROR);
|
||||||
|
|
||||||
/* Create and initialize the png_struct with the desired error handler
|
/* Create and initialize the png_struct with the desired error handler
|
||||||
* functions. If you want to use the default stderr and longjump method,
|
* functions. If you want to use the default stderr and longjump method,
|
||||||
@@ -498,12 +569,12 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* in case we are using dynamically linked libraries. REQUIRED.
|
* in case we are using dynamically linked libraries. REQUIRED.
|
||||||
*/
|
*/
|
||||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||||
(void *)user_error_ptr, user_error_fn, user_warning_fn);
|
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate/initialize the image information data. REQUIRED */
|
/* Allocate/initialize the image information data. REQUIRED */
|
||||||
@@ -511,19 +582,19 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
png_destroy_write_struct(&png_ptr, png_infopp_NULL);
|
||||||
return;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set error handling. REQUIRED if you aren't supplying your own
|
/* Set error handling. REQUIRED if you aren't supplying your own
|
||||||
* error hadnling functions in the png_create_write_struct() call.
|
* error handling functions in the png_create_write_struct() call.
|
||||||
*/
|
*/
|
||||||
if (setjmp(png_ptr->jmpbuf))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* If we get here, we had a problem reading the file */
|
/* If we get here, we had a problem reading the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
return;
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One of the following I/O initialization functions is REQUIRED */
|
/* One of the following I/O initialization functions is REQUIRED */
|
||||||
@@ -538,6 +609,15 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
/* where user_io_ptr is a structure you want available to the callbacks */
|
/* where user_io_ptr is a structure you want available to the callbacks */
|
||||||
#endif no_streams /* only use one initialization method */
|
#endif no_streams /* only use one initialization method */
|
||||||
|
|
||||||
|
#ifdef hilevel
|
||||||
|
/* This is the easy way. Use it if you already have all the
|
||||||
|
* image info living info in the structure. You could "|" many
|
||||||
|
* PNG_TRANSFORM flags into the png_transforms integer here.
|
||||||
|
*/
|
||||||
|
png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
|
||||||
|
#else
|
||||||
|
/* This is the hard way */
|
||||||
|
|
||||||
/* Set the image information here. Width and height are up to 2^31,
|
/* Set the image information here. Width and height are up to 2^31,
|
||||||
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
|
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
|
||||||
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
|
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
|
||||||
@@ -550,9 +630,13 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
/* set the palette if there is one. REQUIRED for indexed-color images */
|
/* set the palette if there is one. REQUIRED for indexed-color images */
|
||||||
palette = (png_colorp)png_malloc(png_ptr, 256 * sizeof (png_color));
|
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
||||||
|
* sizeof (png_color));
|
||||||
/* ... set palette colors ... */
|
/* ... set palette colors ... */
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette, 256);
|
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||||
|
/* You must not free palette here, because png_set_PLTE only makes a link to
|
||||||
|
the palette that you malloced. Wait until you are about to destroy
|
||||||
|
the png structure. */
|
||||||
|
|
||||||
/* optional significant bit chunk */
|
/* optional significant bit chunk */
|
||||||
/* if we are dealing with a grayscale image then */
|
/* if we are dealing with a grayscale image then */
|
||||||
@@ -581,15 +665,31 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
text_ptr[2].key = "Description";
|
text_ptr[2].key = "Description";
|
||||||
text_ptr[2].text = "<long text>";
|
text_ptr[2].text = "<long text>";
|
||||||
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, 2);
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
|
text_ptr[0].lang = NULL;
|
||||||
|
text_ptr[1].lang = NULL;
|
||||||
|
text_ptr[2].lang = NULL;
|
||||||
|
#endif
|
||||||
|
png_set_text(png_ptr, info_ptr, text_ptr, 3);
|
||||||
|
|
||||||
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
|
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
|
||||||
/* note that if sRGB is present the cHRM chunk must be ignored
|
/* note that if sRGB is present the gAMA and cHRM chunks must be ignored
|
||||||
* on read and must be written in accordance with the sRGB profile */
|
* on read and must be written in accordance with the sRGB profile */
|
||||||
|
|
||||||
/* Write the file header information. REQUIRED */
|
/* Write the file header information. REQUIRED */
|
||||||
png_write_info(png_ptr, info_ptr);
|
png_write_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
/* If you want, you can write the info in two steps, in case you need to
|
||||||
|
* write your private chunk ahead of PLTE:
|
||||||
|
*
|
||||||
|
* png_write_info_before_PLTE(write_ptr, write_info_ptr);
|
||||||
|
* write_my_chunk();
|
||||||
|
* png_write_info(png_ptr, info_ptr);
|
||||||
|
*
|
||||||
|
* However, given the level of known- and unknown-chunk support in 1.1.0
|
||||||
|
* and up, this should no longer be necessary.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Once we write out the header, the compression type on the text
|
/* Once we write out the header, the compression type on the text
|
||||||
* chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or
|
* chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or
|
||||||
* PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again
|
* PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again
|
||||||
@@ -600,7 +700,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* all optional. Only call them if you want them.
|
* all optional. Only call them if you want them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* invert monocrome pixels */
|
/* invert monochrome pixels */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
/* Shift the pixels up to a legal bit depth and fill in
|
/* Shift the pixels up to a legal bit depth and fill in
|
||||||
@@ -638,7 +738,11 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* layout, however, so choose what fits your needs best). You need to
|
* layout, however, so choose what fits your needs best). You need to
|
||||||
* use the first method if you aren't handling interlacing yourself.
|
* use the first method if you aren't handling interlacing yourself.
|
||||||
*/
|
*/
|
||||||
png_byte row_pointers[height][width];
|
png_uint_32 k, height, width;
|
||||||
|
png_byte image[height][width*bytes_per_pixel];
|
||||||
|
png_bytep row_pointers[height];
|
||||||
|
for (k = 0; k < height; k++)
|
||||||
|
row_pointers[k] = image + k*width*bytes_per_pixel;
|
||||||
|
|
||||||
/* One of the following output methods is REQUIRED */
|
/* One of the following output methods is REQUIRED */
|
||||||
#ifdef entire /* write out the entire image data in one call */
|
#ifdef entire /* write out the entire image data in one call */
|
||||||
@@ -653,36 +757,48 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
for (pass = 0; pass < number_passes; pass++)
|
for (pass = 0; pass < number_passes; pass++)
|
||||||
{
|
{
|
||||||
/* Write a few rows at a time. */
|
/* Write a few rows at a time. */
|
||||||
png_write_rows(png_ptr, row_pointers, number_of_rows);
|
png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows);
|
||||||
|
|
||||||
/* If you are only writing one row at a time, this works */
|
/* If you are only writing one row at a time, this works */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
png_bytep row_pointers = row[y];
|
png_write_rows(png_ptr, &row_pointers[y], 1);
|
||||||
png_write_rows(png_ptr, &row_pointers, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif no_entire /* use only one output method */
|
#endif no_entire /* use only one output method */
|
||||||
|
|
||||||
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
||||||
* as well.
|
* as well. Shouldn't be necessary in 1.1.0 and up as all the public
|
||||||
|
* chunks are supported and you can use png_set_unknown_chunks() to
|
||||||
|
* register unknown chunks into the info structure to be written out.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* It is REQUIRED to call this to finish writing the rest of the file */
|
/* It is REQUIRED to call this to finish writing the rest of the file */
|
||||||
png_write_end(png_ptr, info_ptr);
|
png_write_end(png_ptr, info_ptr);
|
||||||
|
#endif hilevel
|
||||||
|
|
||||||
/* if you malloced the palette, free it here */
|
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
|
||||||
free(info_ptr->palette);
|
as recommended in versions 1.0.5m and earlier of this example; if
|
||||||
|
libpng mallocs info_ptr->palette, libpng will free it). If you
|
||||||
|
allocated it with malloc() instead of png_malloc(), use free() instead
|
||||||
|
of png_free(). */
|
||||||
|
png_free(png_ptr, palette);
|
||||||
|
palette=NULL;
|
||||||
|
|
||||||
/* if you allocated any text comments, free them here */
|
/* Similarly, if you png_malloced any data that you passed in with
|
||||||
|
png_set_something(), such as a hist or trans array, free it here,
|
||||||
|
when you can be sure that libpng is through with it. */
|
||||||
|
png_free(png_ptr, trans);
|
||||||
|
trans=NULL;
|
||||||
|
|
||||||
/* clean up after the write, and free any memory allocated */
|
/* clean up after the write, and free any memory allocated */
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
|
|
||||||
/* close the file */
|
/* close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* that's it */
|
/* that's it */
|
||||||
return;
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* if 0 */
|
||||||
|
2753
src/png/libpng.3
2753
src/png/libpng.3
File diff suppressed because it is too large
Load Diff
1420
src/png/libpng.txt
1420
src/png/libpng.txt
File diff suppressed because it is too large
Load Diff
@@ -1,338 +1,548 @@
|
|||||||
.TH LIBPNGPF 3 "March 15, 1998"
|
.TH LIBPNGPF 3 "July 8, 2002"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.4
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
#include <png.h>
|
\fB#include <png.h>\fP
|
||||||
|
|
||||||
void png_build_gamma_table (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_build_grayscale_palette (int bit_depth, png_colorp
|
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
palette);
|
|
||||||
|
|
||||||
void png_calculate_crc (png_structp png_ptr, png_bytep ptr,
|
\fI\fB
|
||||||
png_size_t length);
|
|
||||||
void png_check_chunk_name (png_structp png_ptr, png_bytep
|
|
||||||
chunk_name);
|
|
||||||
|
|
||||||
png_size_t png_check_keyword (png_structp png_ptr, png_charp
|
\fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP
|
||||||
key, png_charpp new_key);
|
|
||||||
|
|
||||||
void png_combine_row (png_structp png_ptr, png_bytep row, int
|
\fI\fB
|
||||||
mask);
|
|
||||||
|
|
||||||
void png_correct_palette (png_structp png_ptr, png_colorp
|
\fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
palette, int num_palette);
|
|
||||||
|
|
||||||
int png_crc_error (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
int png_crc_finish (png_structp png_ptr, png_uint_32 skip);
|
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
|
||||||
|
|
||||||
void png_crc_read (png_structp png_ptr, png_bytep buf,
|
\fI\fB
|
||||||
png_size_t length);
|
|
||||||
|
|
||||||
png_voidp png_create_struct (int type);
|
\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP
|
||||||
|
|
||||||
void png_destroy_struct (png_voidp struct_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_do_background (png_row_infop row_info, png_bytep row,
|
\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP
|
||||||
png_color_16p trans_values, png_color_16p background,
|
|
||||||
png_color_16p background_1, png_bytep gamma_table, png_bytep
|
|
||||||
gamma_from_1, png_bytep gamma_to_1, png_uint_16pp gamma_16,
|
|
||||||
png_uint_16pp gamma_16_from_1, png_uint_16pp gamma_16_to_1, int
|
|
||||||
gamma_shift);
|
|
||||||
|
|
||||||
void png_do_bgr (png_row_infop row_info, png_bytep row);
|
\fI\fB
|
||||||
|
|
||||||
void png_do_chop (png_row_infop row_info, png_bytep row);
|
\fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP
|
||||||
|
|
||||||
void png_do_dither (png_row_infop row_info, png_bytep row,
|
\fI\fB
|
||||||
png_bytep palette_lookup, png_bytep dither_lookup);
|
|
||||||
|
|
||||||
void png_do_expand (png_row_infop row_info, png_bytep row,
|
\fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
png_color_16p trans_value);
|
|
||||||
|
|
||||||
void png_do_expand_palette (png_row_infop row_info, png_bytep
|
\fI\fB
|
||||||
row, png_colorp palette, png_bytep trans, int num_trans);
|
|
||||||
|
|
||||||
void png_do_gamma (png_row_infop row_info, png_bytep row,
|
\fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP
|
||||||
png_bytep gamma_table, png_uint_16pp gamma_16_table, int
|
|
||||||
gamma_shift);
|
|
||||||
|
|
||||||
void png_do_gray_to_rgb (png_row_infop row_info, png_bytep
|
\fI\fB
|
||||||
row);
|
|
||||||
|
|
||||||
void png_do_invert (png_row_infop row_info, png_bytep row);
|
\fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
void png_do_pack (png_row_infop row_info, png_bytep row,
|
\fI\fB
|
||||||
png_uint_32 bit_depth);
|
|
||||||
|
|
||||||
void png_do_packswap (png_row_infop row_info, png_bytep row);
|
\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP
|
||||||
|
|
||||||
void png_do_read_filler (png_row_infop row_info, png_bytep row,
|
\fI\fB
|
||||||
png_uint_32 filler, png_uint_32 flags);
|
|
||||||
|
|
||||||
void png_do_read_interlace (png_row_infop row_info, png_bytep
|
\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
|
||||||
row, int pass, png_uint_32 transformations);
|
|
||||||
|
|
||||||
void png_do_read_invert_alpha (png_row_infop row_info,
|
\fI\fB
|
||||||
png_bytep row);
|
|
||||||
|
|
||||||
void png_do_read_swap_alpha (png_row_infop row_info, png_bytep
|
\fBpng_charp png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
|
||||||
row);
|
|
||||||
|
|
||||||
void png_do_read_transformations (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_do_rgb_to_gray (png_row_infop row_info, png_bytep
|
\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP
|
||||||
row);
|
|
||||||
|
|
||||||
void png_do_shift (png_row_infop row_info, png_bytep row,
|
\fI\fB
|
||||||
png_color_8p bit_depth);
|
|
||||||
|
|
||||||
void png_do_strip_filler (png_row_infop row_info, png_bytep
|
\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
|
||||||
row, png_uint_32 flags);
|
|
||||||
|
|
||||||
void png_do_swap (png_row_infop row_info, png_bytep row);
|
\fI\fB
|
||||||
|
|
||||||
void png_do_unpack (png_row_infop row_info, png_bytep row);
|
\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP
|
||||||
|
|
||||||
void png_do_unshift (png_row_infop row_info, png_bytep row,
|
\fI\fB
|
||||||
png_color_8p sig_bits);
|
|
||||||
|
|
||||||
void png_do_write_interlace (png_row_infop row_info, png_bytep
|
\fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
row, int pass);
|
|
||||||
|
|
||||||
void png_do_write_invert_alpha (png_row_infop row_info,
|
\fI\fB
|
||||||
png_bytep row);
|
|
||||||
|
|
||||||
void png_do_write_swap_alpha (png_row_infop row_info, png_bytep
|
\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
row);
|
|
||||||
|
|
||||||
void png_do_write_transformations (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void *png_far_to_near (png_structp png_ptr,png_voidp ptr,
|
\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP
|
||||||
int check);
|
|
||||||
|
|
||||||
void png_flush (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
png_int_32 png_get_int_32 (png_bytep buf);
|
\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
|
||||||
|
|
||||||
png_uint_16 png_get_uint_16 (png_bytep buf);
|
\fI\fB
|
||||||
|
|
||||||
png_uint_32 png_get_uint_32 (png_bytep buf);
|
\fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP
|
||||||
|
|
||||||
void png_handle_bKGD (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_cHRM (png_structp png_ptr, png_infop info_ptr,
|
\fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_gAMA (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_hIST (png_structp png_ptr, png_infop info_ptr,
|
\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_IEND (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_IHDR (png_structp png_ptr, png_infop info_ptr,
|
\fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_oFFs (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_pCAL (png_structp png_ptr, png_infop info_ptr,
|
\fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_pHYs (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_PLTE (png_structp png_ptr, png_infop info_ptr,
|
\fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_sBIT (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_sRGB (png_structp png_ptr, png_infop info_ptr,
|
\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_tEXt (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_tIME (png_structp png_ptr, png_infop info_ptr,
|
\fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_tRNS (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_unknown (png_structp png_ptr, png_infop
|
\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
info_ptr, png_uint_32 length);
|
|
||||||
|
|
||||||
void png_handle_zTXt (png_structp png_ptr, png_infop info_ptr,
|
\fI\fB
|
||||||
png_uint_32 length);
|
|
||||||
|
|
||||||
void png_info_destroy (png_structp png_ptr, png_infop
|
\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_init_read_transformations (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_process_IDAT_data (png_structp png_ptr, png_bytep
|
\fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
buffer, png_size_t buffer_length);
|
|
||||||
|
|
||||||
void png_process_some_data (png_structp png_ptr, png_infop
|
\fI\fB
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_push_check_crc (png_structp png_ptr);
|
\fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
void png_push_crc_finish (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_push_crc_skip (png_structp png_ptr, png_uint_32
|
\fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP
|
||||||
length);
|
|
||||||
|
|
||||||
void png_push_fill_buffer (png_structp png_ptr, png_bytep
|
\fI\fB
|
||||||
buffer, png_size_t length);
|
|
||||||
|
|
||||||
void png_push_handle_tEXt (png_structp png_ptr, png_infop
|
\fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
|
||||||
info_ptr, png_uint_32 length);
|
|
||||||
|
|
||||||
void png_push_handle_unknown (png_structp png_ptr, png_infop
|
\fI\fB
|
||||||
info_ptr, png_uint_32 length);
|
|
||||||
|
|
||||||
void png_push_handle_zTXt (png_structp png_ptr, png_infop
|
\fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
info_ptr, png_uint_32 length);
|
|
||||||
|
|
||||||
void png_push_have_end (png_structp png_ptr, png_infop
|
\fI\fB
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_push_have_info (png_structp png_ptr, png_infop
|
\fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_push_have_row (png_structp png_ptr, png_bytep row);
|
\fI\fB
|
||||||
|
|
||||||
void png_push_process_row (png_structp png_ptr);
|
\fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP
|
||||||
|
|
||||||
void png_push_read_chunk (png_structp png_ptr, png_infop
|
\fI\fB
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_push_read_end (png_structp png_ptr, png_infop
|
\fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_push_read_IDAT (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_push_read_sig (png_structp png_ptr, png_infop
|
\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_push_read_tEXt (png_structp png_ptr, png_infop
|
\fI\fB
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_push_read_zTXt (png_structp png_ptr, png_infop
|
\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_push_restore_buffer (png_structp png_ptr, png_bytep
|
\fI\fB
|
||||||
buffer, png_size_t buffer_length);
|
|
||||||
|
|
||||||
void png_push_save_buffer (png_structp png_ptr);
|
\fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
void png_read_data (png_structp png_ptr, png_bytep data,
|
\fI\fB
|
||||||
png_size_t length);
|
|
||||||
|
|
||||||
void png_read_filter_row (png_structp png_ptr, png_row_infop
|
\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP
|
||||||
row_info, png_bytep row, png_bytep prev_row, int filter);
|
|
||||||
|
|
||||||
void png_read_finish_row (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_read_init (png_structp png_ptr);
|
\fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
void png_read_push_finish_row (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_read_start_row (png_structp png_ptr);
|
\fBpng_int_32 png_get_int_32 (png_bytep \fIbuf\fP\fB);\fP
|
||||||
|
|
||||||
void png_read_transform_info (png_structp png_ptr, png_infop
|
\fI\fB
|
||||||
info_ptr);
|
|
||||||
|
|
||||||
void png_reset_crc (png_structp png_ptr);
|
\fBpng_uint_16 png_get_uint_16 (png_bytep \fIbuf\fP\fB);\fP
|
||||||
|
|
||||||
void png_save_int_32 (png_bytep buf, png_int_32 i);
|
\fI\fB
|
||||||
|
|
||||||
void png_save_uint_16 (png_bytep buf, unsigned int i);
|
\fBpng_uint_32 png_get_uint_32 (png_bytep \fIbuf\fP\fB);\fP
|
||||||
|
|
||||||
void png_save_uint_32 (png_bytep buf, png_uint_32 i);
|
\fI\fB
|
||||||
|
|
||||||
void png_write_bKGD (png_structp png_ptr, png_color_16p values,
|
\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
int color_type);
|
|
||||||
|
|
||||||
void png_write_cHRM (png_structp png_ptr, double white_x,
|
\fI\fB
|
||||||
double white_y, double red_x, double red_y, double green_x,
|
|
||||||
double green_y, double blue_x, double blue_y);
|
|
||||||
|
|
||||||
void png_write_data (png_structp png_ptr, png_bytep data,
|
\fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
png_size_t length);
|
|
||||||
void png_write_filtered_row (png_structp png_ptr, png_bytep
|
|
||||||
filtered_row);
|
|
||||||
|
|
||||||
void png_write_find_filter (png_structp png_ptr, png_row_infop
|
\fI\fB
|
||||||
row_info);
|
|
||||||
|
|
||||||
void png_write_finish_row (png_structp png_ptr);
|
\fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
void png_write_gAMA (png_structp png_ptr, double file_gamma);
|
\fI\fB
|
||||||
|
|
||||||
void png_write_hIST (png_structp png_ptr, png_uint_16p hist,
|
\fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
int num_hist);
|
|
||||||
|
|
||||||
void png_write_init (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_write_IDAT (png_structp png_ptr, png_bytep data,
|
\fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
png_size_t length);
|
|
||||||
|
|
||||||
void png_write_IEND (png_structp png_ptr);
|
\fI\fB
|
||||||
|
|
||||||
void png_write_IHDR (png_structp png_ptr, png_uint_32 width,
|
\fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
png_uint_32 height, int bit_depth, int color_type, int
|
|
||||||
compression_type, int filter_type, int interlace_type);
|
|
||||||
|
|
||||||
void png_write_oFFs (png_structp png_ptr, png_uint_32 x_offset,
|
\fI\fB
|
||||||
png_uint_32 y_offset, int unit_type);
|
|
||||||
|
|
||||||
void png_write_pCAL (png_structp png_ptr, png_charp purpose,
|
\fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
png_int_32 X0, png_int_32 X1, int type, int nparams, png_charp
|
|
||||||
units, png_charpp params);
|
|
||||||
|
|
||||||
void png_write_pHYs (png_structp png_ptr, png_uint_32
|
\fI\fB
|
||||||
x_pixels_per_unit, png_uint_32 y_pixels_per_unit, int
|
|
||||||
unit_type);
|
|
||||||
|
|
||||||
void png_write_PLTE (png_structp png_ptr, png_colorp palette,
|
\fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
png_uint_32 num_pal);
|
|
||||||
|
|
||||||
void png_write_sBIT (png_structp png_ptr, png_color_8p sbit,
|
\fI\fB
|
||||||
int color_type);
|
|
||||||
|
|
||||||
void png_write_sig (png_structp png_ptr);
|
\fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
void png_write_sRGB (png_structp png_ptr, int intent);
|
\fI\fB
|
||||||
|
|
||||||
void png_write_start_row (png_structp png_ptr);
|
\fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
void png_write_tEXt (png_structp png_ptr, png_charp key,
|
\fI\fB
|
||||||
png_charp text, png_size_t text_len);
|
|
||||||
|
|
||||||
void png_write_tIME (png_structp png_ptr, png_timep mod_time);
|
\fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
void png_write_tRNS (png_structp png_ptr, png_bytep trans,
|
\fI\fB
|
||||||
png_color_16p values, int number, int color_type);
|
|
||||||
|
|
||||||
void png_write_zTXt (png_structp png_ptr, png_charp key,
|
\fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
png_charp text, png_size_t text_len, int compression);
|
|
||||||
|
|
||||||
voidpf png_zalloc (voidpf png_ptr, uInt items, uInt size);
|
\fI\fB
|
||||||
|
|
||||||
void png_zfree (voidpf png_ptr, voidpf ptr);
|
\fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_save_int_32 (png_bytep \fP\fIbuf\fP\fB, png_int_32 \fIi\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_save_uint_16 (png_bytep \fP\fIbuf\fP\fB, unsigned int \fIi\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_save_uint_32 (png_bytep \fP\fIbuf\fP\fB, png_uint_32 \fIi\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text)\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext)\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The functions listed above are used privately by libpng
|
The functions listed above are used privately by libpng
|
||||||
and are not recommended for use by applications. They
|
and are not recommended for use by applications. They are
|
||||||
|
not "exported" to applications using shared libraries. They
|
||||||
are listed alphabetically here as an aid to libpng maintainers.
|
are listed alphabetically here as an aid to libpng maintainers.
|
||||||
See png.h for more information on these functions.
|
See png.h for more information on these functions.
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "March 15, 1998"
|
.TH PNG 5 "July 8, 2002"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
@@ -20,7 +20,16 @@ platforms.
|
|||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.IR libpng(3), zlib(3), deflate(5), and zlib(5)
|
.IR libpng(3), zlib(3), deflate(5), and zlib(5)
|
||||||
.LP
|
.LP
|
||||||
PNG specification:
|
PNG 1.2 specification, July 1999:
|
||||||
|
.IP
|
||||||
|
.br
|
||||||
|
http://www.libpng.org/pub/png
|
||||||
|
.br
|
||||||
|
or ftp://ftp.uu.net/graphics/png/documents
|
||||||
|
.LP
|
||||||
|
PNG 1.0 specification, October 1996:
|
||||||
|
.IP
|
||||||
|
.br
|
||||||
RFC 2083
|
RFC 2083
|
||||||
.IP
|
.IP
|
||||||
.br
|
.br
|
||||||
@@ -32,12 +41,19 @@ http://www.w3.org/TR/REC-png.html
|
|||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
This man page: Glenn Randers-Pehrson
|
This man page: Glenn Randers-Pehrson
|
||||||
.LP
|
.LP
|
||||||
|
Portable Network Graphics (PNG) Specification Version 1.2 (July 8, 1999):
|
||||||
|
Glenn Randers-Pehrson and others (png-list@ccrc.wustl.edu).
|
||||||
|
.LP
|
||||||
Portable Network Graphics (PNG) Specification Version 1.0 (October 1, 1996):
|
Portable Network Graphics (PNG) Specification Version 1.0 (October 1, 1996):
|
||||||
Thomas Boutell and others (png-list@dworkin.wustl.edu).
|
Thomas Boutell and others (png-list@ccrc.wustl.edu).
|
||||||
.LP
|
.LP
|
||||||
|
|
||||||
|
|
||||||
.SH COPYRIGHT NOTICE
|
.SH COPYRIGHT NOTICE
|
||||||
The PNG specification is copyright (c) 1996 Massachussets Institute of
|
The PNG-1.2 specification is copyright (c) 1999 Glenn Randers-Pehrson.
|
||||||
|
See the specification for conditions of use and distribution.
|
||||||
|
.LP
|
||||||
|
The PNG-1.0 specification is copyright (c) 1996 Massachusetts Institute of
|
||||||
Technology. See the specification for conditions of use and distribution.
|
Technology. See the specification for conditions of use and distribution.
|
||||||
.LP
|
.LP
|
||||||
.\" end of man page
|
.\" end of man page
|
||||||
|
687
src/png/png.c
687
src/png/png.c
@@ -1,92 +1,101 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng version 1.2.4 - July 8, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
*
|
||||||
* March 15, 1998
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#define PNG_NO_EXTERN
|
#define PNG_NO_EXTERN
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
|
typedef version_1_2_4 Your_png_h_is_not_version_1_2_4;
|
||||||
|
|
||||||
/* 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.1";
|
|
||||||
|
|
||||||
|
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||||
|
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
||||||
|
const char png_libpng_ver[18] = "1.2.4";
|
||||||
|
|
||||||
|
/* png_sig was changed to a function in version 1.0.5c */
|
||||||
/* 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};
|
const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
|
|
||||||
/* Constant strings for known chunk types. If you need to add a chunk,
|
/* Invoke global declarations for constant strings for known chunk types */
|
||||||
* add a string holding the name here. If you want to make the code
|
PNG_IHDR;
|
||||||
* portable to EBCDIC machines, use ASCII numbers, not characters.
|
PNG_IDAT;
|
||||||
*/
|
PNG_IEND;
|
||||||
png_byte FARDATA png_IHDR[5] = { 73, 72, 68, 82, '\0'};
|
PNG_PLTE;
|
||||||
png_byte FARDATA png_IDAT[5] = { 73, 68, 65, 84, '\0'};
|
PNG_bKGD;
|
||||||
png_byte FARDATA png_IEND[5] = { 73, 69, 78, 68, '\0'};
|
PNG_cHRM;
|
||||||
png_byte FARDATA png_PLTE[5] = { 80, 76, 84, 69, '\0'};
|
PNG_gAMA;
|
||||||
png_byte FARDATA png_bKGD[5] = { 98, 75, 71, 68, '\0'};
|
PNG_hIST;
|
||||||
png_byte FARDATA png_cHRM[5] = { 99, 72, 82, 77, '\0'};
|
PNG_iCCP;
|
||||||
png_byte FARDATA png_gAMA[5] = {103, 65, 77, 65, '\0'};
|
PNG_iTXt;
|
||||||
png_byte FARDATA png_hIST[5] = {104, 73, 83, 84, '\0'};
|
PNG_oFFs;
|
||||||
png_byte FARDATA png_oFFs[5] = {111, 70, 70, 115, '\0'};
|
PNG_pCAL;
|
||||||
png_byte FARDATA png_pCAL[5] = {112, 67, 65, 76, '\0'};
|
PNG_sCAL;
|
||||||
png_byte FARDATA png_pHYs[5] = {112, 72, 89, 115, '\0'};
|
PNG_pHYs;
|
||||||
png_byte FARDATA png_sBIT[5] = {115, 66, 73, 84, '\0'};
|
PNG_sBIT;
|
||||||
png_byte FARDATA png_sRGB[5] = {115, 82, 71, 66, '\0'};
|
PNG_sPLT;
|
||||||
png_byte FARDATA png_tEXt[5] = {116, 69, 88, 116, '\0'};
|
PNG_sRGB;
|
||||||
png_byte FARDATA png_tIME[5] = {116, 73, 77, 69, '\0'};
|
PNG_tEXt;
|
||||||
png_byte FARDATA png_tRNS[5] = {116, 82, 78, 83, '\0'};
|
PNG_tIME;
|
||||||
png_byte FARDATA png_zTXt[5] = {122, 84, 88, 116, '\0'};
|
PNG_tRNS;
|
||||||
|
PNG_zTXt;
|
||||||
|
|
||||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||||
|
|
||||||
/* start of interlace block */
|
/* start of interlace block */
|
||||||
int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||||
|
|
||||||
/* offset to next interlace block */
|
/* offset to next interlace block */
|
||||||
int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
|
|
||||||
/* start of interlace block in the y direction */
|
/* start of interlace block in the y direction */
|
||||||
int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||||
|
|
||||||
/* offset to next interlace block in the y direction */
|
/* offset to next interlace block in the y direction */
|
||||||
int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||||
|
|
||||||
/* Width of interlace block. This is not currently used - if you need
|
/* width of interlace block (used in assembler routines only) */
|
||||||
* it, uncomment it here and in png.h
|
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||||
int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
/* Height of interlace block. This is not currently used - if you need
|
/* Height of interlace block. This is not currently used - if you need
|
||||||
* it, uncomment it here and in png.h
|
* it, uncomment it here and in png.h
|
||||||
int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Mask to determine which pixels are valid in a pass */
|
/* Mask to determine which pixels are valid in a pass */
|
||||||
int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
const int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||||
|
|
||||||
/* Mask to determine which pixels to overwrite while displaying */
|
/* Mask to determine which pixels to overwrite while displaying */
|
||||||
int FARDATA png_pass_dsp_mask[] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
const int FARDATA png_pass_dsp_mask[]
|
||||||
|
= {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||||
* of the PNG file signature. If the PNG data is embedded into another
|
* of the PNG file signature. If the PNG data is embedded into another
|
||||||
* stream we can set num_bytes = 8 so that libpng will not attempt to read
|
* stream we can set num_bytes = 8 so that libpng will not attempt to read
|
||||||
* or write any of the magic bytes before it starts on the IHDR.
|
* or write any of the magic bytes before it starts on the IHDR.
|
||||||
*/
|
*/
|
||||||
void
|
|
||||||
|
void PNGAPI
|
||||||
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_sig_bytes\n");
|
png_debug(1, "in png_set_sig_bytes\n");
|
||||||
if (num_bytes > 8)
|
if (num_bytes > 8)
|
||||||
png_error(png_ptr, "Too many bytes for PNG signature.");
|
png_error(png_ptr, "Too many bytes for PNG signature.");
|
||||||
|
|
||||||
png_ptr->sig_bytes = num_bytes < 0 ? 0 : num_bytes;
|
png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks whether the supplied bytes match the PNG signature. We allow
|
/* Checks whether the supplied bytes match the PNG signature. We allow
|
||||||
@@ -97,9 +106,10 @@ png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
|||||||
* respectively, to be less than, to match, or be greater than the correct
|
* respectively, to be less than, to match, or be greater than the correct
|
||||||
* PNG signature (this is the same behaviour as strcmp, memcmp, etc).
|
* PNG signature (this is the same behaviour as strcmp, memcmp, etc).
|
||||||
*/
|
*/
|
||||||
int
|
int PNGAPI
|
||||||
png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
||||||
{
|
{
|
||||||
|
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
if (num_to_check > 8)
|
if (num_to_check > 8)
|
||||||
num_to_check = 8;
|
num_to_check = 8;
|
||||||
else if (num_to_check < 1)
|
else if (num_to_check < 1)
|
||||||
@@ -111,29 +121,41 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
|||||||
if (start + num_to_check > 8)
|
if (start + num_to_check > 8)
|
||||||
num_to_check = 8 - start;
|
num_to_check = 8 - start;
|
||||||
|
|
||||||
return ((int)(png_memcmp(&sig[start], &png_sig[start], num_to_check)));
|
return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (Obsolete) function to check signature bytes. It does not allow one
|
/* (Obsolete) function to check signature bytes. It does not allow one
|
||||||
* to check a partial signature. This function will be removed in the
|
* to check a partial signature. This function might be removed in the
|
||||||
* future - use png_sig_cmp().
|
* future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG.
|
||||||
*/
|
*/
|
||||||
int
|
int PNGAPI
|
||||||
png_check_sig(png_bytep sig, int num)
|
png_check_sig(png_bytep sig, int num)
|
||||||
{
|
{
|
||||||
return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
|
return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function to allocate memory for zlib. */
|
/* Function to allocate memory for zlib and clear it to 0. */
|
||||||
voidpf
|
#ifdef PNG_1_0_X
|
||||||
|
void PNGAPI
|
||||||
|
#else
|
||||||
|
voidpf /* private */
|
||||||
|
#endif
|
||||||
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||||
{
|
{
|
||||||
|
png_uint_32 num_bytes = (png_uint_32)items * size;
|
||||||
png_voidp ptr;
|
png_voidp ptr;
|
||||||
png_uint_32 num_bytes;
|
png_structp p=png_ptr;
|
||||||
|
png_uint_32 save_flags=p->flags;
|
||||||
|
|
||||||
num_bytes = (png_uint_32)items * size;
|
p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
||||||
ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
||||||
if (num_bytes > (png_uint_32)0x8000)
|
p->flags=save_flags;
|
||||||
|
|
||||||
|
#ifndef PNG_NO_ZALLOC_ZERO
|
||||||
|
if (ptr == NULL)
|
||||||
|
return ((voidpf)ptr);
|
||||||
|
|
||||||
|
if (num_bytes > (png_uint_32)0x8000L)
|
||||||
{
|
{
|
||||||
png_memset(ptr, 0, (png_size_t)0x8000L);
|
png_memset(ptr, 0, (png_size_t)0x8000L);
|
||||||
png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
|
png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
|
||||||
@@ -143,11 +165,16 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
|||||||
{
|
{
|
||||||
png_memset(ptr, 0, (png_size_t)num_bytes);
|
png_memset(ptr, 0, (png_size_t)num_bytes);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return ((voidpf)ptr);
|
return ((voidpf)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function to free memory for zlib */
|
/* function to free memory for zlib */
|
||||||
void
|
#ifdef PNG_1_0_X
|
||||||
|
void PNGAPI
|
||||||
|
#else
|
||||||
|
void /* private */
|
||||||
|
#endif
|
||||||
png_zfree(voidpf png_ptr, voidpf ptr)
|
png_zfree(voidpf png_ptr, voidpf ptr)
|
||||||
{
|
{
|
||||||
png_free((png_structp)png_ptr, (png_voidp)ptr);
|
png_free((png_structp)png_ptr, (png_voidp)ptr);
|
||||||
@@ -156,7 +183,7 @@ png_zfree(voidpf png_ptr, voidpf ptr)
|
|||||||
/* Reset the CRC variable to 32 bits of 1's. Care must be taken
|
/* Reset the CRC variable to 32 bits of 1's. Care must be taken
|
||||||
* in case CRC is > 32 bits to leave the top bits 0.
|
* in case CRC is > 32 bits to leave the top bits 0.
|
||||||
*/
|
*/
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_reset_crc(png_structp png_ptr)
|
png_reset_crc(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_ptr->crc = crc32(0, Z_NULL, 0);
|
png_ptr->crc = crc32(0, Z_NULL, 0);
|
||||||
@@ -167,7 +194,7 @@ png_reset_crc(png_structp png_ptr)
|
|||||||
* also check that this data will actually be used before going to the
|
* also check that this data will actually be used before going to the
|
||||||
* trouble of calculating it.
|
* trouble of calculating it.
|
||||||
*/
|
*/
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
|
png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
|
||||||
{
|
{
|
||||||
int need_crc = 1;
|
int need_crc = 1;
|
||||||
@@ -194,17 +221,21 @@ png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
|
|||||||
* and png_info_init() so that applications that want to use a shared
|
* and png_info_init() so that applications that want to use a shared
|
||||||
* libpng don't have to be recompiled if png_info changes size.
|
* libpng don't have to be recompiled if png_info changes size.
|
||||||
*/
|
*/
|
||||||
png_infop
|
png_infop PNGAPI
|
||||||
png_create_info_struct(png_structp png_ptr)
|
png_create_info_struct(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
|
|
||||||
png_debug(1, "in png_create_info_struct\n");
|
png_debug(1, "in png_create_info_struct\n");
|
||||||
if(png_ptr == NULL) return (NULL);
|
if(png_ptr == NULL) return (NULL);
|
||||||
if ((info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO)) != NULL)
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
{
|
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
|
||||||
png_info_init(info_ptr);
|
png_ptr->malloc_fn, png_ptr->mem_ptr);
|
||||||
}
|
#else
|
||||||
|
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
||||||
|
#endif
|
||||||
|
if (info_ptr != NULL)
|
||||||
|
png_info_init_3(&info_ptr, sizeof(png_info));
|
||||||
|
|
||||||
return (info_ptr);
|
return (info_ptr);
|
||||||
}
|
}
|
||||||
@@ -214,7 +245,7 @@ png_create_info_struct(png_structp png_ptr)
|
|||||||
* png_destroy_write_struct() to free an info struct, but this may be
|
* png_destroy_write_struct() to free an info struct, but this may be
|
||||||
* useful for some applications.
|
* useful for some applications.
|
||||||
*/
|
*/
|
||||||
void
|
void PNGAPI
|
||||||
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
||||||
{
|
{
|
||||||
png_infop info_ptr = NULL;
|
png_infop info_ptr = NULL;
|
||||||
@@ -227,8 +258,13 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
|||||||
{
|
{
|
||||||
png_info_destroy(png_ptr, info_ptr);
|
png_info_destroy(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn,
|
||||||
|
png_ptr->mem_ptr);
|
||||||
|
#else
|
||||||
png_destroy_struct((png_voidp)info_ptr);
|
png_destroy_struct((png_voidp)info_ptr);
|
||||||
*info_ptr_ptr = (png_infop)NULL;
|
#endif
|
||||||
|
*info_ptr_ptr = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,55 +272,323 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
|||||||
* and applications using it are urged to use png_create_info_struct()
|
* and applications using it are urged to use png_create_info_struct()
|
||||||
* instead.
|
* instead.
|
||||||
*/
|
*/
|
||||||
void
|
#undef png_info_init
|
||||||
|
void PNGAPI
|
||||||
png_info_init(png_infop info_ptr)
|
png_info_init(png_infop info_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_info_init\n");
|
/* We only come here via pre-1.0.12-compiled applications */
|
||||||
|
png_info_init_3(&info_ptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PNGAPI
|
||||||
|
png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
||||||
|
{
|
||||||
|
png_infop info_ptr = *ptr_ptr;
|
||||||
|
|
||||||
|
png_debug(1, "in png_info_init_3\n");
|
||||||
|
|
||||||
|
if(sizeof(png_info) > png_info_struct_size)
|
||||||
|
{
|
||||||
|
png_destroy_struct(info_ptr);
|
||||||
|
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
||||||
|
*ptr_ptr = info_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* set everything to 0 */
|
/* set everything to 0 */
|
||||||
png_memset(info_ptr, 0, sizeof (png_info));
|
png_memset(info_ptr, 0, sizeof (png_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
void PNGAPI
|
||||||
|
png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
||||||
|
int freer, png_uint_32 mask)
|
||||||
|
{
|
||||||
|
png_debug(1, "in png_data_freer\n");
|
||||||
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
|
return;
|
||||||
|
if(freer == PNG_DESTROY_WILL_FREE_DATA)
|
||||||
|
info_ptr->free_me |= mask;
|
||||||
|
else if(freer == PNG_USER_WILL_FREE_DATA)
|
||||||
|
info_ptr->free_me &= ~mask;
|
||||||
|
else
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Unknown freer parameter in png_data_freer.");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void PNGAPI
|
||||||
|
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
|
||||||
|
int num)
|
||||||
|
{
|
||||||
|
png_debug(1, "in png_free_data\n");
|
||||||
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if defined(PNG_TEXT_SUPPORTED)
|
||||||
|
/* free text item num or (if num == -1) all text items */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if (mask & PNG_FREE_TEXT)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (num != -1)
|
||||||
|
{
|
||||||
|
if (info_ptr->text && info_ptr->text[num].key)
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->text[num].key);
|
||||||
|
info_ptr->text[num].key = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < info_ptr->num_text; i++)
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i);
|
||||||
|
png_free(png_ptr, info_ptr->text);
|
||||||
|
info_ptr->text = NULL;
|
||||||
|
info_ptr->num_text=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_tRNS_SUPPORTED)
|
||||||
|
/* free any tRNS entry */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->trans);
|
||||||
|
info_ptr->valid &= ~PNG_INFO_tRNS;
|
||||||
|
#ifndef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
|
||||||
|
#endif
|
||||||
|
info_ptr->trans = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_sCAL_SUPPORTED)
|
||||||
|
/* free any sCAL entry */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if (mask & PNG_FREE_SCAL)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||||
|
png_free(png_ptr, info_ptr->scal_s_width);
|
||||||
|
png_free(png_ptr, info_ptr->scal_s_height);
|
||||||
|
info_ptr->scal_s_width = NULL;
|
||||||
|
info_ptr->scal_s_height = NULL;
|
||||||
|
#endif
|
||||||
|
info_ptr->valid &= ~PNG_INFO_sCAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_pCAL_SUPPORTED)
|
||||||
|
/* free any pCAL entry */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if (mask & PNG_FREE_PCAL)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->pcal_purpose);
|
||||||
|
png_free(png_ptr, info_ptr->pcal_units);
|
||||||
|
info_ptr->pcal_purpose = NULL;
|
||||||
|
info_ptr->pcal_units = NULL;
|
||||||
|
if (info_ptr->pcal_params != NULL)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->pcal_params[i]);
|
||||||
|
info_ptr->pcal_params[i]=NULL;
|
||||||
|
}
|
||||||
|
png_free(png_ptr, info_ptr->pcal_params);
|
||||||
|
info_ptr->pcal_params = NULL;
|
||||||
|
}
|
||||||
|
info_ptr->valid &= ~PNG_INFO_pCAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_iCCP_SUPPORTED)
|
||||||
|
/* free any iCCP entry */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if (mask & PNG_FREE_ICCP)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->iccp_name);
|
||||||
|
png_free(png_ptr, info_ptr->iccp_profile);
|
||||||
|
info_ptr->iccp_name = NULL;
|
||||||
|
info_ptr->iccp_profile = NULL;
|
||||||
|
info_ptr->valid &= ~PNG_INFO_iCCP;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_sPLT_SUPPORTED)
|
||||||
|
/* free a given sPLT entry, or (if num == -1) all sPLT entries */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if (mask & PNG_FREE_SPLT)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (num != -1)
|
||||||
|
{
|
||||||
|
if(info_ptr->splt_palettes)
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->splt_palettes[num].name);
|
||||||
|
png_free(png_ptr, info_ptr->splt_palettes[num].entries);
|
||||||
|
info_ptr->splt_palettes[num].name = NULL;
|
||||||
|
info_ptr->splt_palettes[num].entries = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(info_ptr->splt_palettes_num)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_SPLT, i);
|
||||||
|
|
||||||
|
png_free(png_ptr, info_ptr->splt_palettes);
|
||||||
|
info_ptr->splt_palettes = NULL;
|
||||||
|
info_ptr->splt_palettes_num = 0;
|
||||||
|
}
|
||||||
|
info_ptr->valid &= ~PNG_INFO_sPLT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if (mask & PNG_FREE_UNKN)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (num != -1)
|
||||||
|
{
|
||||||
|
if(info_ptr->unknown_chunks)
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->unknown_chunks[num].data);
|
||||||
|
info_ptr->unknown_chunks[num].data = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if(info_ptr->unknown_chunks_num)
|
||||||
|
{
|
||||||
|
for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);
|
||||||
|
|
||||||
|
png_free(png_ptr, info_ptr->unknown_chunks);
|
||||||
|
info_ptr->unknown_chunks = NULL;
|
||||||
|
info_ptr->unknown_chunks_num = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_hIST_SUPPORTED)
|
||||||
|
/* free any hIST entry */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_HIST) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if ((mask & PNG_FREE_HIST) && (png_ptr->flags & PNG_FLAG_FREE_HIST))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->hist);
|
||||||
|
info_ptr->hist = NULL;
|
||||||
|
info_ptr->valid &= ~PNG_INFO_hIST;
|
||||||
|
#ifndef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_ptr->flags &= ~PNG_FLAG_FREE_HIST;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* free any PLTE entry that was internally allocated */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_PLTE) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if ((mask & PNG_FREE_PLTE) && (png_ptr->flags & PNG_FLAG_FREE_PLTE))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
png_zfree(png_ptr, info_ptr->palette);
|
||||||
|
info_ptr->palette = NULL;
|
||||||
|
info_ptr->valid &= ~PNG_INFO_PLTE;
|
||||||
|
#ifndef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_ptr->flags &= ~PNG_FLAG_FREE_PLTE;
|
||||||
|
#endif
|
||||||
|
info_ptr->num_palette = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
||||||
|
/* free any image bits attached to the info structure */
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
|
||||||
|
#else
|
||||||
|
if (mask & PNG_FREE_ROWS)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if(info_ptr->row_pointers)
|
||||||
|
{
|
||||||
|
int row;
|
||||||
|
for (row = 0; row < (int)info_ptr->height; row++)
|
||||||
|
{
|
||||||
|
png_free(png_ptr, info_ptr->row_pointers[row]);
|
||||||
|
info_ptr->row_pointers[row]=NULL;
|
||||||
|
}
|
||||||
|
png_free(png_ptr, info_ptr->row_pointers);
|
||||||
|
info_ptr->row_pointers=NULL;
|
||||||
|
}
|
||||||
|
info_ptr->valid &= ~PNG_INFO_IDAT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
if(num == -1)
|
||||||
|
info_ptr->free_me &= ~mask;
|
||||||
|
else
|
||||||
|
info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* This is an internal routine to free any memory that the info struct is
|
/* This is an internal routine to free any memory that the info struct is
|
||||||
* pointing to before re-using it or freeing the struct itself. Recall
|
* pointing to before re-using it or freeing the struct itself. Recall
|
||||||
* that png_free() checks for NULL pointers for us.
|
* that png_free() checks for NULL pointers for us.
|
||||||
*/
|
*/
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
|
|
||||||
int i;
|
|
||||||
|
|
||||||
png_debug(1, "in png_info_destroy\n");
|
png_debug(1, "in png_info_destroy\n");
|
||||||
if (info_ptr->text != NULL)
|
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||||
|
|
||||||
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
|
if (png_ptr->num_chunk_list)
|
||||||
{
|
{
|
||||||
for (i = 0; i < info_ptr->num_text; i++)
|
png_free(png_ptr, png_ptr->chunk_list);
|
||||||
{
|
png_ptr->chunk_list=NULL;
|
||||||
png_free(png_ptr, info_ptr->text[i].key);
|
png_ptr->num_chunk_list=0;
|
||||||
}
|
|
||||||
png_free(png_ptr, info_ptr->text);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
|
||||||
png_free(png_ptr, info_ptr->pcal_purpose);
|
|
||||||
png_free(png_ptr, info_ptr->pcal_units);
|
|
||||||
if (info_ptr->pcal_params != NULL)
|
|
||||||
{
|
|
||||||
for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
|
|
||||||
{
|
|
||||||
png_free(png_ptr, info_ptr->pcal_params[i]);
|
|
||||||
}
|
|
||||||
png_free(png_ptr, info_ptr->pcal_params);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_info_init(info_ptr);
|
png_info_init_3(&info_ptr, sizeof(png_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function returns a pointer to the io_ptr associated with the user
|
/* This function returns a pointer to the io_ptr associated with the user
|
||||||
* functions. The application should free any memory associated with this
|
* functions. The application should free any memory associated with this
|
||||||
* pointer before png_write_destroy() or png_read_destroy() are called.
|
* pointer before png_write_destroy() or png_read_destroy() are called.
|
||||||
*/
|
*/
|
||||||
png_voidp
|
png_voidp PNGAPI
|
||||||
png_get_io_ptr(png_structp png_ptr)
|
png_get_io_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
return (png_ptr->io_ptr);
|
return (png_ptr->io_ptr);
|
||||||
@@ -293,12 +597,209 @@ png_get_io_ptr(png_structp png_ptr)
|
|||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
/* Initialize the default input/output functions for the PNG file. If you
|
/* Initialize the default input/output functions for the PNG file. If you
|
||||||
* use your own read or write routines, you can call either png_set_read_fn()
|
* use your own read or write routines, you can call either png_set_read_fn()
|
||||||
* or png_set_write_fn() instead of png_init_io().
|
* or png_set_write_fn() instead of png_init_io(). If you have defined
|
||||||
|
* PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't
|
||||||
|
* necessarily available.
|
||||||
*/
|
*/
|
||||||
void
|
void PNGAPI
|
||||||
png_init_io(png_structp png_ptr, FILE *fp)
|
png_init_io(png_structp png_ptr, png_FILE_p fp)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_init_io\n");
|
png_debug(1, "in png_init_io\n");
|
||||||
png_ptr->io_ptr = (png_voidp)fp;
|
png_ptr->io_ptr = (png_voidp)fp;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
||||||
|
/* Convert the supplied time into an RFC 1123 string suitable for use in
|
||||||
|
* a "Creation Time" or other text-based time string.
|
||||||
|
*/
|
||||||
|
png_charp PNGAPI
|
||||||
|
png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||||
|
{
|
||||||
|
static PNG_CONST char short_months[12][4] =
|
||||||
|
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||||
|
|
||||||
|
if (png_ptr->time_buffer == NULL)
|
||||||
|
{
|
||||||
|
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
||||||
|
sizeof(char)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
{
|
||||||
|
wchar_t time_buf[29];
|
||||||
|
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
|
||||||
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
|
ptime->second % 61);
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#ifdef USE_FAR_KEYWORD
|
||||||
|
{
|
||||||
|
char near_time_buf[29];
|
||||||
|
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
|
ptime->second % 61);
|
||||||
|
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
||||||
|
29*sizeof(char));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
|
ptime->second % 61);
|
||||||
|
#endif
|
||||||
|
#endif /* _WIN32_WCE */
|
||||||
|
return ((png_charp)png_ptr->time_buffer);
|
||||||
|
}
|
||||||
|
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Signature string for a PNG file. */
|
||||||
|
png_bytep PNGAPI
|
||||||
|
png_sig_bytes(void)
|
||||||
|
{
|
||||||
|
return ((png_bytep)"\211\120\116\107\015\012\032\012");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_charp PNGAPI
|
||||||
|
png_get_copyright(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
|
||||||
|
return ((png_charp) "\n libpng version 1.2.4 - July 8, 2002\n\
|
||||||
|
Copyright (c) 1998-2002 Glenn Randers-Pehrson\n\
|
||||||
|
Copyright (c) 1996-1997 Andreas Dilger\n\
|
||||||
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
||||||
|
return ((png_charp) "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The following return the library version as a short string in the
|
||||||
|
* format 1.0.0 through 99.99.99zz. To get the version of *.h files used
|
||||||
|
* with your application, print out PNG_LIBPNG_VER_STRING, which is defined
|
||||||
|
* in png.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
png_charp PNGAPI
|
||||||
|
png_get_libpng_ver(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
/* Version of *.c files used when building libpng */
|
||||||
|
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||||
|
return((png_charp) "1.2.4");
|
||||||
|
return((png_charp) "1.2.4");
|
||||||
|
}
|
||||||
|
|
||||||
|
png_charp PNGAPI
|
||||||
|
png_get_header_ver(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
/* Version of *.h files used when building libpng */
|
||||||
|
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||||
|
return((png_charp) PNG_LIBPNG_VER_STRING);
|
||||||
|
return((png_charp) PNG_LIBPNG_VER_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
png_charp PNGAPI
|
||||||
|
png_get_header_version(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
/* Returns longer string containing both version and date */
|
||||||
|
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||||
|
return((png_charp) PNG_HEADER_VERSION_STRING);
|
||||||
|
return((png_charp) PNG_HEADER_VERSION_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
|
int PNGAPI
|
||||||
|
png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
|
||||||
|
{
|
||||||
|
/* check chunk_name and return "keep" value if it's on the list, else 0 */
|
||||||
|
int i;
|
||||||
|
png_bytep p;
|
||||||
|
if((png_ptr == NULL && chunk_name == NULL) || png_ptr->num_chunk_list<=0)
|
||||||
|
return 0;
|
||||||
|
p=png_ptr->chunk_list+png_ptr->num_chunk_list*5-5;
|
||||||
|
for (i = png_ptr->num_chunk_list; i; i--, p-=5)
|
||||||
|
if (!png_memcmp(chunk_name, p, 4))
|
||||||
|
return ((int)*(p+4));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This function, added to libpng-1.0.6g, is untested. */
|
||||||
|
int PNGAPI
|
||||||
|
png_reset_zstream(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (inflateReset(&png_ptr->zstream));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function was added to libpng-1.0.7 */
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_access_version_number(void)
|
||||||
|
{
|
||||||
|
/* Version of *.c files used when building libpng */
|
||||||
|
return((png_uint_32) 10204L);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(PNG_1_0_X)
|
||||||
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||||
|
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
||||||
|
/* this INTERNAL function was added to libpng 1.2.0 */
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_init_mmx_flags (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
png_ptr->mmx_rowbytes_threshold = 0;
|
||||||
|
png_ptr->mmx_bitdepth_threshold = 0;
|
||||||
|
|
||||||
|
# if (defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD))
|
||||||
|
|
||||||
|
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_COMPILED;
|
||||||
|
|
||||||
|
if (png_mmx_support()) {
|
||||||
|
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||||
|
# ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
|
||||||
|
# endif
|
||||||
|
# ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_INTERLACE
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||||
|
;
|
||||||
|
# else
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||||
|
|
||||||
|
png_ptr->mmx_rowbytes_threshold = PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT;
|
||||||
|
png_ptr->mmx_bitdepth_threshold = PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT;
|
||||||
|
# endif
|
||||||
|
} else {
|
||||||
|
png_ptr->asm_flags &= ~( PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||||
|
| PNG_MMX_READ_FLAGS
|
||||||
|
| PNG_MMX_WRITE_FLAGS );
|
||||||
|
}
|
||||||
|
|
||||||
|
# else /* !((PNGVCRD || PNGGCCRD) && PNG_ASSEMBLER_CODE_SUPPORTED)) */
|
||||||
|
|
||||||
|
/* clear all MMX flags; no support is compiled in */
|
||||||
|
png_ptr->asm_flags &= ~( PNG_MMX_FLAGS );
|
||||||
|
|
||||||
|
# endif /* ?(PNGVCRD || PNGGCCRD) */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !(PNG_ASSEMBLER_CODE_SUPPORTED) */
|
||||||
|
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
#if !defined(PNG_USE_PNGGCCRD) && \
|
||||||
|
!(defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD))
|
||||||
|
int PNGAPI
|
||||||
|
png_mmx_support(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
1999
src/png/png.h
1999
src/png/png.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,13 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.2.4 - July 8, 2002
|
||||||
* 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) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* March 15, 1998
|
|
||||||
*
|
*
|
||||||
* This file provides a location for all error handling. Users which
|
* This file provides a location for all error handling. Users who
|
||||||
* need special error handling are expected to write replacement functions
|
* need special error handling are expected to write replacement functions
|
||||||
* and use png_set_error_fn() to use those functions. See the instructions
|
* and use png_set_error_fn() to use those functions. See the instructions
|
||||||
* at each function.
|
* at each function.
|
||||||
@@ -17,25 +16,59 @@
|
|||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
static void png_default_error PNGARG((png_structp png_ptr,
|
static void /* PRIVATE */
|
||||||
png_const_charp message));
|
png_default_error PNGARG((png_structp png_ptr,
|
||||||
static void png_default_warning PNGARG((png_structp png_ptr,
|
png_const_charp error_message));
|
||||||
png_const_charp message));
|
static void /* PRIVATE */
|
||||||
|
png_default_warning PNGARG((png_structp png_ptr,
|
||||||
|
png_const_charp warning_message));
|
||||||
|
|
||||||
/* This function is called whenever there is a fatal error. This function
|
/* This function is called whenever there is a fatal error. This function
|
||||||
* should not be changed. If there is a need to handle errors differently,
|
* should not be changed. If there is a need to handle errors differently,
|
||||||
* you should supply a replacement error function and use png_set_error_fn()
|
* you should supply a replacement error function and use png_set_error_fn()
|
||||||
* to replace the error function at run-time.
|
* to replace the error function at run-time.
|
||||||
*/
|
*/
|
||||||
void
|
void PNGAPI
|
||||||
png_error(png_structp png_ptr, png_const_charp message)
|
png_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
char msg[16];
|
||||||
|
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
|
{
|
||||||
|
int offset = 0;
|
||||||
|
if (*error_message == '#')
|
||||||
|
{
|
||||||
|
for (offset=1; offset<15; offset++)
|
||||||
|
if (*(error_message+offset) == ' ')
|
||||||
|
break;
|
||||||
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; i<offset-1; i++)
|
||||||
|
msg[i]=error_message[i+1];
|
||||||
|
msg[i]='\0';
|
||||||
|
error_message=msg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
error_message+=offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
|
{
|
||||||
|
msg[0]='0';
|
||||||
|
msg[1]='\0';
|
||||||
|
error_message=msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (png_ptr->error_fn != NULL)
|
if (png_ptr->error_fn != NULL)
|
||||||
(*(png_ptr->error_fn))(png_ptr, message);
|
(*(png_ptr->error_fn))(png_ptr, error_message);
|
||||||
|
|
||||||
/* if the following returns or doesn't exist, use the default function,
|
/* if the following returns or doesn't exist, use the default function,
|
||||||
which will not return */
|
which will not return */
|
||||||
png_default_error(png_ptr, message);
|
png_default_error(png_ptr, error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called whenever there is a non-fatal error. This function
|
/* This function is called whenever there is a non-fatal error. This function
|
||||||
@@ -43,16 +76,29 @@ png_error(png_structp png_ptr, png_const_charp message)
|
|||||||
* you should supply a replacement warning function and use
|
* you should supply a replacement warning function and use
|
||||||
* png_set_error_fn() to replace the warning function at run-time.
|
* png_set_error_fn() to replace the warning function at run-time.
|
||||||
*/
|
*/
|
||||||
void
|
void PNGAPI
|
||||||
png_warning(png_structp png_ptr, png_const_charp message)
|
png_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
|
int offset = 0;
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (*warning_message == '#')
|
||||||
|
{
|
||||||
|
for (offset=1; offset<15; offset++)
|
||||||
|
if (*(warning_message+offset) == ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (png_ptr->warning_fn != NULL)
|
if (png_ptr->warning_fn != NULL)
|
||||||
(*(png_ptr->warning_fn))(png_ptr, message);
|
(*(png_ptr->warning_fn))(png_ptr,
|
||||||
|
(png_const_charp)(warning_message+offset));
|
||||||
else
|
else
|
||||||
png_default_warning(png_ptr, message);
|
png_default_warning(png_ptr, (png_const_charp)(warning_message+offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These utilities are used internally to build an error message which relates
|
/* These utilities are used internally to build an error message that relates
|
||||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||||
* this is used to prefix the message. The message is limited in length
|
* this is used to prefix the message. The message is limited in length
|
||||||
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
||||||
@@ -60,49 +106,55 @@ png_warning(png_structp png_ptr, png_const_charp message)
|
|||||||
*/
|
*/
|
||||||
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
|
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||||
static PNG_CONST char png_digit[16] = {
|
static PNG_CONST char png_digit[16] = {
|
||||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
|
||||||
};
|
'F' };
|
||||||
|
|
||||||
static void
|
static void /* PRIVATE */
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message)
|
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||||
|
error_message)
|
||||||
{
|
{
|
||||||
int iout = 0, iin = 0;
|
int iout = 0, iin = 0;
|
||||||
|
|
||||||
while (iin < 4) {
|
while (iin < 4)
|
||||||
|
{
|
||||||
int c = png_ptr->chunk_name[iin++];
|
int c = png_ptr->chunk_name[iin++];
|
||||||
if (isnonalpha(c)) {
|
if (isnonalpha(c))
|
||||||
|
{
|
||||||
buffer[iout++] = '[';
|
buffer[iout++] = '[';
|
||||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
||||||
buffer[iout++] = png_digit[c & 0xf];
|
buffer[iout++] = png_digit[c & 0x0f];
|
||||||
buffer[iout++] = ']';
|
buffer[iout++] = ']';
|
||||||
} else {
|
}
|
||||||
buffer[iout++] = c;
|
else
|
||||||
|
{
|
||||||
|
buffer[iout++] = (png_byte)c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message == NULL)
|
if (error_message == NULL)
|
||||||
buffer[iout] = 0;
|
buffer[iout] = 0;
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
buffer[iout++] = ':';
|
buffer[iout++] = ':';
|
||||||
buffer[iout++] = ' ';
|
buffer[iout++] = ' ';
|
||||||
png_memcpy(buffer+iout, message, 64);
|
png_memcpy(buffer+iout, error_message, 64);
|
||||||
buffer[iout+63] = 0;
|
buffer[iout+63] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void PNGAPI
|
||||||
png_chunk_error(png_structp png_ptr, png_const_charp message)
|
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
char msg[16+64];
|
char msg[18+64];
|
||||||
png_format_buffer(png_ptr, msg, message);
|
png_format_buffer(png_ptr, msg, error_message);
|
||||||
png_error(png_ptr, msg);
|
png_error(png_ptr, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void PNGAPI
|
||||||
png_chunk_warning(png_structp png_ptr, png_const_charp message)
|
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
char msg[16+64];
|
char msg[18+64];
|
||||||
png_format_buffer(png_ptr, msg, message);
|
png_format_buffer(png_ptr, msg, warning_message);
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,13 +163,39 @@ png_chunk_warning(png_structp png_ptr, png_const_charp message)
|
|||||||
* function is used by default, or if the program supplies NULL for the
|
* function is used by default, or if the program supplies NULL for the
|
||||||
* error function pointer in png_set_error_fn().
|
* error function pointer in png_set_error_fn().
|
||||||
*/
|
*/
|
||||||
static void
|
static void /* PRIVATE */
|
||||||
png_default_error(png_structp png_ptr, png_const_charp message)
|
png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
#ifndef PNG_NO_STDIO
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
fprintf(stderr, "libpng error: %s\n", message);
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
if (*error_message == '#')
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
char error_number[16];
|
||||||
|
for (offset=0; offset<15; offset++)
|
||||||
|
{
|
||||||
|
error_number[offset] = *(error_message+offset+1);
|
||||||
|
if (*(error_message+offset) == ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if((offset > 1) && (offset < 15))
|
||||||
|
{
|
||||||
|
error_number[offset-1]='\0';
|
||||||
|
fprintf(stderr, "libpng error no. %s: %s\n", error_number,
|
||||||
|
error_message+offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
fprintf(stderr, "libpng error: %s\n", error_message);
|
||||||
|
#else
|
||||||
|
if (error_message)
|
||||||
|
/* make compiler happy */ ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
# ifdef USE_FAR_KEYWORD
|
# ifdef USE_FAR_KEYWORD
|
||||||
{
|
{
|
||||||
jmp_buf jmpbuf;
|
jmp_buf jmpbuf;
|
||||||
@@ -127,22 +205,51 @@ png_default_error(png_structp png_ptr, png_const_charp message)
|
|||||||
# else
|
# else
|
||||||
longjmp(png_ptr->jmpbuf, 1);
|
longjmp(png_ptr->jmpbuf, 1);
|
||||||
# endif
|
# endif
|
||||||
|
#else
|
||||||
|
if (png_ptr)
|
||||||
|
/* make compiler happy */ ;
|
||||||
|
PNG_ABORT();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called when there is a warning, but the library thinks
|
/* This function is called when there is a warning, but the library thinks
|
||||||
* it can continue anyway. Replacement functions don't have to do anything
|
* it can continue anyway. Replacement functions don't have to do anything
|
||||||
* here if you don't want to. In the default configuration, png_ptr is
|
* here if you don't want them to. In the default configuration, png_ptr is
|
||||||
* not used, but it is passed in case it may be useful.
|
* not used, but it is passed in case it may be useful.
|
||||||
*/
|
*/
|
||||||
static void
|
static void /* PRIVATE */
|
||||||
png_default_warning(png_structp png_ptr, png_const_charp message)
|
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
return;
|
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
if (*warning_message == '#')
|
||||||
#ifndef PNG_NO_STDIO
|
{
|
||||||
fprintf(stderr, "libpng warning: %s\n", message);
|
int offset;
|
||||||
|
char warning_number[16];
|
||||||
|
for (offset=0; offset<15; offset++)
|
||||||
|
{
|
||||||
|
warning_number[offset]=*(warning_message+offset+1);
|
||||||
|
if (*(warning_message+offset) == ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if((offset > 1) && (offset < 15))
|
||||||
|
{
|
||||||
|
warning_number[offset-1]='\0';
|
||||||
|
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
|
||||||
|
warning_message+offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||||
|
}
|
||||||
|
else
|
||||||
# endif
|
# endif
|
||||||
|
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||||
|
#else
|
||||||
|
if (warning_message)
|
||||||
|
/* appease compiler */ ;
|
||||||
|
#endif
|
||||||
|
if (png_ptr)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
@@ -150,7 +257,7 @@ png_default_warning(png_structp png_ptr, png_const_charp message)
|
|||||||
* return to the calling routine or serious problems will occur. The return
|
* return to the calling routine or serious problems will occur. The return
|
||||||
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
||||||
*/
|
*/
|
||||||
void
|
void PNGAPI
|
||||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
||||||
png_error_ptr error_fn, png_error_ptr warning_fn)
|
png_error_ptr error_fn, png_error_ptr warning_fn)
|
||||||
{
|
{
|
||||||
@@ -164,11 +271,21 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|||||||
* functions. The application should free any memory associated with this
|
* functions. The application should free any memory associated with this
|
||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
*/
|
*/
|
||||||
png_voidp
|
png_voidp PNGAPI
|
||||||
png_get_error_ptr(png_structp png_ptr)
|
png_get_error_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
return ((png_voidp)png_ptr->error_ptr);
|
return ((png_voidp)png_ptr->error_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
void PNGAPI
|
||||||
|
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
||||||
|
{
|
||||||
|
if(png_ptr != NULL)
|
||||||
|
{
|
||||||
|
png_ptr->flags &=
|
||||||
|
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
501
src/png/pngget.c
501
src/png/pngget.c
@@ -1,18 +1,17 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.2.4 - July 8, 2002
|
||||||
* 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) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* March 15, 1998
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
|
png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -21,7 +20,7 @@ png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
|
png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -30,9 +29,20 @@ png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PNG_INFO_IMAGE_SUPPORTED)
|
||||||
|
png_bytepp PNGAPI
|
||||||
|
png_get_rows(png_structp png_ptr, png_infop info_ptr)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
|
return(info_ptr->row_pointers);
|
||||||
|
else
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
||||||
/* easy access to info, added in libpng-0.99 */
|
/* easy access to info, added in libpng-0.99 */
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_image_width(png_structp png_ptr, png_infop info_ptr)
|
png_get_image_width(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -42,7 +52,7 @@ png_get_image_width(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_image_height(png_structp png_ptr, png_infop info_ptr)
|
png_get_image_height(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -52,7 +62,7 @@ png_get_image_height(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte
|
png_byte PNGAPI
|
||||||
png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
|
png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -62,7 +72,7 @@ png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte
|
png_byte PNGAPI
|
||||||
png_get_color_type(png_structp png_ptr, png_infop info_ptr)
|
png_get_color_type(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -72,7 +82,7 @@ png_get_color_type(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte
|
png_byte PNGAPI
|
||||||
png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
|
png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -82,7 +92,7 @@ png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte
|
png_byte PNGAPI
|
||||||
png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
|
png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -92,7 +102,7 @@ png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_byte
|
png_byte PNGAPI
|
||||||
png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
|
png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -102,43 +112,48 @@ png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
|
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter");
|
png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter");
|
||||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
||||||
return (0);
|
return (0);
|
||||||
else return (info_ptr->x_pixels_per_unit);
|
else return (info_ptr->x_pixels_per_unit);
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
return (0);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
|
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
||||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
||||||
return (0);
|
return (0);
|
||||||
else return (info_ptr->y_pixels_per_unit);
|
else return (info_ptr->y_pixels_per_unit);
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
return (0);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
|
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter");
|
png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter");
|
||||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
|
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
|
||||||
@@ -146,137 +161,150 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
else return (info_ptr->x_pixels_per_unit);
|
else return (info_ptr->x_pixels_per_unit);
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
return (0);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
float PNGAPI
|
||||||
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
|
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
|
png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
|
||||||
if (info_ptr->x_pixels_per_unit == 0)
|
if (info_ptr->x_pixels_per_unit == 0)
|
||||||
return ((float)0.0);
|
return ((float)0.0);
|
||||||
else
|
else
|
||||||
return ((float)info_ptr->y_pixels_per_unit
|
return ((float)((float)info_ptr->y_pixels_per_unit
|
||||||
/(float)info_ptr->x_pixels_per_unit);
|
/(float)info_ptr->x_pixels_per_unit));
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
return (0.0);
|
||||||
#endif
|
#endif
|
||||||
return ((float)0.0);
|
return ((float)0.0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
png_uint_32
|
png_int_32 PNGAPI
|
||||||
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
#if defined(PNG_oFFs_SUPPORTED)
|
||||||
|
if (info_ptr->valid & PNG_INFO_oFFs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
||||||
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
||||||
return (0);
|
return (0);
|
||||||
else return (info_ptr->x_offset);
|
else return (info_ptr->x_offset);
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
return (0);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_int_32 PNGAPI
|
||||||
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
#if defined(PNG_oFFs_SUPPORTED)
|
||||||
|
if (info_ptr->valid & PNG_INFO_oFFs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
||||||
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
||||||
return (0);
|
return (0);
|
||||||
else return (info_ptr->y_offset);
|
else return (info_ptr->y_offset);
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
return (0);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_int_32 PNGAPI
|
||||||
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
#if defined(PNG_oFFs_SUPPORTED)
|
||||||
|
if (info_ptr->valid & PNG_INFO_oFFs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
||||||
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
||||||
return (0);
|
return (0);
|
||||||
else return (info_ptr->x_offset);
|
else return (info_ptr->x_offset);
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
return (0);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_int_32 PNGAPI
|
||||||
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
#if defined(PNG_oFFs_SUPPORTED)
|
||||||
|
if (info_ptr->valid & PNG_INFO_oFFs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
||||||
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
||||||
return (0);
|
return (0);
|
||||||
else return (info_ptr->y_offset);
|
else return (info_ptr->y_offset);
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
|
return (0);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_INCH_CONVERSIONS
|
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
|
return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
|
||||||
*.03937 +.5)
|
*.0254 +.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
|
return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
|
||||||
*.03937 +.5)
|
*.0254 +.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
|
return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
|
||||||
*.03937 +.5)
|
*.0254 +.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float PNGAPI
|
||||||
png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
|
return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
|
||||||
*.03937/1000000. +.5)
|
*.00003937);
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float PNGAPI
|
||||||
png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
|
return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
|
||||||
*.03937/1000000. +.5)
|
*.00003937);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
|
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->valid & PNG_INFO_pHYs)
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "pHYs");
|
png_debug1(1, "in %s retrieval function\n", "pHYs");
|
||||||
if (res_x != NULL)
|
if (res_x != NULL)
|
||||||
@@ -293,23 +321,23 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
|
|||||||
{
|
{
|
||||||
*unit_type = (int)info_ptr->phys_unit_type;
|
*unit_type = (int)info_ptr->phys_unit_type;
|
||||||
retval |= PNG_INFO_pHYs;
|
retval |= PNG_INFO_pHYs;
|
||||||
if(unit_type == 1)
|
if(*unit_type == 1)
|
||||||
{
|
{
|
||||||
if (res_x != NULL) *res_x = (png_uint_32)(*res_x * 39.37 + .50);
|
if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
|
||||||
if (res_y != NULL) *res_y = (png_uint_32)(*res_y * 39.37 + .50);
|
if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PNG_pHYs_SUPPORTED */
|
||||||
|
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
|
||||||
#endif /* PNG_INCH_CONVERSIONS */
|
|
||||||
|
|
||||||
/* png_get_channels really belongs in here, too, but it's been around longer */
|
/* png_get_channels really belongs in here, too, but it's been around longer */
|
||||||
|
|
||||||
#endif /* PNG_EASY_ACCESS_SUPPORTED */
|
#endif /* PNG_EASY_ACCESS_SUPPORTED */
|
||||||
|
|
||||||
png_byte
|
png_byte PNGAPI
|
||||||
png_get_channels(png_structp png_ptr, png_infop info_ptr)
|
png_get_channels(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -318,7 +346,7 @@ png_get_channels(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_bytep
|
png_bytep PNGAPI
|
||||||
png_get_signature(png_structp png_ptr, png_infop info_ptr)
|
png_get_signature(png_structp png_ptr, png_infop info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
@@ -327,8 +355,8 @@ png_get_signature(png_structp png_ptr, png_infop info_ptr)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
#if defined(PNG_bKGD_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_color_16p *background)
|
png_color_16p *background)
|
||||||
{
|
{
|
||||||
@@ -343,8 +371,9 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_cHRM_SUPPORTED)
|
#if defined(PNG_cHRM_SUPPORTED)
|
||||||
png_uint_32
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
png_uint_32 PNGAPI
|
||||||
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
|
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||||
double *white_x, double *white_y, double *red_x, double *red_y,
|
double *white_x, double *white_y, double *red_x, double *red_y,
|
||||||
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
||||||
@@ -373,9 +402,42 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
|
||||||
|
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
|
||||||
|
png_fixed_point *blue_x, png_fixed_point *blue_y)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
|
||||||
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function\n", "cHRM");
|
||||||
|
if (white_x != NULL)
|
||||||
|
*white_x = info_ptr->int_x_white;
|
||||||
|
if (white_y != NULL)
|
||||||
|
*white_y = info_ptr->int_y_white;
|
||||||
|
if (red_x != NULL)
|
||||||
|
*red_x = info_ptr->int_x_red;
|
||||||
|
if (red_y != NULL)
|
||||||
|
*red_y = info_ptr->int_y_red;
|
||||||
|
if (green_x != NULL)
|
||||||
|
*green_x = info_ptr->int_x_green;
|
||||||
|
if (green_y != NULL)
|
||||||
|
*green_y = info_ptr->int_y_green;
|
||||||
|
if (blue_x != NULL)
|
||||||
|
*blue_x = info_ptr->int_x_blue;
|
||||||
|
if (blue_y != NULL)
|
||||||
|
*blue_y = info_ptr->int_y_blue;
|
||||||
|
return (PNG_INFO_cHRM);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
#if defined(PNG_gAMA_SUPPORTED)
|
||||||
png_uint_32
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
png_uint_32 PNGAPI
|
||||||
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
||||||
@@ -388,9 +450,25 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_fixed_point *int_file_gamma)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
||||||
|
&& int_file_gamma != NULL)
|
||||||
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function\n", "gAMA");
|
||||||
|
*int_file_gamma = info_ptr->int_gamma;
|
||||||
|
return (PNG_INFO_gAMA);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
#if defined(PNG_sRGB_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
|
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
|
||||||
@@ -404,8 +482,41 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_hIST_SUPPORTED)
|
#if defined(PNG_iCCP_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
|
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_charpp name, int *compression_type,
|
||||||
|
png_charpp profile, png_uint_32 *proflen)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
|
||||||
|
&& name != NULL && profile != NULL && proflen != NULL)
|
||||||
|
{
|
||||||
|
png_debug1(1, "in %s retrieval function\n", "iCCP");
|
||||||
|
*name = info_ptr->iccp_name;
|
||||||
|
*profile = info_ptr->iccp_profile;
|
||||||
|
/* compression_type is a dummy so the API won't have to change
|
||||||
|
if we introduce multiple compression types later. */
|
||||||
|
*proflen = (int)info_ptr->iccp_proflen;
|
||||||
|
*compression_type = (int)info_ptr->iccp_compression;
|
||||||
|
return (PNG_INFO_iCCP);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_sPLT_SUPPORTED)
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_sPLT_tpp spalettes)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
||||||
|
*spalettes = info_ptr->splt_palettes;
|
||||||
|
return ((png_uint_32)info_ptr->splt_palettes_num);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_hIST_SUPPORTED)
|
||||||
|
png_uint_32 PNGAPI
|
||||||
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
|
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
|
||||||
@@ -419,7 +530,7 @@ png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_uint_32 *width, png_uint_32 *height, int *bit_depth,
|
png_uint_32 *width, png_uint_32 *height, int *bit_depth,
|
||||||
int *color_type, int *interlace_type, int *compression_type,
|
int *color_type, int *interlace_type, int *compression_type,
|
||||||
@@ -436,7 +547,11 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
*width = info_ptr->width;
|
*width = info_ptr->width;
|
||||||
*height = info_ptr->height;
|
*height = info_ptr->height;
|
||||||
*bit_depth = info_ptr->bit_depth;
|
*bit_depth = info_ptr->bit_depth;
|
||||||
|
if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
|
||||||
|
png_error(png_ptr, "Invalid bit depth");
|
||||||
*color_type = info_ptr->color_type;
|
*color_type = info_ptr->color_type;
|
||||||
|
if (info_ptr->color_type > 6)
|
||||||
|
png_error(png_ptr, "Invalid color type");
|
||||||
if (compression_type != NULL)
|
if (compression_type != NULL)
|
||||||
*compression_type = info_ptr->compression_type;
|
*compression_type = info_ptr->compression_type;
|
||||||
if (filter_type != NULL)
|
if (filter_type != NULL)
|
||||||
@@ -455,9 +570,13 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
channels++;
|
channels++;
|
||||||
pixel_depth = *bit_depth * channels;
|
pixel_depth = *bit_depth * channels;
|
||||||
rowbytes_per_pixel = (pixel_depth + 7) >> 3;
|
rowbytes_per_pixel = (pixel_depth + 7) >> 3;
|
||||||
if ((*width > (png_uint_32)2147483647L/rowbytes_per_pixel))
|
if (width == 0 || *width > PNG_MAX_UINT)
|
||||||
|
png_error(png_ptr, "Invalid image width");
|
||||||
|
if (height == 0 || *height > PNG_MAX_UINT)
|
||||||
|
png_error(png_ptr, "Invalid image height");
|
||||||
|
if (*width > PNG_MAX_UINT/rowbytes_per_pixel - 64)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_error(png_ptr,
|
||||||
"Width too large for libpng to process image data.");
|
"Width too large for libpng to process image data.");
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
@@ -465,10 +584,10 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_oFFs_SUPPORTED)
|
#if defined(PNG_oFFs_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_uint_32 *offset_x, png_uint_32 *offset_y, int *unit_type)
|
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
|
||||||
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
||||||
@@ -483,14 +602,14 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
#if defined(PNG_pCAL_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
|
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
|
||||||
png_charp *units, png_charpp *params)
|
png_charp *units, png_charpp *params)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->valid & PNG_INFO_pCAL &&
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
|
||||||
purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
||||||
nparams != NULL && units != NULL && params != NULL)
|
nparams != NULL && units != NULL && params != NULL)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "pCAL");
|
png_debug1(1, "in %s retrieval function\n", "pCAL");
|
||||||
@@ -507,14 +626,51 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
#if defined(PNG_sCAL_SUPPORTED)
|
||||||
png_uint_32
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
|
||||||
|
int *unit, double *width, double *height)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_sCAL))
|
||||||
|
{
|
||||||
|
*unit = info_ptr->scal_unit;
|
||||||
|
*width = info_ptr->scal_pixel_width;
|
||||||
|
*height = info_ptr->scal_pixel_height;
|
||||||
|
return (PNG_INFO_sCAL);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||||
|
int *unit, png_charpp width, png_charpp height)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_sCAL))
|
||||||
|
{
|
||||||
|
*unit = info_ptr->scal_unit;
|
||||||
|
*width = info_ptr->scal_s_width;
|
||||||
|
*height = info_ptr->scal_s_height;
|
||||||
|
return (PNG_INFO_sCAL);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
|
png_uint_32 PNGAPI
|
||||||
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->valid & PNG_INFO_pHYs)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_pHYs))
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "pHYs");
|
png_debug1(1, "in %s retrieval function\n", "pHYs");
|
||||||
if (res_x != NULL)
|
if (res_x != NULL)
|
||||||
@@ -537,12 +693,12 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
|
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
|
||||||
int *num_palette)
|
int *num_palette)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->valid & PNG_INFO_PLTE &&
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
|
||||||
palette != NULL)
|
&& palette != NULL)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "PLTE");
|
png_debug1(1, "in %s retrieval function\n", "PLTE");
|
||||||
*palette = info_ptr->palette;
|
*palette = info_ptr->palette;
|
||||||
@@ -553,12 +709,12 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_sBIT_SUPPORTED)
|
#if defined(PNG_sBIT_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->valid & PNG_INFO_sBIT &&
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
|
||||||
sig_bit != NULL)
|
&& sig_bit != NULL)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "sBIT");
|
png_debug1(1, "in %s retrieval function\n", "sBIT");
|
||||||
*sig_bit = &(info_ptr->sig_bit);
|
*sig_bit = &(info_ptr->sig_bit);
|
||||||
@@ -568,8 +724,8 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
|
#if defined(PNG_TEXT_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
||||||
int *num_text)
|
int *num_text)
|
||||||
{
|
{
|
||||||
@@ -584,16 +740,18 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
|||||||
*num_text = info_ptr->num_text;
|
*num_text = info_ptr->num_text;
|
||||||
return ((png_uint_32)info_ptr->num_text);
|
return ((png_uint_32)info_ptr->num_text);
|
||||||
}
|
}
|
||||||
|
if (num_text != NULL)
|
||||||
|
*num_text = 0;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_tIME_SUPPORTED)
|
#if defined(PNG_tIME_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->valid & PNG_INFO_tIME &&
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
|
||||||
mod_time != NULL)
|
&& mod_time != NULL)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "tIME");
|
png_debug1(1, "in %s retrieval function\n", "tIME");
|
||||||
*mod_time = &(info_ptr->mod_time);
|
*mod_time = &(info_ptr->mod_time);
|
||||||
@@ -603,13 +761,13 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
#if defined(PNG_tRNS_SUPPORTED)
|
||||||
png_uint_32
|
png_uint_32 PNGAPI
|
||||||
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_bytep *trans, int *num_trans, png_color_16p *trans_values)
|
png_bytep *trans, int *num_trans, png_color_16p *trans_values)
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
if (png_ptr != NULL && info_ptr != NULL && info_ptr->valid & PNG_INFO_tRNS)
|
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "tRNS");
|
png_debug1(1, "in %s retrieval function\n", "tRNS");
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
@@ -642,3 +800,128 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
|
||||||
|
png_unknown_chunkpp unknowns)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
|
||||||
|
*unknowns = info_ptr->unknown_chunks;
|
||||||
|
return ((png_uint_32)info_ptr->unknown_chunks_num);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
png_byte PNGAPI
|
||||||
|
png_get_rgb_to_gray_status (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_USER_CHUNKS_SUPPORTED)
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_get_user_chunk_ptr(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_ptr? png_ptr->user_chunk_ptr : NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_compression_buffer_size(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PNG_1_0_X
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
/* this function was added to libpng 1.2.0 and should exist by default */
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_asm_flags (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this function was added to libpng 1.2.0 and should exist by default */
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_asm_flagmask (int flag_select)
|
||||||
|
{
|
||||||
|
png_uint_32 settable_asm_flags = 0;
|
||||||
|
|
||||||
|
if (flag_select & PNG_SELECT_READ)
|
||||||
|
settable_asm_flags |=
|
||||||
|
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||||
|
/* no non-MMX flags yet */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* GRR: no write-flags yet, either, but someday... */
|
||||||
|
if (flag_select & PNG_SELECT_WRITE)
|
||||||
|
settable_asm_flags |=
|
||||||
|
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
|
return settable_asm_flags; /* _theoretically_ settable capabilities only */
|
||||||
|
}
|
||||||
|
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||||
|
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_mmx_flagmask (int flag_select, int *compilerID)
|
||||||
|
{
|
||||||
|
png_uint_32 settable_mmx_flags = 0;
|
||||||
|
|
||||||
|
if (flag_select & PNG_SELECT_READ)
|
||||||
|
settable_mmx_flags |=
|
||||||
|
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||||
|
#if 0
|
||||||
|
/* GRR: no MMX write support yet, but someday... */
|
||||||
|
if (flag_select & PNG_SELECT_WRITE)
|
||||||
|
settable_mmx_flags |=
|
||||||
|
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
|
if (compilerID != NULL) {
|
||||||
|
#ifdef PNG_USE_PNGVCRD
|
||||||
|
*compilerID = 1; /* MSVC */
|
||||||
|
#else
|
||||||
|
#ifdef PNG_USE_PNGGCCRD
|
||||||
|
*compilerID = 2; /* gcc/gas */
|
||||||
|
#else
|
||||||
|
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return settable_mmx_flags; /* _theoretically_ settable capabilities only */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
png_byte PNGAPI
|
||||||
|
png_get_mmx_bitdepth_threshold (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_mmx_rowbytes_threshold (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L);
|
||||||
|
}
|
||||||
|
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
320
src/png/pngmem.c
320
src/png/pngmem.c
@@ -1,40 +1,40 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.2.4 - July 8, 2002
|
||||||
* 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) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* March 15, 1998
|
|
||||||
*
|
*
|
||||||
* This file provides a location for all memory allocation. Users which
|
* This file provides a location for all memory allocation. Users who
|
||||||
* need special memory handling are expected to modify the code in this file
|
* need special memory handling are expected to supply replacement
|
||||||
* to meet their needs. See the instructions at each function.
|
* functions for png_malloc() and png_free(), and to use
|
||||||
|
* png_create_read_struct_2() and png_create_write_struct_2() to
|
||||||
|
* identify the replacement functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* The following "hides" PNG_MALLOC and PNG_FREE thus allowing the pngtest
|
|
||||||
application to put a wrapper on top of them. */
|
|
||||||
#ifdef PNGTEST_MEMORY_DEBUG
|
|
||||||
#define PNG_MALLOC png_debug_malloc
|
|
||||||
#define PNG_FREE png_debug_free
|
|
||||||
#else
|
|
||||||
#define PNG_MALLOC png_malloc
|
|
||||||
#define PNG_FREE png_free
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Borland DOS special memory handler */
|
/* Borland DOS special memory handler */
|
||||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||||
/* if you change this, be sure to change the one in png.h also */
|
/* if you change this, be sure to change the one in png.h also */
|
||||||
|
|
||||||
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
||||||
by a single call to calloc() if this is thought to improve performance. */
|
by a single call to calloc() if this is thought to improve performance. */
|
||||||
png_voidp
|
png_voidp /* PRIVATE */
|
||||||
png_create_struct(int type)
|
png_create_struct(int type)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
||||||
|
png_voidp /* PRIVATE */
|
||||||
|
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
||||||
|
{
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
png_voidp struct_ptr;
|
png_voidp struct_ptr;
|
||||||
|
|
||||||
@@ -43,25 +43,51 @@ png_create_struct(int type)
|
|||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = sizeof(png_struct);
|
size = sizeof(png_struct);
|
||||||
else
|
else
|
||||||
return ((png_voidp)NULL);
|
return (png_get_copyright());
|
||||||
|
|
||||||
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if(malloc_fn != NULL)
|
||||||
{
|
{
|
||||||
png_memset(struct_ptr, 0, size);
|
png_struct dummy_struct;
|
||||||
|
png_structp png_ptr = &dummy_struct;
|
||||||
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
|
struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
struct_ptr = (png_voidp)farmalloc(size));
|
||||||
|
if (struct_ptr != NULL)
|
||||||
|
png_memset(struct_ptr, 0, size);
|
||||||
return (struct_ptr);
|
return (struct_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_struct(png_voidp struct_ptr)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||||
|
png_voidp mem_ptr)
|
||||||
|
{
|
||||||
|
#endif
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if(free_fn != NULL)
|
||||||
|
{
|
||||||
|
png_struct dummy_struct;
|
||||||
|
png_structp png_ptr = &dummy_struct;
|
||||||
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
|
(*(free_fn))(png_ptr, struct_ptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
farfree (struct_ptr);
|
farfree (struct_ptr);
|
||||||
struct_ptr = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +98,7 @@ png_destroy_struct(png_voidp struct_ptr)
|
|||||||
* have the ability to do that.
|
* have the ability to do that.
|
||||||
*
|
*
|
||||||
* Borland seems to have a problem in DOS mode for exactly 64K.
|
* Borland seems to have a problem in DOS mode for exactly 64K.
|
||||||
* It gives you a segment with an offset of 8 (perhaps to store it's
|
* It gives you a segment with an offset of 8 (perhaps to store its
|
||||||
* memory stuff). zlib doesn't like this at all, so we have to
|
* memory stuff). zlib doesn't like this at all, so we have to
|
||||||
* detect and deal with it. This code should not be needed in
|
* detect and deal with it. This code should not be needed in
|
||||||
* Windows or OS/2 modes, and only in 16 bit mode. This code has
|
* Windows or OS/2 modes, and only in 16 bit mode. This code has
|
||||||
@@ -84,12 +110,32 @@ png_destroy_struct(png_voidp struct_ptr)
|
|||||||
* result, we would be truncating potentially larger memory requests
|
* result, we would be truncating potentially larger memory requests
|
||||||
* (which should cause a fatal error) and introducing major problems.
|
* (which should cause a fatal error) and introducing major problems.
|
||||||
*/
|
*/
|
||||||
png_voidp
|
|
||||||
PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
png_voidp PNGAPI
|
||||||
|
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return ((png_voidp)NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if(png_ptr->malloc_fn != NULL)
|
||||||
|
{
|
||||||
|
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
||||||
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out of memory!");
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return png_malloc_default(png_ptr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||||
|
{
|
||||||
|
png_voidp ret;
|
||||||
|
#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)
|
||||||
@@ -116,8 +162,9 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
ret = NULL;
|
ret = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(png_ptr->zlib_window_bits > 14)
|
||||||
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
|
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
|
||||||
if (num_blocks < 1)
|
else
|
||||||
num_blocks = 1;
|
num_blocks = 1;
|
||||||
if (png_ptr->zlib_mem_level >= 7)
|
if (png_ptr->zlib_mem_level >= 7)
|
||||||
num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
|
num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
|
||||||
@@ -130,12 +177,22 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
{
|
{
|
||||||
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */
|
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Out Of Memory.");
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((png_size_t)table & 0xfff0)
|
if ((png_size_t)table & 0xfff0)
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Farmalloc didn't return normalized pointer");
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr,
|
||||||
|
"Farmalloc didn't return normalized pointer");
|
||||||
|
else
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Farmalloc didn't return normalized pointer");
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->offset_table = table;
|
png_ptr->offset_table = table;
|
||||||
@@ -144,19 +201,23 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (png_ptr->offset_table_ptr == NULL)
|
if (png_ptr->offset_table_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Out Of memory.");
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Out Of memory.");
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
hptr = (png_byte huge *)table;
|
hptr = (png_byte huge *)table;
|
||||||
if ((png_size_t)hptr & 0xf)
|
if ((png_size_t)hptr & 0xf)
|
||||||
{
|
{
|
||||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
||||||
hptr += 16L;
|
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
|
||||||
}
|
}
|
||||||
for (i = 0; i < num_blocks; i++)
|
for (i = 0; i < num_blocks; i++)
|
||||||
{
|
{
|
||||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
||||||
hptr += (png_uint_32)65536L;
|
hptr = hptr + (png_uint_32)65536L; /* "+=" fails on TC++3.0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->offset_table_number = num_blocks;
|
png_ptr->offset_table_number = num_blocks;
|
||||||
@@ -166,7 +227,13 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
||||||
png_error(png_ptr, "Out of Memory.");
|
{
|
||||||
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out of Memory."); /* Note "o" and "M" */
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Out of Memory.");
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
||||||
}
|
}
|
||||||
@@ -175,21 +242,38 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free a pointer allocated by PNG_MALLOC(). In the default
|
/* free a pointer allocated by png_malloc(). In the default
|
||||||
configuration, png_ptr is not used, but is passed in case it
|
configuration, png_ptr is not used, but is passed in case it
|
||||||
is needed. If ptr is NULL, return without taking any action. */
|
is needed. If ptr is NULL, return without taking any action. */
|
||||||
void
|
void PNGAPI
|
||||||
PNG_FREE(png_structp png_ptr, png_voidp ptr)
|
png_free(png_structp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if (png_ptr->free_fn != NULL)
|
||||||
|
{
|
||||||
|
(*(png_ptr->free_fn))(png_ptr, ptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else png_free_default(png_ptr, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PNGAPI
|
||||||
|
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||||
|
{
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
if (png_ptr->offset_table != NULL)
|
if (png_ptr->offset_table != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -215,7 +299,6 @@ PNG_FREE(png_structp png_ptr, png_voidp ptr)
|
|||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
{
|
{
|
||||||
farfree(ptr);
|
farfree(ptr);
|
||||||
ptr = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,9 +307,20 @@ PNG_FREE(png_structp png_ptr, png_voidp ptr)
|
|||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
memset can be replaced by a single call to calloc() if this is thought
|
||||||
to improve performance noticably. */
|
to improve performance noticably. */
|
||||||
png_voidp
|
png_voidp /* PRIVATE */
|
||||||
png_create_struct(int type)
|
png_create_struct(int type)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||||
|
memset can be replaced by a single call to calloc() if this is thought
|
||||||
|
to improve performance noticably. */
|
||||||
|
png_voidp /* PRIVATE */
|
||||||
|
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
||||||
|
{
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
png_voidp struct_ptr;
|
png_voidp struct_ptr;
|
||||||
|
|
||||||
@@ -235,7 +329,20 @@ png_create_struct(int type)
|
|||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = sizeof(png_struct);
|
size = sizeof(png_struct);
|
||||||
else
|
else
|
||||||
return ((png_voidp)NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if(malloc_fn != NULL)
|
||||||
|
{
|
||||||
|
png_struct dummy_struct;
|
||||||
|
png_structp png_ptr = &dummy_struct;
|
||||||
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
|
struct_ptr = (*(malloc_fn))(png_ptr, size);
|
||||||
|
if (struct_ptr != NULL)
|
||||||
|
png_memset(struct_ptr, 0, size);
|
||||||
|
return (struct_ptr);
|
||||||
|
}
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
||||||
@@ -255,11 +362,31 @@ png_create_struct(int type)
|
|||||||
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_struct(png_voidp struct_ptr)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||||
|
png_voidp mem_ptr)
|
||||||
|
{
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if(free_fn != NULL)
|
||||||
|
{
|
||||||
|
png_struct dummy_struct;
|
||||||
|
png_structp png_ptr = &dummy_struct;
|
||||||
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
|
(*(free_fn))(png_ptr, struct_ptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
farfree(struct_ptr);
|
farfree(struct_ptr);
|
||||||
#else
|
#else
|
||||||
@@ -272,24 +399,46 @@ png_destroy_struct(png_voidp struct_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Allocate memory. For reasonable files, size should never exceed
|
/* Allocate memory. For reasonable files, size should never exceed
|
||||||
64K. However, zlib may allocate more then 64K if you don't tell
|
64K. However, zlib may allocate more then 64K if you don't tell
|
||||||
it not to. See zconf.h and png.h for more information. zlib does
|
it not to. See zconf.h and png.h for more information. zlib does
|
||||||
need to allocate exactly 64K, so whatever you call here must
|
need to allocate exactly 64K, so whatever you call here must
|
||||||
have the ability to do that. */
|
have the ability to do that. */
|
||||||
|
|
||||||
png_voidp
|
png_voidp PNGAPI
|
||||||
PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return ((png_voidp)NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if(png_ptr->malloc_fn != NULL)
|
||||||
|
{
|
||||||
|
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
||||||
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out of Memory!");
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return (png_malloc_default(png_ptr, size));
|
||||||
|
}
|
||||||
|
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||||
|
{
|
||||||
|
png_voidp ret;
|
||||||
|
#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)
|
||||||
|
{
|
||||||
|
if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Cannot Allocate > 64K");
|
png_error(png_ptr, "Cannot Allocate > 64K");
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
@@ -302,23 +451,36 @@ PNG_MALLOC(png_structp png_ptr, png_uint_32 size)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
{
|
|
||||||
png_error(png_ptr, "Out of Memory");
|
png_error(png_ptr, "Out of Memory");
|
||||||
}
|
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free a pointer allocated by PNG_MALLOC(). In the default
|
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
|
||||||
configuration, png_ptr is not used, but is passed in case it
|
without taking any action. */
|
||||||
is needed. If ptr is NULL, return without taking any action. */
|
void PNGAPI
|
||||||
void
|
png_free(png_structp png_ptr, png_voidp ptr)
|
||||||
PNG_FREE(png_structp png_ptr, png_voidp ptr)
|
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if (png_ptr->free_fn != NULL)
|
||||||
|
{
|
||||||
|
(*(png_ptr->free_fn))(png_ptr, ptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else png_free_default(png_ptr, ptr);
|
||||||
|
}
|
||||||
|
void PNGAPI
|
||||||
|
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||||
|
{
|
||||||
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
farfree(ptr);
|
farfree(ptr);
|
||||||
#else
|
#else
|
||||||
@@ -332,7 +494,27 @@ PNG_FREE(png_structp png_ptr, png_voidp ptr)
|
|||||||
|
|
||||||
#endif /* Not Borland DOS special memory handler */
|
#endif /* Not Borland DOS special memory handler */
|
||||||
|
|
||||||
png_voidp
|
#if defined(PNG_1_0_X)
|
||||||
|
# define png_malloc_warn png_malloc
|
||||||
|
#else
|
||||||
|
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
||||||
|
* function will issue a png_warning and return NULL instead of issuing a
|
||||||
|
* png_error, if it fails to allocate the requested memory.
|
||||||
|
*/
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_malloc_warn(png_structp png_ptr, png_uint_32 size)
|
||||||
|
{
|
||||||
|
png_voidp ptr;
|
||||||
|
png_uint_32 save_flags=png_ptr->flags;
|
||||||
|
|
||||||
|
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
||||||
|
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
|
||||||
|
png_ptr->flags=save_flags;
|
||||||
|
return(ptr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_voidp PNGAPI
|
||||||
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
||||||
png_uint_32 length)
|
png_uint_32 length)
|
||||||
{
|
{
|
||||||
@@ -345,7 +527,7 @@ png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
|||||||
return(png_memcpy (s1, s2, size));
|
return(png_memcpy (s1, s2, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp
|
png_voidp PNGAPI
|
||||||
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
||||||
png_uint_32 length)
|
png_uint_32 length)
|
||||||
{
|
{
|
||||||
@@ -358,3 +540,27 @@ png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
|||||||
return (png_memset (s1, value, size));
|
return (png_memset (s1, value, size));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
/* This function is called when the application wants to use another method
|
||||||
|
* of allocating and freeing memory.
|
||||||
|
*/
|
||||||
|
void PNGAPI
|
||||||
|
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
||||||
|
malloc_fn, png_free_ptr free_fn)
|
||||||
|
{
|
||||||
|
png_ptr->mem_ptr = mem_ptr;
|
||||||
|
png_ptr->malloc_fn = malloc_fn;
|
||||||
|
png_ptr->free_fn = free_fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function returns a pointer to the mem_ptr associated with the user
|
||||||
|
* functions. The application should free any memory associated with this
|
||||||
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
|
*/
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_get_mem_ptr(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return ((png_voidp)png_ptr->mem_ptr);
|
||||||
|
}
|
||||||
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,16 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.2.4 - July 8, 2002
|
||||||
* 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) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* March 15, 1998
|
|
||||||
*
|
*
|
||||||
* This file provides a location for all input. Users which need
|
* This file provides a location for all input. Users who need
|
||||||
* special handling are expected to write a function which has the same
|
* special handling are expected to write a function that has the same
|
||||||
* arguments as this, and perform a similar function, but possibly has
|
* arguments as this and performs a similar function, but that possibly
|
||||||
* a different input method. Note that you shouldn't change this
|
* has a different input method. Note that you shouldn't change this
|
||||||
* function, but rather write a replacement function and then make
|
* function, but rather write a replacement function and then make
|
||||||
* libpng use it at run time with png_set_read_fn(...).
|
* libpng use it at run time with png_set_read_fn(...).
|
||||||
*/
|
*/
|
||||||
@@ -24,10 +23,10 @@
|
|||||||
with very small lengths, so you should implement some kind of simple
|
with very small lengths, so you should implement some kind of simple
|
||||||
buffering if you are using unbuffered reads. This should never be asked
|
buffering if you are using unbuffered reads. This should never be asked
|
||||||
to read more then 64K on a 16 bit machine. */
|
to read more then 64K on a 16 bit machine. */
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_debug1(4,"reading %d bytes\n", length);
|
png_debug1(4,"reading %d bytes\n", (int)length);
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
||||||
else
|
else
|
||||||
@@ -35,12 +34,12 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
/* This is the function which does the actual reading of data. If you are
|
/* This is the function that does the actual reading of data. If you are
|
||||||
not reading from a standard C stream, you should create a replacement
|
not reading from a standard C stream, you should create a replacement
|
||||||
read_data function and use it at run time with png_set_read_fn(), rather
|
read_data function and use it at run time with png_set_read_fn(), rather
|
||||||
than changing the library. */
|
than changing the library. */
|
||||||
#ifndef USE_FAR_KEYWORD
|
#ifndef USE_FAR_KEYWORD
|
||||||
static void
|
void PNGAPI
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_size_t check;
|
png_size_t check;
|
||||||
@@ -48,14 +47,17 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||||
* instead of an int, which is what fread() actually returns.
|
* instead of an int, which is what fread() actually returns.
|
||||||
*/
|
*/
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
|
check = 0;
|
||||||
|
#else
|
||||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
check = (png_size_t)fread(data, (png_size_t)1, length,
|
||||||
(FILE *)png_ptr->io_ptr);
|
(png_FILE_p)png_ptr->io_ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
{
|
|
||||||
png_error(png_ptr, "Read Error");
|
png_error(png_ptr, "Read Error");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
/* this is the model-independent version. Since the standard I/O library
|
/* this is the model-independent version. Since the standard I/O library
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
can't handle far buffers in the medium and small models, we have to copy
|
||||||
@@ -65,19 +67,24 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
#define NEAR_BUF_SIZE 1024
|
#define NEAR_BUF_SIZE 1024
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
|
|
||||||
static void
|
static void /* PRIVATE */
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
int check;
|
int check;
|
||||||
png_byte *n_data;
|
png_byte *n_data;
|
||||||
FILE *io_ptr;
|
png_FILE_p io_ptr;
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
/* Check if data really is near. If so, use usual code. */
|
||||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
io_ptr = (FILE *)CVT_PTR(png_ptr->io_ptr);
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
if ((png_bytep)n_data == data)
|
if ((png_bytep)n_data == data)
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
|
check = 0;
|
||||||
|
#else
|
||||||
check = fread(n_data, 1, length, io_ptr);
|
check = fread(n_data, 1, length, io_ptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -88,7 +95,12 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
read = MIN(NEAR_BUF_SIZE, remaining);
|
read = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
|
||||||
|
err = 0;
|
||||||
|
#else
|
||||||
err = fread(buf, (png_size_t)1, read, io_ptr);
|
err = fread(buf, (png_size_t)1, read, io_ptr);
|
||||||
|
#endif
|
||||||
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
||||||
if(err != read)
|
if(err != read)
|
||||||
break;
|
break;
|
||||||
@@ -100,10 +112,8 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
while (remaining != 0);
|
while (remaining != 0);
|
||||||
}
|
}
|
||||||
if ((png_uint_32)check != (png_uint_32)length)
|
if ((png_uint_32)check != (png_uint_32)length)
|
||||||
{
|
|
||||||
png_error(png_ptr, "read Error");
|
png_error(png_ptr, "read Error");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -114,13 +124,13 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
png_ptr - pointer to a png input data structure
|
png_ptr - pointer to a png input data structure
|
||||||
io_ptr - pointer to user supplied structure containing info about
|
io_ptr - pointer to user supplied structure containing info about
|
||||||
the input functions. May be NULL.
|
the input functions. May be NULL.
|
||||||
read_data_fn - pointer to a new input function which takes as it's
|
read_data_fn - pointer to a new input function that takes as its
|
||||||
arguments a pointer to a png_struct, a pointer to
|
arguments a pointer to a png_struct, a pointer to
|
||||||
a location where input data can be stored, and a 32-bit
|
a location where input data can be stored, and a 32-bit
|
||||||
unsigned int which is the number of bytes to be read.
|
unsigned int that is the number of bytes to be read.
|
||||||
To exit and output any fatal error messages the new write
|
To exit and output any fatal error messages the new write
|
||||||
function should call png_error(png_ptr, "Error msg"). */
|
function should call png_error(png_ptr, "Error msg"). */
|
||||||
void
|
void PNGAPI
|
||||||
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||||
png_rw_ptr read_data_fn)
|
png_rw_ptr read_data_fn)
|
||||||
{
|
{
|
||||||
@@ -136,10 +146,16 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* It is an error to write to a read device */
|
/* It is an error to write to a read device */
|
||||||
|
if (png_ptr->write_data_fn != NULL)
|
||||||
|
{
|
||||||
png_ptr->write_data_fn = NULL;
|
png_ptr->write_data_fn = NULL;
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"It's an error to set both read_data_fn and write_data_fn in the ");
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"same structure. Resetting write_data_fn to NULL.");
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
png_ptr->output_flush_fn = NULL;
|
png_ptr->output_flush_fn = NULL;
|
||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1894
src/png/pngrtran.c
1894
src/png/pngrtran.c
File diff suppressed because it is too large
Load Diff
1813
src/png/pngrutil.c
1813
src/png/pngrutil.c
File diff suppressed because it is too large
Load Diff
920
src/png/pngset.c
920
src/png/pngset.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,20 +1,19 @@
|
|||||||
|
|
||||||
/* 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.1
|
* libpng 1.2.4 - July 8, 2002
|
||||||
* 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) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* March 15, 1998
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
/* turn on bgr to rgb mapping */
|
/* turn on BGR-to-RGB mapping */
|
||||||
void
|
void PNGAPI
|
||||||
png_set_bgr(png_structp png_ptr)
|
png_set_bgr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_bgr\n");
|
png_debug(1, "in png_set_bgr\n");
|
||||||
@@ -24,7 +23,7 @@ png_set_bgr(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* turn on 16 bit byte swapping */
|
/* turn on 16 bit byte swapping */
|
||||||
void
|
void PNGAPI
|
||||||
png_set_swap(png_structp png_ptr)
|
png_set_swap(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_swap\n");
|
png_debug(1, "in png_set_swap\n");
|
||||||
@@ -35,7 +34,7 @@ png_set_swap(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
/* turn on pixel packing */
|
/* turn on pixel packing */
|
||||||
void
|
void PNGAPI
|
||||||
png_set_packing(png_structp png_ptr)
|
png_set_packing(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_packing\n");
|
png_debug(1, "in png_set_packing\n");
|
||||||
@@ -49,7 +48,7 @@ png_set_packing(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||||
/* turn on packed pixel swapping */
|
/* turn on packed pixel swapping */
|
||||||
void
|
void PNGAPI
|
||||||
png_set_packswap(png_structp png_ptr)
|
png_set_packswap(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_packswap\n");
|
png_debug(1, "in png_set_packswap\n");
|
||||||
@@ -59,7 +58,7 @@ png_set_packswap(png_structp png_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||||
void
|
void PNGAPI
|
||||||
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_shift\n");
|
png_debug(1, "in png_set_shift\n");
|
||||||
@@ -70,7 +69,7 @@ png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
|||||||
|
|
||||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||||
int
|
int PNGAPI
|
||||||
png_set_interlace_handling(png_structp png_ptr)
|
png_set_interlace_handling(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_interlace handling\n");
|
png_debug(1, "in png_set_interlace handling\n");
|
||||||
@@ -87,10 +86,10 @@ png_set_interlace_handling(png_structp png_ptr)
|
|||||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||||
/* Add a filler byte on read, or remove a filler or alpha byte on write.
|
/* Add a filler byte on read, or remove a filler or alpha byte on write.
|
||||||
* The filler type has changed in v0.95 to allow future 2-byte fillers
|
* The filler type has changed in v0.95 to allow future 2-byte fillers
|
||||||
* for 48-bit input data, as well as avoiding problems with some compilers
|
* for 48-bit input data, as well as to avoid problems with some compilers
|
||||||
* which don't like bytes as parameters.
|
* that don't like bytes as parameters.
|
||||||
*/
|
*/
|
||||||
void
|
void PNGAPI
|
||||||
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_filler\n");
|
png_debug(1, "in png_set_filler\n");
|
||||||
@@ -101,17 +100,29 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
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 */
|
/* This should probably go in the "do_filler" routine.
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB && png_ptr->bit_depth == 8)
|
* 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;
|
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
|
||||||
|
|
||||||
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
|
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
||||||
void
|
void PNGAPI
|
||||||
png_set_swap_alpha(png_structp png_ptr)
|
png_set_swap_alpha(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_swap_alpha\n");
|
png_debug(1, "in png_set_swap_alpha\n");
|
||||||
@@ -121,7 +132,7 @@ png_set_swap_alpha(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
|
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
||||||
void
|
void PNGAPI
|
||||||
png_set_invert_alpha(png_structp png_ptr)
|
png_set_invert_alpha(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_invert_alpha\n");
|
png_debug(1, "in png_set_invert_alpha\n");
|
||||||
@@ -130,30 +141,62 @@ png_set_invert_alpha(png_structp png_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
||||||
void
|
void PNGAPI
|
||||||
png_set_invert_mono(png_structp png_ptr)
|
png_set_invert_mono(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_invert_mono\n");
|
png_debug(1, "in png_set_invert_mono\n");
|
||||||
png_ptr->transformations |= PNG_INVERT_MONO;
|
png_ptr->transformations |= PNG_INVERT_MONO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* invert monocrome grayscale data */
|
/* invert monochrome grayscale data */
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_invert(png_row_infop row_info, png_bytep row)
|
png_do_invert(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_invert\n");
|
png_debug(1, "in png_do_invert\n");
|
||||||
if (row_info->bit_depth == 1 &&
|
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
||||||
|
* if (row_info->bit_depth == 1 &&
|
||||||
|
*/
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
row != NULL && row_info != NULL &&
|
if (row == NULL || row_info == NULL)
|
||||||
|
return;
|
||||||
#endif
|
#endif
|
||||||
row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp = row;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->rowbytes; i++, rp++)
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
*rp = (png_byte)(~(*rp));
|
*rp = (png_byte)(~(*rp));
|
||||||
|
rp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
|
row_info->bit_depth == 8)
|
||||||
|
{
|
||||||
|
png_bytep rp = row;
|
||||||
|
png_uint_32 i;
|
||||||
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
|
|
||||||
|
for (i = 0; i < istop; i+=2)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(~(*rp));
|
||||||
|
rp+=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
|
row_info->bit_depth == 16)
|
||||||
|
{
|
||||||
|
png_bytep rp = row;
|
||||||
|
png_uint_32 i;
|
||||||
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
|
|
||||||
|
for (i = 0; i < istop; i+=4)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(~(*rp));
|
||||||
|
*(rp+1) = (png_byte)(~(*(rp+1)));
|
||||||
|
rp+=4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,7 +204,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* swaps byte order on 16 bit depth images */
|
/* swaps byte order on 16 bit depth images */
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_swap(png_row_infop row_info, png_bytep row)
|
png_do_swap(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_swap\n");
|
png_debug(1, "in png_do_swap\n");
|
||||||
@@ -171,15 +214,13 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
|||||||
#endif
|
#endif
|
||||||
row_info->bit_depth == 16)
|
row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp = row;
|
||||||
png_byte t;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 istop= row_info->width * row_info->channels;
|
||||||
|
|
||||||
for (i = 0, rp = row;
|
for (i = 0; i < istop; i++, rp += 2)
|
||||||
i < row_info->width * row_info->channels;
|
|
||||||
i++, rp += 2)
|
|
||||||
{
|
{
|
||||||
t = *rp;
|
png_byte t = *rp;
|
||||||
*rp = *(rp + 1);
|
*rp = *(rp + 1);
|
||||||
*(rp + 1) = t;
|
*(rp + 1) = t;
|
||||||
}
|
}
|
||||||
@@ -294,7 +335,7 @@ static png_byte fourbppswaptable[256] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* swaps pixel packing order within bytes */
|
/* swaps pixel packing order within bytes */
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_packswap(png_row_infop row_info, png_bytep row)
|
png_do_packswap(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_packswap\n");
|
png_debug(1, "in png_do_packswap\n");
|
||||||
@@ -326,7 +367,7 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
|
|||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||||
/* remove filler or alpha byte(s) */
|
/* remove filler or alpha byte(s) */
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_strip_filler\n");
|
png_debug(1, "in png_do_strip_filler\n");
|
||||||
@@ -338,6 +379,11 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB ||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
*/
|
*/
|
||||||
|
png_bytep sp=row;
|
||||||
|
png_bytep dp=row;
|
||||||
|
png_uint_32 row_width=row_info->width;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
if (row_info->channels == 4)
|
if (row_info->channels == 4)
|
||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
@@ -345,10 +391,8 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from RGBX or RGBA to RGB */
|
/* This converts from RGBX or RGBA to RGB */
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
dp+=3; sp+=4;
|
||||||
png_uint_32 i;
|
for (i = 1; i < row_width; i++)
|
||||||
|
|
||||||
for (i = 1, sp = row + 4, dp = row + 3; i < row_info->width; i++)
|
|
||||||
{
|
{
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@@ -359,10 +403,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from XRGB or ARGB to RGB */
|
/* This converts from XRGB or ARGB to RGB */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
for (i = 0; i < row_width; i++)
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, sp = row, dp = row; i < row_info->width; i++)
|
|
||||||
{
|
{
|
||||||
sp++;
|
sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@@ -371,23 +412,22 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
row_info->pixel_depth = 24;
|
row_info->pixel_depth = 24;
|
||||||
row_info->rowbytes = row_info->width * 3;
|
row_info->rowbytes = row_width * 3;
|
||||||
}
|
}
|
||||||
else /* if (row_info->bit_depth == 16) */
|
else /* if (row_info->bit_depth == 16) */
|
||||||
{
|
{
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
|
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
|
||||||
for (i = 1, sp = row + 8, dp = row + 6; i < row_info->width; i++)
|
sp += 8; dp += 6;
|
||||||
|
for (i = 1; i < row_width; i++)
|
||||||
{
|
{
|
||||||
/* This could be (although memcpy is probably slower):
|
/* This could be (although png_memcpy is probably slower):
|
||||||
png_memcpy(dp, sp, 6);
|
png_memcpy(dp, sp, 6);
|
||||||
sp += 8;
|
sp += 8;
|
||||||
dp += 6;
|
dp += 6;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@@ -399,17 +439,16 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
||||||
for (i = 0, sp = row + 2, dp = row; i < row_info->width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
/* This could be (although memcpy is probably slower):
|
/* This could be (although png_memcpy is probably slower):
|
||||||
png_memcpy(dp, sp, 6);
|
png_memcpy(dp, sp, 6);
|
||||||
sp += 8;
|
sp += 8;
|
||||||
dp += 6;
|
dp += 6;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
sp+=2;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@@ -419,9 +458,10 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
row_info->pixel_depth = 48;
|
row_info->pixel_depth = 48;
|
||||||
row_info->rowbytes = row_info->width * 6;
|
row_info->rowbytes = row_width * 6;
|
||||||
}
|
}
|
||||||
row_info->channels = 3;
|
row_info->channels = 3;
|
||||||
|
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY ||
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY ||
|
||||||
@@ -434,10 +474,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from GX or GA to G */
|
/* This converts from GX or GA to G */
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
for (i = 0; i < row_width; i++)
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 1, sp = row + 2, dp = row + 1; i < row_info->width; i++)
|
|
||||||
{
|
{
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
sp++;
|
sp++;
|
||||||
@@ -446,27 +483,22 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from XG or AG to G */
|
/* This converts from XG or AG to G */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
for (i = 0; i < row_width; i++)
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, sp = row, dp = row; i < row_info->width; i++)
|
|
||||||
{
|
{
|
||||||
sp++;
|
sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
row_info->pixel_depth = 8;
|
row_info->pixel_depth = 8;
|
||||||
row_info->rowbytes = row_info->width;
|
row_info->rowbytes = row_width;
|
||||||
}
|
}
|
||||||
else /* if (row_info->bit_depth == 16) */
|
else /* if (row_info->bit_depth == 16) */
|
||||||
{
|
{
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
/* This converts from GGXX or GGAA to GG */
|
/* This converts from GGXX or GGAA to GG */
|
||||||
for (i = 1, sp = row + 4, dp = row + 2; i < row_info->width; i++)
|
sp += 4; dp += 2;
|
||||||
|
for (i = 1; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@@ -475,11 +507,8 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
/* This converts from XXGG or AAGG to GG */
|
/* This converts from XXGG or AAGG to GG */
|
||||||
for (i = 0, sp = row, dp = row; i < row_info->width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
sp += 2;
|
sp += 2;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@@ -487,9 +516,10 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
row_info->pixel_depth = 16;
|
row_info->pixel_depth = 16;
|
||||||
row_info->rowbytes = row_info->width * 2;
|
row_info->rowbytes = row_width * 2;
|
||||||
}
|
}
|
||||||
row_info->channels = 1;
|
row_info->channels = 1;
|
||||||
|
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,7 +527,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
/* swaps red and blue bytes within a pixel */
|
/* swaps red and blue bytes within a pixel */
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_bgr(png_row_infop row_info, png_bytep row)
|
png_do_bgr(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_bgr\n");
|
png_debug(1, "in png_do_bgr\n");
|
||||||
@@ -507,17 +537,17 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
#endif
|
#endif
|
||||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
{
|
{
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte save;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->width; i++, rp += 3)
|
for (i = 0, rp = row; i < row_width; i++, rp += 3)
|
||||||
{
|
{
|
||||||
save = *rp;
|
png_byte save = *rp;
|
||||||
*rp = *(rp + 2);
|
*rp = *(rp + 2);
|
||||||
*(rp + 2) = save;
|
*(rp + 2) = save;
|
||||||
}
|
}
|
||||||
@@ -525,12 +555,11 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte save;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->width; i++, rp += 4)
|
for (i = 0, rp = row; i < row_width; i++, rp += 4)
|
||||||
{
|
{
|
||||||
save = *rp;
|
png_byte save = *rp;
|
||||||
*rp = *(rp + 2);
|
*rp = *(rp + 2);
|
||||||
*(rp + 2) = save;
|
*(rp + 2) = save;
|
||||||
}
|
}
|
||||||
@@ -541,33 +570,31 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte save[2];
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->width; i++, rp += 6)
|
for (i = 0, rp = row; i < row_width; i++, rp += 6)
|
||||||
{
|
{
|
||||||
save[0] = *rp;
|
png_byte save = *rp;
|
||||||
save[1] = *(rp + 1);
|
|
||||||
*rp = *(rp + 4);
|
*rp = *(rp + 4);
|
||||||
|
*(rp + 4) = save;
|
||||||
|
save = *(rp + 1);
|
||||||
*(rp + 1) = *(rp + 5);
|
*(rp + 1) = *(rp + 5);
|
||||||
*(rp + 4) = save[0];
|
*(rp + 5) = save;
|
||||||
*(rp + 5) = save[1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte save[2];
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->width; i++, rp += 8)
|
for (i = 0, rp = row; i < row_width; i++, rp += 8)
|
||||||
{
|
{
|
||||||
save[0] = *rp;
|
png_byte save = *rp;
|
||||||
save[1] = *(rp + 1);
|
|
||||||
*rp = *(rp + 4);
|
*rp = *(rp + 4);
|
||||||
|
*(rp + 4) = save;
|
||||||
|
save = *(rp + 1);
|
||||||
*(rp + 1) = *(rp + 5);
|
*(rp + 1) = *(rp + 5);
|
||||||
*(rp + 4) = save[0];
|
*(rp + 5) = save;
|
||||||
*(rp + 5) = save[1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -575,3 +602,39 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
||||||
|
|
||||||
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||||
|
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
|
||||||
|
defined(PNG_LEGACY_SUPPORTED)
|
||||||
|
void PNGAPI
|
||||||
|
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||||
|
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
||||||
|
{
|
||||||
|
png_debug(1, "in png_set_user_transform_info\n");
|
||||||
|
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||||
|
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||||
|
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||||
|
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||||
|
#else
|
||||||
|
if(user_transform_ptr || user_transform_depth || user_transform_channels)
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"This version of libpng does not support user transform info");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This function returns a pointer to the user_transform_ptr associated with
|
||||||
|
* the user transform functions. The application should free any memory
|
||||||
|
* associated with this pointer before png_write_destroy and png_read_destroy
|
||||||
|
* are called.
|
||||||
|
*/
|
||||||
|
png_voidp PNGAPI
|
||||||
|
png_get_user_transform_ptr(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||||
|
return ((png_voidp)png_ptr->user_transform_ptr);
|
||||||
|
#else
|
||||||
|
if(png_ptr)
|
||||||
|
return (NULL);
|
||||||
|
return (NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@@ -1,31 +1,31 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.2.4 - July 8, 2002
|
||||||
* 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) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* March 15, 1998
|
|
||||||
*
|
*
|
||||||
* This file provides a location for all output. Users which need
|
* This file provides a location for all output. Users who need
|
||||||
* special handling are expected to write functions which have the same
|
* special handling are expected to write functions that have the same
|
||||||
* arguments as these, and perform similar functions, but possibly use
|
* arguments as these and perform similar functions, but that possibly
|
||||||
* different output methods. Note that you shouldn't change these
|
* use different output methods. Note that you shouldn't change these
|
||||||
* functions, but rather write replacement functions and then change
|
* functions, but rather write replacement functions and then change
|
||||||
* them at run time with png_set_write_fn(...).
|
* them at run time with png_set_write_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Write the data to whatever output you are using. The default routine
|
/* Write the data to whatever output you are using. The default routine
|
||||||
writes to a file pointer. Note that this routine sometimes gets called
|
writes to a file pointer. Note that this routine sometimes gets called
|
||||||
with very small lengths, so you should implement some kind of simple
|
with very small lengths, so you should implement some kind of simple
|
||||||
buffering if you are using unbuffered writes. This should never be asked
|
buffering if you are using unbuffered writes. This should never be asked
|
||||||
to write more then 64K on a 16 bit machine. */
|
to write more than 64K on a 16 bit machine. */
|
||||||
|
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
if (png_ptr->write_data_fn != NULL )
|
if (png_ptr->write_data_fn != NULL )
|
||||||
@@ -35,22 +35,25 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
/* This is the function which does the actual writing of data. If you are
|
/* This is the function that does the actual writing of data. If you are
|
||||||
not writing to a standard C stream, you should create a replacement
|
not writing to a standard C stream, you should create a replacement
|
||||||
write_data function and use it at run time with png_set_write_fn(), rather
|
write_data function and use it at run time with png_set_write_fn(), rather
|
||||||
than changing the library. */
|
than changing the library. */
|
||||||
#ifndef USE_FAR_KEYWORD
|
#ifndef USE_FAR_KEYWORD
|
||||||
static void
|
void PNGAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
|
|
||||||
check = fwrite(data, 1, length, (FILE *)(png_ptr->io_ptr));
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||||
|
check = 0;
|
||||||
|
#else
|
||||||
|
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
||||||
|
#endif
|
||||||
if (check != length)
|
if (check != length)
|
||||||
{
|
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
/* this is the model-independent version. Since the standard I/O library
|
/* this is the model-independent version. Since the standard I/O library
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
can't handle far buffers in the medium and small models, we have to copy
|
||||||
@@ -60,19 +63,24 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
#define NEAR_BUF_SIZE 1024
|
#define NEAR_BUF_SIZE 1024
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
|
|
||||||
static void
|
void PNGAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
||||||
FILE *io_ptr;
|
png_FILE_p io_ptr;
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
/* Check if data really is near. If so, use usual code. */
|
||||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
io_ptr = (FILE *)CVT_PTR(png_ptr->io_ptr);
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
if ((png_bytep)near_data == data)
|
if ((png_bytep)near_data == data)
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
||||||
|
check = 0;
|
||||||
|
#else
|
||||||
check = fwrite(near_data, 1, length, io_ptr);
|
check = fwrite(near_data, 1, length, io_ptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -84,7 +92,12 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
{
|
{
|
||||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
written = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
png_memcpy(buf, data, written); /* copy far buffer to near buffer */
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
||||||
|
err = 0;
|
||||||
|
#else
|
||||||
err = fwrite(buf, 1, written, io_ptr);
|
err = fwrite(buf, 1, written, io_ptr);
|
||||||
|
#endif
|
||||||
if (err != written)
|
if (err != written)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
@@ -95,10 +108,8 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
while (remaining != 0);
|
while (remaining != 0);
|
||||||
}
|
}
|
||||||
if (check != length)
|
if (check != length)
|
||||||
{
|
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -107,7 +118,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
to disk). After png_flush is called, there should be no data pending
|
to disk). After png_flush is called, there should be no data pending
|
||||||
writing in any buffers. */
|
writing in any buffers. */
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_flush(png_structp png_ptr)
|
png_flush(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr->output_flush_fn != NULL)
|
if (png_ptr->output_flush_fn != NULL)
|
||||||
@@ -115,13 +126,15 @@ png_flush(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
static void
|
void PNGAPI
|
||||||
png_default_flush(png_structp png_ptr)
|
png_default_flush(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
FILE *io_ptr;
|
#if !defined(_WIN32_WCE)
|
||||||
io_ptr = (FILE *)CVT_PTR((png_ptr->io_ptr));
|
png_FILE_p io_ptr;
|
||||||
|
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||||
if (io_ptr != NULL)
|
if (io_ptr != NULL)
|
||||||
fflush(io_ptr);
|
fflush(io_ptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -133,13 +146,13 @@ png_default_flush(png_structp png_ptr)
|
|||||||
png_ptr - pointer to a png output data structure
|
png_ptr - pointer to a png output data structure
|
||||||
io_ptr - pointer to user supplied structure containing info about
|
io_ptr - pointer to user supplied structure containing info about
|
||||||
the output functions. May be NULL.
|
the output functions. May be NULL.
|
||||||
write_data_fn - pointer to a new output function which takes as its
|
write_data_fn - pointer to a new output function that takes as its
|
||||||
arguments a pointer to a png_struct, a pointer to
|
arguments a pointer to a png_struct, a pointer to
|
||||||
data to be written, and a 32-bit unsigned int which is
|
data to be written, and a 32-bit unsigned int that is
|
||||||
the number of bytes to be written. The new write
|
the number of bytes to be written. The new write
|
||||||
function should call png_error(png_ptr, "Error msg")
|
function should call png_error(png_ptr, "Error msg")
|
||||||
to exit and output any fatal error messages.
|
to exit and output any fatal error messages.
|
||||||
flush_data_fn - pointer to a new flush function which takes as its
|
flush_data_fn - pointer to a new flush function that takes as its
|
||||||
arguments a pointer to a png_struct. After a call to
|
arguments a pointer to a png_struct. After a call to
|
||||||
the flush function, there should be no data in any buffers
|
the flush function, there should be no data in any buffers
|
||||||
or pending transmission. If the output method doesn't do
|
or pending transmission. If the output method doesn't do
|
||||||
@@ -148,7 +161,7 @@ png_default_flush(png_structp png_ptr)
|
|||||||
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
||||||
time, output_flush_fn will be ignored, although it must be
|
time, output_flush_fn will be ignored, although it must be
|
||||||
supplied for compatibility. */
|
supplied for compatibility. */
|
||||||
void
|
void PNGAPI
|
||||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
||||||
{
|
{
|
||||||
@@ -175,7 +188,14 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
||||||
|
|
||||||
/* It is an error to read while writing a png file */
|
/* It is an error to read while writing a png file */
|
||||||
|
if (png_ptr->read_data_fn != NULL)
|
||||||
|
{
|
||||||
png_ptr->read_data_fn = NULL;
|
png_ptr->read_data_fn = NULL;
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Attempted to set both read_data_fn and write_data_fn in");
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"the same structure. Resetting read_data_fn to NULL.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_FAR_KEYWORD)
|
#if defined(USE_FAR_KEYWORD)
|
||||||
@@ -205,3 +225,4 @@ void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,25 +1,28 @@
|
|||||||
|
|
||||||
/* 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.1
|
* libpng 1.2.4 - July 8, 2002
|
||||||
* 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) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* March 15, 1998
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Transform the data according to the users wishes. The order of
|
/* Transform the data according to the user's wishes. The order of
|
||||||
* transformations is significant.
|
* transformations is significant.
|
||||||
*/
|
*/
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_write_transformations(png_structp png_ptr)
|
png_do_write_transformations(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_transformations\n");
|
png_debug(1, "in png_do_write_transformations\n");
|
||||||
|
|
||||||
|
if (png_ptr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||||
if(png_ptr->write_user_transform_fn != NULL)
|
if(png_ptr->write_user_transform_fn != NULL)
|
||||||
@@ -48,15 +51,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);
|
||||||
@@ -80,7 +83,7 @@ png_do_write_transformations(png_structp png_ptr)
|
|||||||
* row_info bit depth should be 8 (one pixel per byte). The channels
|
* row_info bit depth should be 8 (one pixel per byte). The channels
|
||||||
* should be 1 (this only happens on grayscale and paletted images).
|
* should be 1 (this only happens on grayscale and paletted images).
|
||||||
*/
|
*/
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_pack\n");
|
png_debug(1, "in png_do_pack\n");
|
||||||
@@ -97,12 +100,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
int mask, v;
|
int mask, v;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
sp = row;
|
sp = row;
|
||||||
dp = row;
|
dp = row;
|
||||||
mask = 0x80;
|
mask = 0x80;
|
||||||
v = 0;
|
v = 0;
|
||||||
for (i = 0; i < row_info->width; i++)
|
|
||||||
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
if (*sp != 0)
|
if (*sp != 0)
|
||||||
v |= mask;
|
v |= mask;
|
||||||
@@ -126,16 +131,17 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
int shift, v;
|
int shift, v;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
sp = row;
|
sp = row;
|
||||||
dp = row;
|
dp = row;
|
||||||
shift = 6;
|
shift = 6;
|
||||||
v = 0;
|
v = 0;
|
||||||
for (i = 0; i < row_info->width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
png_byte value;
|
png_byte value;
|
||||||
|
|
||||||
value = (png_byte)(*sp & 0x3);
|
value = (png_byte)(*sp & 0x03);
|
||||||
v |= (value << shift);
|
v |= (value << shift);
|
||||||
if (shift == 0)
|
if (shift == 0)
|
||||||
{
|
{
|
||||||
@@ -157,16 +163,17 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
int shift, v;
|
int shift, v;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
sp = row;
|
sp = row;
|
||||||
dp = row;
|
dp = row;
|
||||||
shift = 4;
|
shift = 4;
|
||||||
v = 0;
|
v = 0;
|
||||||
for (i = 0; i < row_info->width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
png_byte value;
|
png_byte value;
|
||||||
|
|
||||||
value = (png_byte)(*sp & 0xf);
|
value = (png_byte)(*sp & 0x0f);
|
||||||
v |= (value << shift);
|
v |= (value << shift);
|
||||||
|
|
||||||
if (shift == 0)
|
if (shift == 0)
|
||||||
@@ -202,7 +209,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
* would pass 3 as bit_depth, and this routine would translate the
|
* would pass 3 as bit_depth, and this routine would translate the
|
||||||
* data to 0 to 15.
|
* data to 0 to 15.
|
||||||
*/
|
*/
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_shift\n");
|
png_debug(1, "in png_do_shift\n");
|
||||||
@@ -214,9 +221,8 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
int shift_start[4], shift_dec[4];
|
int shift_start[4], shift_dec[4];
|
||||||
png_uint_32 channels;
|
int channels = 0;
|
||||||
|
|
||||||
channels = 0;
|
|
||||||
if (row_info->color_type & PNG_COLOR_MASK_COLOR)
|
if (row_info->color_type & PNG_COLOR_MASK_COLOR)
|
||||||
{
|
{
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
||||||
@@ -245,9 +251,10 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
/* with low row depths, could only be grayscale, so one channel */
|
/* with low row depths, could only be grayscale, so one channel */
|
||||||
if (row_info->bit_depth < 8)
|
if (row_info->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_bytep bp;
|
png_bytep bp = row;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_byte mask;
|
png_byte mask;
|
||||||
|
png_uint_32 row_bytes = row_info->rowbytes;
|
||||||
|
|
||||||
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
||||||
mask = 0x55;
|
mask = 0x55;
|
||||||
@@ -256,7 +263,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
else
|
else
|
||||||
mask = 0xff;
|
mask = 0xff;
|
||||||
|
|
||||||
for (bp = row, i = 0; i < row_info->rowbytes; i++, bp++)
|
for (i = 0; i < row_bytes; i++, bp++)
|
||||||
{
|
{
|
||||||
png_uint_16 v;
|
png_uint_16 v;
|
||||||
int j;
|
int j;
|
||||||
@@ -274,17 +281,16 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
}
|
}
|
||||||
else if (row_info->bit_depth == 8)
|
else if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep bp;
|
png_bytep bp = row;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 istop = channels * row_info->width;
|
||||||
|
|
||||||
for (bp = row, i = 0; i < row_info->width; i++)
|
for (i = 0; i < istop; i++, bp++)
|
||||||
{
|
{
|
||||||
png_uint_32 c;
|
|
||||||
|
|
||||||
for (c = 0; c < channels; c++, bp++)
|
|
||||||
{
|
|
||||||
png_uint_16 v;
|
png_uint_16 v;
|
||||||
int j;
|
int j;
|
||||||
|
int c = (int)(i%channels);
|
||||||
|
|
||||||
v = *bp;
|
v = *bp;
|
||||||
*bp = 0;
|
*bp = 0;
|
||||||
@@ -297,22 +303,19 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep bp;
|
png_bytep bp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 istop = channels * row_info->width;
|
||||||
|
|
||||||
for (bp = row, i = 0; i < row_info->width * row_info->channels; i++)
|
for (bp = row, i = 0; i < istop; i++)
|
||||||
{
|
|
||||||
png_uint_32 c;
|
|
||||||
|
|
||||||
for (c = 0; c < channels; c++, bp += 2)
|
|
||||||
{
|
{
|
||||||
|
int c = (int)(i%channels);
|
||||||
png_uint_16 value, v;
|
png_uint_16 value, v;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
v = ((png_uint_16)(*bp) << 8) + *(bp + 1);
|
v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1));
|
||||||
value = 0;
|
value = 0;
|
||||||
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
||||||
{
|
{
|
||||||
@@ -321,9 +324,8 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
else
|
else
|
||||||
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
|
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
|
||||||
}
|
}
|
||||||
*bp = (png_byte)(value >> 8);
|
*bp++ = (png_byte)(value >> 8);
|
||||||
*(bp + 1) = (png_byte)(value & 0xff);
|
*bp++ = (png_byte)(value & 0xff);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,7 +333,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_swap_alpha\n");
|
png_debug(1, "in png_do_write_swap_alpha\n");
|
||||||
@@ -345,12 +347,11 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_byte save;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
save = *(sp++);
|
png_byte save = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@@ -361,11 +362,12 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_byte save[2];
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
|
png_byte save[2];
|
||||||
save[0] = *(sp++);
|
save[0] = *(sp++);
|
||||||
save[1] = *(sp++);
|
save[1] = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@@ -385,12 +387,12 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_byte save;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
save = *(sp++);
|
png_byte save = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = save;
|
*(dp++) = save;
|
||||||
}
|
}
|
||||||
@@ -399,11 +401,12 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_byte save[2];
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
|
png_byte save[2];
|
||||||
save[0] = *(sp++);
|
save[0] = *(sp++);
|
||||||
save[1] = *(sp++);
|
save[1] = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@@ -418,7 +421,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
||||||
void
|
void /* PRIVATE */
|
||||||
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_invert_alpha\n");
|
png_debug(1, "in png_do_write_invert_alpha\n");
|
||||||
@@ -433,13 +436,13 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = 255 - *(sp++);
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* This inverts the alpha channel in RRGGBBAA */
|
/* This inverts the alpha channel in RRGGBBAA */
|
||||||
@@ -447,8 +450,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@@ -456,8 +460,8 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = 255 - *(sp++);
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
*(dp++) = 255 - *(sp++);
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,11 +472,12 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = 255 - *(sp++);
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* This inverts the alpha channel in GGAA */
|
/* This inverts the alpha channel in GGAA */
|
||||||
@@ -480,16 +485,79 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = 255 - *(sp++);
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
*(dp++) = 255 - *(sp++);
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
/* undoes intrapixel differencing */
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||||
|
{
|
||||||
|
png_debug(1, "in png_do_write_intrapixel\n");
|
||||||
|
if (
|
||||||
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
|
row != NULL && row_info != NULL &&
|
||||||
|
#endif
|
||||||
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
|
{
|
||||||
|
int bytes_per_pixel;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
if (row_info->bit_depth == 8)
|
||||||
|
{
|
||||||
|
png_bytep rp;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
bytes_per_pixel = 3;
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
bytes_per_pixel = 4;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
|
{
|
||||||
|
*(rp) = (png_byte)((*rp - *(rp+1))&0xff);
|
||||||
|
*(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (row_info->bit_depth == 16)
|
||||||
|
{
|
||||||
|
png_bytep rp;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
bytes_per_pixel = 6;
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
bytes_per_pixel = 8;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
|
{
|
||||||
|
png_uint_32 s0=*(rp )<<8 | *(rp+1);
|
||||||
|
png_uint_32 s1=*(rp+2)<<8 | *(rp+3);
|
||||||
|
png_uint_32 s2=*(rp+4)<<8 | *(rp+5);
|
||||||
|
png_uint_32 red=(s0-s1)&0xffff;
|
||||||
|
png_uint_32 blue=(s2-s1)&0xffff;
|
||||||
|
*(rp ) = (png_byte)((red>>8)&0xff);
|
||||||
|
*(rp+1) = (png_byte)(red&0xff);
|
||||||
|
*(rp+4) = (png_byte)((blue>>8)&0xff);
|
||||||
|
*(rp+5) = (png_byte)(blue&0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||||
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
1413
src/png/pngwutil.c
1413
src/png/pngwutil.c
File diff suppressed because it is too large
Load Diff
@@ -1,39 +1,38 @@
|
|||||||
# Makefile for libpng
|
# Makefile for libpng
|
||||||
# Borland C++ 4.5 (Note: All modules are compiled in C mode)
|
# 16-bit Borland C++ (Note: All modules are compiled in C mode)
|
||||||
# Will work with C++ 4.02 also
|
|
||||||
# To build the library, do:
|
# To build the library, do:
|
||||||
# "make -fmakefile.bor -DMODEL=m"
|
# "make -fmakefile.bor -DMODEL=c"
|
||||||
# or: "make -fmakefile.bor -DMODEL=l"
|
# or: "make -fmakefile.bor -DMODEL=l"
|
||||||
#
|
#
|
||||||
# ------------- Borland C++ 4.5 -------------
|
# ------------ Borland C++ ------------
|
||||||
|
|
||||||
### Absolutely necessary for this makefile to work
|
### Absolutely necessary for this makefile to work
|
||||||
.AUTODEPEND
|
.AUTODEPEND
|
||||||
|
|
||||||
## Useful user options
|
## Where zlib.h, zconf.h and zlib_MODEL.lib are
|
||||||
|
ZLIB_DIR=..\zlib
|
||||||
|
|
||||||
# Usually defined in builtins.mak or the environment
|
|
||||||
# Currently unused.
|
|
||||||
!ifndef BCROOT
|
|
||||||
BCROOT=N:\BC45
|
|
||||||
!endif
|
|
||||||
|
|
||||||
# Where zlib.h and zconf.h and zlib.lib are
|
## Compiler, linker and lib stuff
|
||||||
ZLIB_PATH=..\zlib
|
CC=bcc
|
||||||
|
LD=bcc
|
||||||
|
LIB=tlib
|
||||||
|
|
||||||
!ifndef MODEL
|
!ifndef MODEL
|
||||||
MODEL=l
|
MODEL=l
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
MODEL_ARG=-m$(MODEL)
|
||||||
|
|
||||||
#TARGET_CPU=3
|
#TARGET_CPU=3
|
||||||
# 2 = 286, 3 = 386, etc.
|
# 2 = 286, 3 = 386, etc.
|
||||||
!ifndef TARGET_CPU
|
!ifndef TARGET_CPU
|
||||||
TARGET_CPU=2
|
TARGET_CPU=2
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
# Use this if you don't want Borland's fancy exception handling
|
||||||
# Use this if you don't want Borland's fancy exception handling.
|
# (for Borland C++ 4.0 or later)
|
||||||
NOEHLIB=noeh$(MODEL).lib
|
#NOEHLIB=noeh$(MODEL).lib
|
||||||
|
|
||||||
!ifdef DEBUG
|
!ifdef DEBUG
|
||||||
CDEBUG=-v
|
CDEBUG=-v
|
||||||
@@ -49,59 +48,50 @@ CDEBUG=$(CDEBUG) -N
|
|||||||
LDEBUG=$(LDEBUG) -N
|
LDEBUG=$(LDEBUG) -N
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
# -X- turn on dependency generation in the object file
|
||||||
## Compiler, linker, and lib stuff
|
# -w set all warnings on
|
||||||
CC=bcc
|
|
||||||
LD=bcc
|
|
||||||
LIB=tlib
|
|
||||||
|
|
||||||
MODELARG=-m$(MODEL)
|
|
||||||
|
|
||||||
# -X- turns on dependency generation in the object file
|
|
||||||
# -w sets all warnings on
|
|
||||||
# -O2 optimize for speed
|
# -O2 optimize for speed
|
||||||
# -Z global optimization
|
# -Z global optimization
|
||||||
CFLAGS=-O2 -Z -X- -w -I$(ZLIB_PATH) -$(TARGET_CPU) $(MODELARG) $(CDEBUG)
|
CFLAGS=-O2 -Z -X- -w -I$(ZLIB_DIR) -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)
|
||||||
|
|
||||||
# -M generate map file
|
# -M generate map file
|
||||||
LDFLAGS=-M $(LDEBUG)
|
LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)
|
||||||
|
|
||||||
O=obj
|
|
||||||
|
|
||||||
## variables
|
## Variables
|
||||||
OBJS = \
|
OBJS = \
|
||||||
png.$(O) \
|
png.obj \
|
||||||
pngerror.$(O) \
|
pngerror.obj \
|
||||||
pngmem.$(O) \
|
pngget.obj \
|
||||||
pngpread.$(O) \
|
pngmem.obj \
|
||||||
pngset.$(O) \
|
pngpread.obj \
|
||||||
pngget.$(O) \
|
pngread.obj \
|
||||||
pngread.$(O) \
|
pngrio.obj \
|
||||||
pngrio.$(O) \
|
pngrtran.obj \
|
||||||
pngrtran.$(O) \
|
pngrutil.obj \
|
||||||
pngrutil.$(O) \
|
pngset.obj \
|
||||||
pngtrans.$(O) \
|
pngtrans.obj \
|
||||||
pngwrite.$(O) \
|
pngwio.obj \
|
||||||
pngwtran.$(O) \
|
pngwrite.obj \
|
||||||
pngwio.$(O) \
|
pngwtran.obj \
|
||||||
pngwutil.$(O)
|
pngwutil.obj
|
||||||
|
|
||||||
LIBOBJS = \
|
LIBOBJS = \
|
||||||
+png.$(O) \
|
+png.obj \
|
||||||
+pngerror.$(O) \
|
+pngerror.obj \
|
||||||
+pngmem.$(O) \
|
+pngget.obj \
|
||||||
+pngpread.$(O) \
|
+pngmem.obj \
|
||||||
+pngread.$(O) \
|
+pngpread.obj \
|
||||||
+pngset.$(O) \
|
+pngread.obj \
|
||||||
+pngget.$(O) \
|
+pngrio.obj \
|
||||||
+pngrio.$(O) \
|
+pngrtran.obj \
|
||||||
+pngrtran.$(O) \
|
+pngrutil.obj \
|
||||||
+pngrutil.$(O) \
|
+pngset.obj \
|
||||||
+pngtrans.$(O) \
|
+pngtrans.obj \
|
||||||
+pngwrite.$(O) \
|
+pngwio.obj \
|
||||||
+pngwtran.$(O) \
|
+pngwrite.obj \
|
||||||
+pngwio.$(O)
|
+pngwtran.obj \
|
||||||
+pngwutil.$(O)
|
+pngwutil.obj
|
||||||
|
|
||||||
LIBNAME=libpng$(MODEL).lib
|
LIBNAME=libpng$(MODEL).lib
|
||||||
|
|
||||||
@@ -113,32 +103,34 @@ LIBNAME=libpng$(MODEL).lib
|
|||||||
$(CC) $(CFLAGS) -c {$*.c }
|
$(CC) $(CFLAGS) -c {$*.c }
|
||||||
|
|
||||||
.c.exe:
|
.c.exe:
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) $*.c
|
$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
|
||||||
|
|
||||||
|
|
||||||
## Major targets
|
## Major targets
|
||||||
|
all: libpng pngtest
|
||||||
|
|
||||||
libpng: $(LIBNAME)
|
libpng: $(LIBNAME)
|
||||||
|
|
||||||
pngtest: pngtest$(MODEL).exe
|
pngtest: pngtest$(MODEL).exe
|
||||||
|
|
||||||
test:
|
test: pngtest$(MODEL).exe
|
||||||
pngtest$(MODEL)
|
pngtest$(MODEL)
|
||||||
|
|
||||||
|
|
||||||
## Minor Targets
|
## Minor Targets
|
||||||
|
|
||||||
png.obj: png.c
|
png.obj: png.c
|
||||||
pngset.obj: pngset.c
|
pngerror.obj: pngerror.c
|
||||||
pngget.obj: pngget.c
|
pngget.obj: pngget.c
|
||||||
pngread.obj: pngread.c
|
pngmem.obj: pngmem.c
|
||||||
pngpread.obj: pngpread.c
|
pngpread.obj: pngpread.c
|
||||||
|
pngread.obj: pngread.c
|
||||||
|
pngrio.obj: pngrio.c
|
||||||
pngrtran.obj: pngrtran.c
|
pngrtran.obj: pngrtran.c
|
||||||
pngrutil.obj: pngrutil.c
|
pngrutil.obj: pngrutil.c
|
||||||
pngerror.obj: pngerror.c
|
pngset.obj: pngset.c
|
||||||
pngmem.obj: pngmem.c
|
|
||||||
pngrio.obj: pngrio.c
|
|
||||||
pngwio.obj: pngwio.c
|
|
||||||
pngtrans.obj: pngtrans.c
|
pngtrans.obj: pngtrans.c
|
||||||
|
pngwio.obj: pngwio.c
|
||||||
pngwrite.obj: pngwrite.c
|
pngwrite.obj: pngwrite.c
|
||||||
pngwtran.obj: pngwtran.c
|
pngwtran.obj: pngwtran.c
|
||||||
pngwutil.obj: pngwutil.c
|
pngwutil.obj: pngwutil.c
|
||||||
@@ -155,14 +147,16 @@ pngtest$(MODEL).obj: pngtest.c
|
|||||||
$(CC) $(CFLAGS) -opngtest$(MODEL) -c pngtest.c
|
$(CC) $(CFLAGS) -opngtest$(MODEL) -c pngtest.c
|
||||||
|
|
||||||
pngtest$(MODEL).exe: pngtest$(MODEL).obj
|
pngtest$(MODEL).exe: pngtest$(MODEL).obj
|
||||||
$(CC) $(MODELARG) $(LDFLAGS) -L$(ZLIB_PATH) pngtest$(MODEL).obj $(LIBNAME) zlib$(MODEL).lib $(NOEHLIB)
|
$(LD) $(LDFLAGS) pngtest$(MODEL).obj $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
|
||||||
|
|
||||||
|
|
||||||
# Clean up anything else you want
|
# Clean up anything else you want
|
||||||
clean:
|
clean:
|
||||||
-del *.obj
|
-del *.obj
|
||||||
|
-del *.exe
|
||||||
-del *.lib
|
-del *.lib
|
||||||
-del *.lst
|
-del *.lst
|
||||||
|
-del *.map
|
||||||
|
|
||||||
|
|
||||||
# End of makefile for libpng
|
# End of makefile for libpng
|
||||||
|
@@ -1,13 +1,41 @@
|
|||||||
# makefile for libpng on DEC Alpha Unix
|
# makefile for libpng on DEC Alpha Unix
|
||||||
|
# Copyright (C) 2000-2002 Glenn Randers-Pehrson
|
||||||
# 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
|
||||||
|
INCPATH=$(prefix)/include
|
||||||
|
LIBPATH=$(prefix)/lib
|
||||||
|
MANPATH=$(prefix)/man
|
||||||
|
BINPATH=$(prefix)/bin
|
||||||
|
|
||||||
|
# override DESTDIR= on the make install command line to easily support
|
||||||
|
# installing into a temporary location. Example:
|
||||||
|
#
|
||||||
|
# make install DESTDIR=/tmp/build/libpng
|
||||||
|
#
|
||||||
|
# If you're going to install into a temporary location
|
||||||
|
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
||||||
|
# you execute make install.
|
||||||
|
DESTDIR=
|
||||||
|
|
||||||
|
DB=$(DESTDIR)$(BINPATH)
|
||||||
|
DI=$(DESTDIR)$(INCPATH)
|
||||||
|
DL=$(DESTDIR)$(LIBPATH)
|
||||||
|
DM=$(DESTDIR)$(MANPATH)
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.2.4
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
LIBNAME = libpng12
|
||||||
|
|
||||||
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,37 +43,118 @@ 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: $(LIBNAME).so libpng.a pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
libpng.pc:
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
|
||||||
|
libpng-config:
|
||||||
|
( cat scripts/libpng-config-head.in; \
|
||||||
|
echo prefix=\"$(prefix)\"; \
|
||||||
|
echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
||||||
|
echo cflags=\"-std\"; \
|
||||||
|
echo ldflags=\"-L$(LIBPATH)\"; \
|
||||||
|
echo libs=\"-lpng12 -lz -lm\"; \
|
||||||
|
cat scripts/libpng-config-body.in ) > libpng-config
|
||||||
|
chmod +x libpng-config
|
||||||
|
|
||||||
|
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
||||||
|
|
||||||
|
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
|
$(LIBNAME).so.$(PNGVER): $(OBJS)
|
||||||
|
$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB)
|
||||||
|
-soname $(LIBNAME).so.$(PNGMAJ) -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-headers: png.h pngconf.h
|
||||||
-@mkdir $(prefix)/include
|
-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
|
||||||
-@mkdir $(prefix)/lib
|
-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
|
||||||
cp png.h $(prefix)/include
|
cp png.h pngconf.h $(DI)/$(LIBNAME)
|
||||||
cp pngconf.h $(prefix)/include
|
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
|
||||||
chmod 644 $(prefix)/include/png.h
|
-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
-@/bin/rm -f $(DI)/libpng
|
||||||
cp libpng.a $(prefix)/lib
|
(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
|
||||||
chmod 644 $(prefix)/lib/libpng.a
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
|
-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
|
||||||
|
cp libpng.a $(DL)/$(LIBNAME).a
|
||||||
|
chmod 644 $(DL)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(DL)/libpng.a
|
||||||
|
(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
|
||||||
|
-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
|
||||||
|
-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
|
||||||
|
-@/bin/rm -f $(DL)/libpng.so
|
||||||
|
-@/bin/rm -f $(DL)/libpng.so.3
|
||||||
|
-@/bin/rm -f $(DL)/libpng.so.3.*
|
||||||
|
cp $(LIBNAME).so.$(PNGVER) $(DL)
|
||||||
|
chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
|
||||||
|
(cd $(DL); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
||||||
|
-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
|
||||||
|
-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
|
||||||
|
-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
|
||||||
|
cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
|
||||||
|
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
|
||||||
|
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
|
||||||
|
|
||||||
|
install-man: libpng.3 libpngpf.3 png.5
|
||||||
|
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
|
||||||
|
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
|
||||||
|
-@/bin/rm -f $(DM)/man3/libpng.3
|
||||||
|
-@/bin/rm -f $(DM)/man3/libpngpf.3
|
||||||
|
cp libpng.3 $(DM)/man3
|
||||||
|
cp libpngpf.3 $(DM)/man3
|
||||||
|
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
|
||||||
|
-@/bin/rm -f $(DM)/man5/png.5
|
||||||
|
cp png.5 $(DM)/man5
|
||||||
|
|
||||||
|
install-config: libpng-config
|
||||||
|
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
|
||||||
|
-@/bin/rm -f $(DB)/libpng-config
|
||||||
|
-@/bin/rm -f $(DB)/$(LIBNAME)-config
|
||||||
|
cp libpng-config $(DB)/$(LIBNAME)-config
|
||||||
|
chmod 755 $(DB)/$(LIBNAME)-config
|
||||||
|
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
|
||||||
|
|
||||||
|
install: install-static install-shared install-man install-config
|
||||||
|
|
||||||
|
# If you installed in $(DESTDIR), test-installed won't work until you
|
||||||
|
# move the library to its final location.
|
||||||
|
|
||||||
|
test-installed:
|
||||||
|
echo
|
||||||
|
echo Testing installed dynamic shared library.
|
||||||
|
$(CC) -std -w1 -I$(ZLIBINC) \
|
||||||
|
`$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
|
||||||
|
-L$(ZLIBLIB) -R$(ZLIBLIB) \
|
||||||
|
-o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
|
||||||
|
./pngtesti pngtest.png
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a pngtest pngout.png
|
/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
|
||||||
|
libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)*
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
|
@@ -1,17 +1,20 @@
|
|||||||
# DJGPP (DOS gcc) makefile for libpng
|
# DJGPP (DOS gcc) makefile for libpng
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||||
# 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 will put libpng.a and png.h
|
||||||
|
#prefix=/usr/local
|
||||||
|
prefix=.
|
||||||
|
INCPATH=$(prefix)/include
|
||||||
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
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
|
||||||
|
@@ -1,7 +1,28 @@
|
|||||||
# makefile for libpng
|
# makefile for libpng
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||||
# 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
|
||||||
|
|
||||||
|
# This makefile requires the file ansi2knr.c, which you can get
|
||||||
|
# from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/
|
||||||
|
# If you have libjpeg, you probably already have ansi2knr.c in the jpeg
|
||||||
|
# source distribution.
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
INCPATH=$(prefix)/include
|
||||||
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
|
# override DESTDIR= on the make install command line to easily support
|
||||||
|
# installing into a temporary location. Example:
|
||||||
|
#
|
||||||
|
# make install DESTDIR=/tmp/build/libpng
|
||||||
|
#
|
||||||
|
# If you're going to install into a temporary location
|
||||||
|
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
||||||
|
# you execute make install.
|
||||||
|
DESTDIR=
|
||||||
|
|
||||||
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 +32,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
|
||||||
@@ -41,18 +59,26 @@ test: pngtest
|
|||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install: libpng.a
|
install: libpng.a
|
||||||
-@mkdir $(prefix)/include
|
-@mkdir $(DESTDIR)$(INCPATH)
|
||||||
-@mkdir $(prefix)/lib
|
-@mkdir $(DESTDIR)$(INCPATH)/libpng
|
||||||
cp png.h $(prefix)/include
|
-@mkdir $(DESTDIR)$(LIBPATH)
|
||||||
cp pngconf.h $(prefix)/include
|
-@rm -f $(DESTDIR)$(INCPATH)/png.h
|
||||||
chmod 644 $(prefix)/include/png.h
|
-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
cp png.h $(DESTDIR)$(INCPATH)/libpng
|
||||||
cp libpng.a $(prefix)/lib
|
cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
|
||||||
chmod 644 $(prefix)/lib/libpng.a
|
chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
|
||||||
|
chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
|
||||||
|
(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
|
||||||
|
cp libpng.a $(DESTDIR)$(LIBPATH)
|
||||||
|
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a pngtest pngout.png ansi2knr
|
rm -f *.o libpng.a pngtest pngout.png ansi2knr
|
||||||
|
|
||||||
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
|
writelock:
|
||||||
|
chmod a-w *.[ch35] $(DOCS) scripts/*
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
png.o: png.h pngconf.h
|
png.o: png.h pngconf.h
|
||||||
|
@@ -3,9 +3,9 @@
|
|||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
|
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
|
||||||
|
|
||||||
# ------------- Microsoft C 5.1 and later -------------
|
# -------- Microsoft C 5.1 and later, does not use assembler code --------
|
||||||
MODEL=-AL
|
MODEL=L
|
||||||
CFLAGS=-Oait -Gs -nologo -W3 $(MODEL) -I..\zlib
|
CFLAGS=-Oait -Gs -nologo -W3 -A$(MODEL) -I..\zlib
|
||||||
#-Ox generates bad code with MSC 5.1
|
#-Ox generates bad code with MSC 5.1
|
||||||
CC=cl
|
CC=cl
|
||||||
LD=link
|
LD=link
|
||||||
|
@@ -1,8 +1,21 @@
|
|||||||
# makefile for libpng
|
# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
|
||||||
|
# Copyright (C) 2001-2002 Glenn Randers-Pehrson
|
||||||
# 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
|
||||||
|
|
||||||
|
LIBNAME=libpng12
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.2.4
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
|
# Where make install puts libpng.a, libpng12.so, and libpng12/png.h
|
||||||
|
# Prefix must be a full pathname.
|
||||||
|
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
|
#ZLIBLIB=/usr/local/lib32
|
||||||
|
#ZLIBINC=/usr/local/include
|
||||||
#ZLIBLIB=/usr/local/lib
|
#ZLIBLIB=/usr/local/lib
|
||||||
#ZLIBINC=/usr/local/include
|
#ZLIBINC=/usr/local/include
|
||||||
ZLIBLIB=../zlib
|
ZLIBLIB=../zlib
|
||||||
@@ -10,43 +23,164 @@ ZLIBINC=../zlib
|
|||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
|
|
||||||
CFLAGS=-I$(ZLIBINC) -O -fullwarn # -g -DPNG_DEBUG=1
|
# ABI can be blank to use default for your system, -32, -o32, -n32, or -64
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
# See "man abi". zlib must be built with the same ABI.
|
||||||
|
ABI=
|
||||||
|
|
||||||
|
WARNMORE=-fullwarn
|
||||||
|
# Note: -KPIC is the default anyhow
|
||||||
|
#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5
|
||||||
|
CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
|
||||||
|
LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm
|
||||||
|
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
# See "man dso" for info about shared objects
|
||||||
|
|
||||||
RANLIB=echo
|
RANLIB=echo
|
||||||
#RANLIB=ranlib
|
#RANLIB=ranlib
|
||||||
|
|
||||||
# where make install puts libpng.a and png.h
|
INCPATH=$(prefix)/include
|
||||||
prefix=/usr/local
|
LIBPATH=$(prefix)/lib
|
||||||
|
#LIBPATH=$(prefix)/lib32
|
||||||
|
MANPATH=$(prefix)/man
|
||||||
|
BINPATH=$(prefix)/bin
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
# override DESTDIR= on the make install command line to easily support
|
||||||
|
# installing into a temporary location. Example:
|
||||||
|
#
|
||||||
|
# make install DESTDIR=/tmp/build/libpng
|
||||||
|
#
|
||||||
|
# If you're going to install into a temporary location
|
||||||
|
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
||||||
|
# you execute make install.
|
||||||
|
DESTDIR=
|
||||||
|
|
||||||
|
DB=$(DESTDIR)$(BINPATH)
|
||||||
|
DI=$(DESTDIR)$(INCPATH)
|
||||||
|
DL=$(DESTDIR)$(LIBPATH)
|
||||||
|
DM=$(DESTDIR)$(MANPATH)
|
||||||
|
|
||||||
|
OBJS = pnggccrd.o 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.a pngtest shared libpng.pc libpng-config
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
shared: $(LIBNAME).so.$(PNGVER)
|
||||||
|
|
||||||
|
libpng.pc:
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
|
||||||
|
libpng-config:
|
||||||
|
( cat scripts/libpng-config-head.in; \
|
||||||
|
echo prefix=\"$(prefix)\"; \
|
||||||
|
echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
|
||||||
|
-DPNG_NO_ASSEMBLER_CODE\"; \
|
||||||
|
echo cflags=\"$(ABI)\"; \
|
||||||
|
echo ldflags=\"-L$(LIBPATH) -rpath $(LIBPATH) \"; \
|
||||||
|
echo libs=\"-lpng12 -lz -lm\"; \
|
||||||
|
cat scripts/libpng-config-body.in ) > libpng-config
|
||||||
|
chmod +x libpng-config
|
||||||
|
|
||||||
|
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
||||||
|
|
||||||
|
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
|
$(LIBNAME).so.$(PNGVER): $(OBJS)
|
||||||
|
$(LDSHARED) -o $@ $(OBJS)
|
||||||
|
rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
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
|
||||||
|
echo
|
||||||
|
echo Testing local static library.
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install: libpng.a
|
install-headers: png.h pngconf.h
|
||||||
-@mkdir $(prefix)/include
|
-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
|
||||||
-@mkdir $(prefix)/lib
|
-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
|
||||||
cp png.h $(prefix)/include
|
cp png.h pngconf.h $(DI)/$(LIBNAME)
|
||||||
cp pngconf.h $(prefix)/include
|
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
|
||||||
chmod 644 $(prefix)/include/png.h
|
-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
-@/bin/rm -f $(DI)/libpng
|
||||||
cp libpng.a $(prefix)/lib
|
(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
|
||||||
chmod 644 $(prefix)/lib/libpng.a
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
|
-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
|
||||||
|
cp libpng.a $(DL)/$(LIBNAME).a
|
||||||
|
chmod 644 $(DL)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(DL)/libpng.a
|
||||||
|
(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
|
||||||
|
-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
|
||||||
|
-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
|
||||||
|
-@/bin/rm -f $(DL)/libpng.so
|
||||||
|
-@/bin/rm -f $(DL)/libpng.so.3
|
||||||
|
-@/bin/rm -f $(DL)/libpng.so.3.*
|
||||||
|
cp $(LIBNAME).so.$(PNGVER) $(DL)
|
||||||
|
chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
|
||||||
|
(cd $(DL); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
||||||
|
-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
|
||||||
|
-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
|
||||||
|
-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
|
||||||
|
cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
|
||||||
|
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
|
||||||
|
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
|
||||||
|
|
||||||
|
install-man: libpng.3 libpngpf.3 png.5
|
||||||
|
-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
|
||||||
|
-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
|
||||||
|
-@/bin/rm -f $(DM)/man3/libpng.3
|
||||||
|
-@/bin/rm -f $(DM)/man3/libpngpf.3
|
||||||
|
cp libpng.3 $(DM)/man3
|
||||||
|
cp libpngpf.3 $(DM)/man3
|
||||||
|
-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
|
||||||
|
-@/bin/rm -f $(DM)/man5/png.5
|
||||||
|
cp png.5 $(DM)/man5
|
||||||
|
|
||||||
|
install-config: libpng-config
|
||||||
|
-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
|
||||||
|
-@/bin/rm -f $(DB)/libpng-config
|
||||||
|
-@/bin/rm -f $(DB)/$(LIBNAME)-config
|
||||||
|
cp libpng-config $(DB)/$(LIBNAME)-config
|
||||||
|
chmod 755 $(DB)/$(LIBNAME)-config
|
||||||
|
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
|
||||||
|
|
||||||
|
install: install-static install-shared install-man install-config
|
||||||
|
|
||||||
|
# If you installed in $(DESTDIR), test-installed won't work until you
|
||||||
|
# move the library to its final location.
|
||||||
|
|
||||||
|
test-installed:
|
||||||
|
echo
|
||||||
|
echo Testing installed dynamic shared library.
|
||||||
|
$(CC) -I$(ZLIBINC) \
|
||||||
|
`$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
|
||||||
|
-L$(ZLIBLIB) -rpath $(ZLIBLIB) \
|
||||||
|
-o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
|
||||||
|
./pngtesti pngtest.png
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a pngtest pngout.png
|
rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
|
||||||
|
$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* so_locations
|
||||||
|
|
||||||
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
|
writelock:
|
||||||
|
chmod a-w *.[ch35] $(DOCS) scripts/*
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
@@ -66,4 +200,5 @@ pngwrite.o: png.h pngconf.h
|
|||||||
pngwtran.o: png.h pngconf.h
|
pngwtran.o: png.h pngconf.h
|
||||||
pngwutil.o: png.h pngconf.h
|
pngwutil.o: png.h pngconf.h
|
||||||
pngpread.o: png.h pngconf.h
|
pngpread.o: png.h pngconf.h
|
||||||
|
pnggccrd.o: png.h pngconf.h
|
||||||
|
|
||||||
|
@@ -1,7 +1,23 @@
|
|||||||
# makefile for libpng
|
# makefile for libpng
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||||
# 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
|
||||||
|
INCPATH=$(prefix)/include
|
||||||
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
|
# override DESTDIR= on the make install command line to easily support
|
||||||
|
# installing into a temporary location. Example:
|
||||||
|
#
|
||||||
|
# make install DESTDIR=/tmp/build/libpng
|
||||||
|
#
|
||||||
|
# If you're going to install into a temporary location
|
||||||
|
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
||||||
|
# you execute make install.
|
||||||
|
DESTDIR=
|
||||||
|
|
||||||
# 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
|
||||||
@@ -9,15 +25,12 @@ ZLIBLIB=../zlib
|
|||||||
ZLIBINC=../zlib
|
ZLIBINC=../zlib
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
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
|
||||||
@@ -35,18 +48,26 @@ test: pngtest
|
|||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install: libpng.a
|
install: libpng.a
|
||||||
-@mkdir $(prefix)/include
|
-@mkdir $(DESTDIR)$(INCPATH)
|
||||||
-@mkdir $(prefix)/lib
|
-@mkdir $(DESTDIR)$(INCPATH)/libpng
|
||||||
cp png.h $(prefix)/include
|
-@mkdir $(DESTDIR)$(LIBPATH)
|
||||||
cp pngconf.h $(prefix)/include
|
-@rm -f $(DESTDIR)$(INCPATH)/png.h
|
||||||
chmod 644 $(prefix)/include/png.h
|
-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
cp png.h $(DESTDIR)$(INCPATH)/libpng
|
||||||
cp libpng.a $(prefix)/lib
|
cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
|
||||||
chmod 644 $(prefix)/lib/libpng.a
|
chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
|
||||||
|
chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
|
||||||
|
(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
|
||||||
|
cp libpng.a $(DESTDIR)$(LIBPATH)
|
||||||
|
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a pngtest pngout.png
|
rm -f *.o libpng.a pngtest pngout.png
|
||||||
|
|
||||||
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
|
writelock:
|
||||||
|
chmod a-w *.[ch35] $(DOCS) scripts/*
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
png.o: png.h pngconf.h
|
png.o: png.h pngconf.h
|
||||||
|
@@ -1,15 +1,17 @@
|
|||||||
# Makefile for libpng
|
# Makefile for libpng
|
||||||
# TurboC++ 3.0 (Note: All modules are compiled in C mode)
|
# TurboC/C++ (Note: All modules are compiled in C mode)
|
||||||
|
|
||||||
# To use, do "make -fmakefile.tc3"
|
# To use, do "make -fmakefile.tc3"
|
||||||
|
|
||||||
# ------------- Turbo C++ 3.0 -------------
|
# ----- Turbo C 3.00 (can be modified to work with earlier versions) -----
|
||||||
MODEL=-ml
|
|
||||||
CFLAGS=-O2 -Z $(MODEL) -I..\zlib
|
MODEL=l
|
||||||
|
CFLAGS=-O2 -Z -m$(MODEL) -I..\zlib
|
||||||
|
#CFLAGS=-D_NO_PROTO -O2 -Z -m$(MODEL) -I..\zlib # Turbo C older than 3.00
|
||||||
CC=tcc
|
CC=tcc
|
||||||
LD=tcc
|
LD=tcc
|
||||||
LIB=tlib
|
LIB=tlib
|
||||||
LDFLAGS=$(MODEL) -L..\zlib
|
LDFLAGS=-m$(MODEL) -L..\zlib
|
||||||
O=.obj
|
O=.obj
|
||||||
E=.exe
|
E=.exe
|
||||||
|
|
||||||
@@ -21,7 +23,12 @@ OBJSL1 = +png$(O) +pngset$(O) +pngget$(O) +pngrutil$(O) +pngtrans$(O)
|
|||||||
OBJSL2 = +pngwutil$(O) +pngmem$(O) +pngpread$(O) +pngread$(O) +pngerror$(O)
|
OBJSL2 = +pngwutil$(O) +pngmem$(O) +pngpread$(O) +pngread$(O) +pngerror$(O)
|
||||||
OBJSL3 = +pngwrite$(O) +pngrtran$(O) +pngwtran$(O) +pngrio$(O) +pngwio$(O)
|
OBJSL3 = +pngwrite$(O) +pngrtran$(O) +pngwtran$(O) +pngrio$(O) +pngwio$(O)
|
||||||
|
|
||||||
all: libpng.lib pngtest.exe
|
all: libpng$(MODEL).lib pngtest$(E)
|
||||||
|
|
||||||
|
pngtest: pngtest$(E)
|
||||||
|
|
||||||
|
test: pngtest$(E)
|
||||||
|
pngtest$(E)
|
||||||
|
|
||||||
png$(O): png.h pngconf.h
|
png$(O): png.h pngconf.h
|
||||||
$(CC) -c $(CFLAGS) $*.c
|
$(CC) -c $(CFLAGS) $*.c
|
||||||
@@ -71,12 +78,12 @@ pngwtran$(O): png.h pngconf.h
|
|||||||
pngwutil$(O): png.h pngconf.h
|
pngwutil$(O): png.h pngconf.h
|
||||||
$(CC) -c $(CFLAGS) $*.c
|
$(CC) -c $(CFLAGS) $*.c
|
||||||
|
|
||||||
libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
|
libpng$(MODEL).lib: $(OBJS1) $(OBJS2) $(OBJS3)
|
||||||
$(LIB) libpng +$(OBJSL1)
|
$(LIB) libpng$(MODEL) +$(OBJSL1)
|
||||||
$(LIB) libpng +$(OBJSL2)
|
$(LIB) libpng$(MODEL) +$(OBJSL2)
|
||||||
$(LIB) libpng +$(OBJSL3)
|
$(LIB) libpng$(MODEL) +$(OBJSL3)
|
||||||
|
|
||||||
pngtest$(E): pngtest$(O) libpng.lib
|
pngtest$(E): pngtest$(O) libpng$(MODEL).lib
|
||||||
$(CC) $(LDFLAGS) pngtest.obj libpng.lib zlib.lib
|
$(LD) $(LDFLAGS) pngtest.obj libpng$(MODEL).lib zlib_$(MODEL).lib
|
||||||
|
|
||||||
# End of makefile for libpng
|
# End of makefile for libpng
|
||||||
|
@@ -1,6 +1,25 @@
|
|||||||
$! make libpng under VMS
|
$! make libpng under VMS
|
||||||
$!
|
$!
|
||||||
$!
|
$!
|
||||||
|
$! Check for MMK/MMS
|
||||||
|
$!
|
||||||
|
$! This procedure accepts one parameter (contrib), which causes it to build
|
||||||
|
$! the programs from the contrib directory instead of libpng.
|
||||||
|
$!
|
||||||
|
$ p1 = f$edit(p1,"UPCASE")
|
||||||
|
$ if p1 .eqs. "CONTRIB"
|
||||||
|
$ then
|
||||||
|
$ set def [.contrib.gregbook]
|
||||||
|
$ @makevms
|
||||||
|
$ set def [-.pngminus]
|
||||||
|
$ @makevms
|
||||||
|
$ set def [--]
|
||||||
|
$ exit
|
||||||
|
$ endif
|
||||||
|
$ Make = ""
|
||||||
|
$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
|
||||||
|
$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
|
||||||
|
$!
|
||||||
$! Look for the compiler used
|
$! Look for the compiler used
|
||||||
$!
|
$!
|
||||||
$ zlibsrc = "[-.zlib]"
|
$ zlibsrc = "[-.zlib]"
|
||||||
@@ -28,10 +47,10 @@ $ comp = "__decc__=1"
|
|||||||
$ endif
|
$ endif
|
||||||
$ endif
|
$ endif
|
||||||
$!
|
$!
|
||||||
$! Build the thing plain or with mms
|
$! Build the thing plain or with mms/mmk
|
||||||
$!
|
$!
|
||||||
$ write sys$output "Compiling Libpng sources ..."
|
$ write sys$output "Compiling Libpng sources ..."
|
||||||
$ if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
|
$ if make.eqs.""
|
||||||
$ then
|
$ then
|
||||||
$ dele pngtest.obj;*
|
$ dele pngtest.obj;*
|
||||||
$ CALL MAKE png.OBJ "cc ''CCOPT' png" -
|
$ CALL MAKE png.OBJ "cc ''CCOPT' png" -
|
||||||
@@ -72,12 +91,13 @@ $ write sys$output "Building pngtest..."
|
|||||||
$ CALL MAKE pngtest.OBJ "cc ''CCOPT' pngtest" -
|
$ CALL MAKE pngtest.OBJ "cc ''CCOPT' pngtest" -
|
||||||
pngtest.c png.h pngconf.h
|
pngtest.c png.h pngconf.h
|
||||||
$ call make pngtest.exe -
|
$ call make pngtest.exe -
|
||||||
"LINK pngtest,libpng.olb/lib,''zlibsrc'libgz.olb/lib" -
|
"LINK pngtest,libpng.olb/lib,''zlibsrc'libz.olb/lib" -
|
||||||
pngtest.obj libpng.olb
|
pngtest.obj libpng.olb
|
||||||
$ write sys$output "Testing Libpng..."
|
$ write sys$output "Testing Libpng..."
|
||||||
$ run pngtest
|
$ run pngtest
|
||||||
$ else
|
$ else
|
||||||
$ mms/macro=('comp',zlibsrc='zlibsrc')
|
$ if f$search("DESCRIP.MMS") .eqs. "" then copy/nolog [.SCRIPTS]DESCRIP.MMS []
|
||||||
|
$ 'make'/macro=('comp',zlibsrc='zlibsrc')
|
||||||
$ endif
|
$ endif
|
||||||
$ write sys$output "Libpng build completed"
|
$ write sys$output "Libpng build completed"
|
||||||
$ exit
|
$ exit
|
||||||
@@ -122,4 +142,3 @@ $ VV='F$Verify(VV)
|
|||||||
$Exit:
|
$Exit:
|
||||||
$ If V Then Set Verify
|
$ If V Then Set Verify
|
||||||
$ENDSUBROUTINE
|
$ENDSUBROUTINE
|
||||||
|
|
||||||
|
@@ -1,262 +1,212 @@
|
|||||||
;----------------------------------------
|
;----------------------------------------
|
||||||
; PNGLIB module definition file for OS/2
|
; PNG.LIB module definition file for OS/2
|
||||||
;----------------------------------------
|
;----------------------------------------
|
||||||
|
|
||||||
|
; Version 1.2.4
|
||||||
|
|
||||||
LIBRARY PNG
|
LIBRARY PNG
|
||||||
DESCRIPTION "PNG image compression library for OS/2"
|
DESCRIPTION "PNG image compression library for OS/2"
|
||||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||||
DATA PRELOAD MOVEABLE MULTIPLE
|
DATA PRELOAD MOVEABLE MULTIPLE
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
png_set_sig_bytes
|
|
||||||
png_sig_cmp
|
|
||||||
|
png_build_grayscale_palette
|
||||||
png_check_sig
|
png_check_sig
|
||||||
png_create_read_struct
|
png_chunk_error
|
||||||
png_create_write_struct
|
png_chunk_warning
|
||||||
png_write_chunk
|
|
||||||
png_write_chunk_start
|
|
||||||
png_write_chunk_data
|
|
||||||
png_write_chunk_end
|
|
||||||
png_create_info_struct
|
|
||||||
png_info_init
|
|
||||||
png_write_info
|
|
||||||
png_read_info
|
|
||||||
png_convert_to_rfc1123
|
|
||||||
png_convert_from_struct_tm
|
png_convert_from_struct_tm
|
||||||
png_convert_from_time_t
|
png_convert_from_time_t
|
||||||
png_set_expand
|
png_create_info_struct
|
||||||
png_set_bgr
|
png_create_read_struct
|
||||||
png_set_gray_to_rgb
|
png_create_write_struct
|
||||||
; png_set_rgb_to_gray
|
png_data_freer
|
||||||
png_build_grayscale_palette
|
|
||||||
png_set_strip_alpha
|
|
||||||
png_set_swap_alpha
|
|
||||||
png_set_invert_alpha
|
|
||||||
png_set_filler
|
|
||||||
png_set_swap
|
|
||||||
png_set_packing
|
|
||||||
png_set_packswap
|
|
||||||
png_set_shift
|
|
||||||
png_set_interlace_handling
|
|
||||||
png_set_invert_mono
|
|
||||||
png_set_background
|
|
||||||
png_set_strip_16
|
|
||||||
png_set_dither
|
|
||||||
png_set_gamma
|
|
||||||
png_set_flush
|
|
||||||
png_write_flush
|
|
||||||
png_start_read_image
|
|
||||||
png_read_update_info
|
|
||||||
png_read_rows
|
|
||||||
png_read_row
|
|
||||||
png_read_image
|
|
||||||
png_write_row
|
|
||||||
png_write_rows
|
|
||||||
png_write_image
|
|
||||||
png_write_end
|
|
||||||
png_read_end
|
|
||||||
png_destroy_info_struct
|
png_destroy_info_struct
|
||||||
png_destroy_read_struct
|
png_destroy_read_struct
|
||||||
png_read_destroy
|
|
||||||
png_destroy_write_struct
|
png_destroy_write_struct
|
||||||
; png_write_destroy_info
|
png_error
|
||||||
png_write_destroy
|
|
||||||
png_set_crc_action
|
|
||||||
png_set_filter
|
|
||||||
png_set_filter_heuristics
|
|
||||||
png_set_compression_level
|
|
||||||
png_set_compression_mem_level
|
|
||||||
png_set_compression_strategy
|
|
||||||
png_set_compression_window_bits
|
|
||||||
png_set_compression_method
|
|
||||||
png_init_io
|
|
||||||
png_set_error_fn
|
|
||||||
png_get_error_ptr
|
|
||||||
png_set_write_fn
|
|
||||||
png_set_read_fn
|
|
||||||
png_set_write_status_fn
|
|
||||||
png_set_read_status_fn
|
|
||||||
png_get_io_ptr
|
|
||||||
png_set_progressive_read_fn
|
|
||||||
png_set_read_status_fn
|
|
||||||
png_set_read_user_transform_fn
|
|
||||||
png_set_write_status_fn
|
|
||||||
png_set_write_user_transform_fn
|
|
||||||
png_get_progressive_ptr
|
|
||||||
png_process_data
|
|
||||||
png_progressive_combine_row
|
|
||||||
png_malloc
|
|
||||||
png_free
|
png_free
|
||||||
|
png_free_data
|
||||||
|
png_get_IHDR
|
||||||
|
png_get_PLTE
|
||||||
|
png_get_bKGD
|
||||||
|
png_get_bit_depth
|
||||||
|
png_get_cHRM
|
||||||
|
png_get_cHRM_fixed
|
||||||
|
png_get_channels
|
||||||
|
png_get_color_type
|
||||||
|
png_get_compression_buffer_size
|
||||||
|
png_get_compression_type
|
||||||
|
png_get_copyright
|
||||||
|
png_get_error_ptr
|
||||||
|
png_get_filter_type
|
||||||
|
png_get_gAMA
|
||||||
|
png_get_gAMA_fixed
|
||||||
|
png_get_hIST
|
||||||
|
png_get_header_ver
|
||||||
|
png_get_header_version
|
||||||
|
png_get_iCCP
|
||||||
|
png_get_image_height
|
||||||
|
png_get_image_width
|
||||||
|
png_get_interlace_type
|
||||||
|
png_get_io_ptr
|
||||||
|
png_get_libpng_ver
|
||||||
|
png_get_oFFs
|
||||||
|
png_get_pCAL
|
||||||
|
png_get_pHYs
|
||||||
|
png_get_pixel_aspect_ratio
|
||||||
|
png_get_pixels_per_meter
|
||||||
|
png_get_progressive_ptr
|
||||||
|
png_get_rgb_to_gray_status
|
||||||
|
png_get_rowbytes
|
||||||
|
png_get_rows
|
||||||
|
png_get_sBIT
|
||||||
|
png_get_sCAL
|
||||||
|
png_get_sPLT
|
||||||
|
png_get_sRGB
|
||||||
|
png_get_signature
|
||||||
|
png_get_tIME
|
||||||
|
png_get_tRNS
|
||||||
|
png_get_text
|
||||||
|
png_get_unknown_chunks
|
||||||
|
png_get_user_chunk_ptr
|
||||||
|
png_get_user_transform_ptr
|
||||||
|
png_get_valid
|
||||||
|
png_get_x_offset_microns
|
||||||
|
png_get_x_offset_pixels
|
||||||
|
png_get_x_pixels_per_meter
|
||||||
|
png_get_y_offset_microns
|
||||||
|
png_get_y_offset_pixels
|
||||||
|
png_get_y_pixels_per_meter
|
||||||
|
png_malloc
|
||||||
png_memcpy_check
|
png_memcpy_check
|
||||||
png_memset_check
|
png_memset_check
|
||||||
; png_debug_malloc
|
png_permit_empty_plte
|
||||||
; png_debug_free
|
png_process_data
|
||||||
; png_far_to_near
|
png_progressive_combine_row
|
||||||
png_error
|
png_read_end
|
||||||
png_chunk_error
|
png_read_image
|
||||||
png_warning
|
png_read_info
|
||||||
png_chunk_warning
|
png_read_init ; deprecated
|
||||||
png_get_valid
|
png_read_png
|
||||||
png_get_rowbytes
|
png_read_row
|
||||||
png_get_channels
|
png_read_rows
|
||||||
png_get_image_width
|
png_read_update_info
|
||||||
png_get_image_height
|
png_reset_zstream
|
||||||
png_get_bit_depth
|
|
||||||
png_get_color_type
|
|
||||||
png_get_filter_type
|
|
||||||
png_get_interlace_type
|
|
||||||
png_get_compression_type
|
|
||||||
png_get_pixels_per_meter
|
|
||||||
png_get_pixel_aspect_ratio
|
|
||||||
png_get_x_offset_pixels
|
|
||||||
png_get_y_offset_pixels
|
|
||||||
png_get_x_offset_microns
|
|
||||||
png_get_y_offset_microns
|
|
||||||
png_get_signature
|
|
||||||
png_get_bKGD
|
|
||||||
png_set_bKGD
|
|
||||||
png_get_cHRM
|
|
||||||
png_set_cHRM
|
|
||||||
png_get_gAMA
|
|
||||||
png_set_gAMA
|
|
||||||
png_get_hIST
|
|
||||||
png_set_hIST
|
|
||||||
png_get_IHDR
|
|
||||||
png_set_IHDR
|
png_set_IHDR
|
||||||
png_get_oFFs
|
|
||||||
png_set_oFFs
|
|
||||||
png_get_pCAL
|
|
||||||
png_set_pCAL
|
|
||||||
png_get_pHYs
|
|
||||||
png_set_pHYs
|
|
||||||
png_get_PLTE
|
|
||||||
png_set_PLTE
|
png_set_PLTE
|
||||||
png_get_sBIT
|
png_set_bKGD
|
||||||
|
png_set_background
|
||||||
|
png_set_bgr
|
||||||
|
png_set_cHRM
|
||||||
|
png_set_cHRM_fixed
|
||||||
|
png_set_compression_buffer_size
|
||||||
|
png_set_compression_level
|
||||||
|
png_set_compression_mem_level
|
||||||
|
png_set_compression_method
|
||||||
|
png_set_compression_strategy
|
||||||
|
png_set_compression_window_bits
|
||||||
|
png_set_crc_action
|
||||||
|
png_set_dither
|
||||||
|
png_set_error_fn
|
||||||
|
png_set_expand
|
||||||
|
png_set_filler
|
||||||
|
png_set_filter
|
||||||
|
png_set_filter_heuristics
|
||||||
|
png_set_flush
|
||||||
|
png_set_gAMA
|
||||||
|
png_set_gAMA_fixed
|
||||||
|
png_set_gamma
|
||||||
|
png_set_gray_1_2_4_to_8
|
||||||
|
png_set_gray_to_rgb
|
||||||
|
png_set_hIST
|
||||||
|
png_set_iCCP
|
||||||
|
png_set_interlace_handling
|
||||||
|
png_set_invert_alpha
|
||||||
|
png_set_invert_mono
|
||||||
|
png_set_keep_unknown_chunks
|
||||||
|
png_set_oFFs
|
||||||
|
png_set_pCAL
|
||||||
|
png_set_pHYs
|
||||||
|
png_set_packing
|
||||||
|
png_set_packswap
|
||||||
|
png_set_palette_to_rgb
|
||||||
|
png_set_progressive_read_fn
|
||||||
|
png_set_read_fn
|
||||||
|
png_set_read_status_fn
|
||||||
|
png_set_read_user_chunk_fn
|
||||||
|
png_set_read_user_transform_fn
|
||||||
|
png_set_rgb_to_gray
|
||||||
|
png_set_rgb_to_gray_fixed
|
||||||
|
png_set_rows
|
||||||
png_set_sBIT
|
png_set_sBIT
|
||||||
png_get_sRGB
|
png_set_sCAL
|
||||||
|
png_set_sPLT
|
||||||
png_set_sRGB
|
png_set_sRGB
|
||||||
png_set_sRGB_gAMA_and_cHRM
|
png_set_sRGB_gAMA_and_cHRM
|
||||||
png_get_text
|
png_set_shift
|
||||||
png_set_text
|
png_set_sig_bytes
|
||||||
png_get_tIME
|
png_set_strip_16
|
||||||
|
png_set_strip_alpha
|
||||||
|
png_set_swap
|
||||||
|
png_set_swap_alpha
|
||||||
png_set_tIME
|
png_set_tIME
|
||||||
png_get_tRNS
|
|
||||||
png_set_tRNS
|
png_set_tRNS
|
||||||
|
png_set_tRNS_to_alpha
|
||||||
|
png_set_text
|
||||||
|
png_set_unknown_chunk_location
|
||||||
|
png_set_unknown_chunks
|
||||||
|
png_set_user_transform_info
|
||||||
|
png_set_write_fn
|
||||||
|
png_set_write_status_fn
|
||||||
|
png_set_write_user_transform_fn
|
||||||
|
png_sig_cmp
|
||||||
|
png_start_read_image
|
||||||
|
png_warning
|
||||||
|
png_write_chunk
|
||||||
|
png_write_chunk_data
|
||||||
|
png_write_chunk_end
|
||||||
|
png_write_chunk_start
|
||||||
|
png_write_end
|
||||||
|
png_write_flush
|
||||||
|
png_write_image
|
||||||
|
png_write_info
|
||||||
|
png_write_info_before_PLTE
|
||||||
|
png_write_init ; deprecated
|
||||||
|
png_write_png
|
||||||
|
png_write_row
|
||||||
|
png_write_rows
|
||||||
|
png_read_init_2
|
||||||
|
png_write_init_2
|
||||||
|
png_access_version_number
|
||||||
|
png_init_io
|
||||||
|
png_convert_to_rfc1123
|
||||||
|
png_set_invalid
|
||||||
|
|
||||||
png_create_struct
|
; Added at version 1.2.0:
|
||||||
png_destroy_struct
|
png_mmx_support
|
||||||
png_info_destroy
|
png_permit_empty_plte
|
||||||
png_zalloc
|
png_permit_mng_features
|
||||||
png_zfree
|
png_get_mmx_flagmask
|
||||||
png_reset_crc
|
png_get_asm_flagmask
|
||||||
png_write_data
|
png_get_asm_flags
|
||||||
png_read_data
|
png_get_mmx_bitdepth_threshold
|
||||||
png_crc_read
|
png_get_mmx_rowbytes_threshold
|
||||||
png_crc_finish
|
png_set_asm_flags
|
||||||
png_crc_error
|
png_init_mmx_flags
|
||||||
png_calculate_crc
|
|
||||||
png_flush
|
|
||||||
png_save_uint_32
|
|
||||||
png_save_int_32
|
|
||||||
png_save_uint_16
|
|
||||||
png_write_sig
|
|
||||||
png_write_IHDR
|
|
||||||
png_write_PLTE
|
|
||||||
png_write_IDAT
|
|
||||||
png_write_IEND
|
|
||||||
png_write_gAMA
|
|
||||||
png_write_sBIT
|
|
||||||
png_write_cHRM
|
|
||||||
png_write_sRGB
|
|
||||||
png_write_tRNS
|
|
||||||
png_write_bKGD
|
|
||||||
png_write_hIST
|
|
||||||
png_check_keyword
|
|
||||||
png_write_tEXt
|
|
||||||
png_write_zTXt
|
|
||||||
png_write_oFFs
|
|
||||||
png_write_pCAL
|
|
||||||
png_write_pHYs
|
|
||||||
png_write_tIME
|
|
||||||
png_write_finish_row
|
|
||||||
png_write_start_row
|
|
||||||
png_build_gamma_table
|
|
||||||
png_combine_row
|
|
||||||
png_do_read_interlace
|
|
||||||
png_do_write_interlace
|
|
||||||
png_read_filter_row
|
|
||||||
png_write_find_filter
|
|
||||||
png_write_filtered_row
|
|
||||||
png_read_finish_row
|
|
||||||
png_read_start_row
|
|
||||||
png_read_transform_info
|
|
||||||
png_do_read_filler
|
|
||||||
png_do_read_swap_alpha
|
|
||||||
png_do_write_swap_alpha
|
|
||||||
png_do_read_invert_alpha
|
|
||||||
png_do_write_invert_alpha
|
|
||||||
png_do_strip_filler
|
|
||||||
png_do_swap
|
|
||||||
png_do_packswap
|
|
||||||
; png_do_rgb_to_gray
|
|
||||||
png_do_gray_to_rgb
|
|
||||||
png_do_unpack
|
|
||||||
png_do_unshift
|
|
||||||
png_do_invert
|
|
||||||
png_do_chop
|
|
||||||
png_do_dither
|
|
||||||
; png_correct_palette
|
|
||||||
png_do_bgr
|
|
||||||
png_do_pack
|
|
||||||
png_do_shift
|
|
||||||
png_do_background
|
|
||||||
png_do_gamma
|
|
||||||
png_do_expand_palette
|
|
||||||
png_do_expand
|
|
||||||
png_handle_IHDR
|
|
||||||
png_handle_PLTE
|
|
||||||
png_handle_IEND
|
|
||||||
png_handle_gAMA
|
|
||||||
png_handle_sBIT
|
|
||||||
png_handle_cHRM
|
|
||||||
png_handle_sRGB
|
|
||||||
png_handle_tRNS
|
|
||||||
png_handle_bKGD
|
|
||||||
png_handle_hIST
|
|
||||||
png_handle_oFFs
|
|
||||||
png_handle_pCAL
|
|
||||||
png_handle_pHYs
|
|
||||||
png_handle_tIME
|
|
||||||
png_handle_tEXt
|
|
||||||
png_handle_zTXt
|
|
||||||
png_handle_unknown
|
|
||||||
png_check_chunk_name
|
|
||||||
png_do_read_transformations
|
|
||||||
png_do_write_transformations
|
|
||||||
png_init_read_transformations
|
|
||||||
png_push_read_chunk
|
|
||||||
png_push_read_sig
|
|
||||||
; png_push_check_crc
|
|
||||||
png_push_crc_skip
|
|
||||||
png_push_crc_finish
|
|
||||||
png_push_fill_buffer
|
|
||||||
png_push_save_buffer
|
|
||||||
png_push_restore_buffer
|
|
||||||
png_push_read_IDAT
|
|
||||||
png_process_IDAT_data
|
|
||||||
png_push_process_row
|
|
||||||
png_push_handle_unknown
|
|
||||||
png_push_have_info
|
|
||||||
png_push_have_end
|
|
||||||
png_push_have_row
|
|
||||||
; png_push_read_end
|
|
||||||
png_process_some_data
|
|
||||||
png_read_push_finish_row
|
|
||||||
png_push_handle_tEXt
|
|
||||||
png_push_read_tEXt
|
|
||||||
png_push_handle_zTXt
|
|
||||||
png_push_read_zTXt
|
|
||||||
|
|
||||||
|
; Added at version 1.2.2:
|
||||||
|
png_handle_as_unknown
|
||||||
|
|
||||||
|
; Added at version 1.2.2 and deleted from 1.2.3:
|
||||||
|
; png_zalloc
|
||||||
|
; png_zfree
|
||||||
|
|
||||||
|
; Added at version 1.2.4
|
||||||
|
png_malloc_warn
|
||||||
|
|
||||||
|
; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
|
||||||
png_libpng_ver
|
png_libpng_ver
|
||||||
png_pass_start
|
png_pass_start
|
||||||
png_pass_inc
|
png_pass_inc
|
||||||
@@ -267,6 +217,7 @@ EXPORTS
|
|||||||
; png_pass_width
|
; png_pass_width
|
||||||
; png_pass_height
|
; png_pass_height
|
||||||
|
|
||||||
|
; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
|
||||||
png_IHDR
|
png_IHDR
|
||||||
png_IDAT
|
png_IDAT
|
||||||
png_IEND
|
png_IEND
|
||||||
@@ -275,10 +226,14 @@ EXPORTS
|
|||||||
png_cHRM
|
png_cHRM
|
||||||
png_gAMA
|
png_gAMA
|
||||||
png_hIST
|
png_hIST
|
||||||
|
png_iCCP
|
||||||
|
png_iTXt
|
||||||
png_oFFs
|
png_oFFs
|
||||||
png_pCAL
|
png_pCAL
|
||||||
png_pHYs
|
png_pHYs
|
||||||
png_sBIT
|
png_sBIT
|
||||||
|
png_sCAL
|
||||||
|
png_sPLT
|
||||||
png_sRGB
|
png_sRGB
|
||||||
png_tEXt
|
png_tEXt
|
||||||
png_tIME
|
png_tIME
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
# Amiga powerUP (TM) Makefile
|
# Amiga powerUP (TM) Makefile
|
||||||
# makefile for libpng and SAS C V6.58/7.00 PPC compiler
|
# makefile for libpng and SAS C V6.58/7.00 PPC compiler
|
||||||
# Copyright (C) 1998 by Andreas R. Kleinert
|
# Copyright (C) 1998 by Andreas R. Kleinert
|
||||||
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
CC = scppc
|
CC = scppc
|
||||||
CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL IDIR /zlib \
|
CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL IDIR /zlib \
|
||||||
|
Reference in New Issue
Block a user