Imported from libpng-1.0.1d.tar

This commit is contained in:
Glenn Randers-Pehrson 1998-05-21 09:27:50 -05:00
parent d0dce40075
commit 8686fff347
35 changed files with 1252 additions and 182 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.0.1c May 9, 1998
Libpng 1.0.1d May 21, 1998
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@ -32,7 +32,7 @@ version 1.0.1b [May 2, 1998]
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 9, 1998]
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.
@ -42,6 +42,19 @@ version 1.0.1c [May 9, 1998]
for consistency, in pngconf.h
Added individual "ifndef PNG_NO_CAPABILITY" for the capabilities in pngconf.h
to make it easier to remove unwanted capabilities via the compile line
Made some corrections to grammar (which, it's) in documentation (Greg).
Corrected example.c, use of row_pointers in png_write_image().
version 1.0.1d [May 21, 1998]
Corrected several statements that some compilers interpret as illegal use
of side effects 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.
Send comments/corrections/commendations to
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu

15
CHANGES
View File

@ -312,7 +312,7 @@ version 1.0.1b [May 2, 1998]
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 9, 1998]
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.
@ -322,3 +322,16 @@ version 1.0.1c [May 9, 1998]
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 21, 1998]
Corrected several statements that some compilers interpret as illegal use
of side effects 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.

View File

@ -10,8 +10,8 @@ zlib.h and zconf.h include files that correspond to the
version of zlib that's installed.
You can rename the directories that you downloaded (they
might be called "libpng-%VER% or "lpng100" and "zlib-1.1.1"
or "zlib111") so that you have directories called "zlib" and "libpng".
might be called "libpng-%VER% or "lpng100" and "zlib-1.1.2"
or "zlib112") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@ -61,6 +61,8 @@ include
pngos2.def => OS/2 module definition file used by makefile.os2
makefile.wat => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script
pngdll.mak => To make a png32bd.dll with Borland C++ 4.5
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
Copy the file (or files) that you need from the
scripts directory into this directory, for example

View File

@ -42,7 +42,9 @@ Known bugs and suggested enhancements in libpng-1.0.1
Question whether i-- or --i is better.
STATUS: Under investigation.
STATUS: Under investigation. About 150 loops turned around
in libpng-1.0.1d, for testing. Object files and executables
are about 20k smaller in SGI and gcc-compiled codes.
b. Remove products and structure members from loop tests -- Glenn R-P
@ -156,3 +158,29 @@ Known bugs and suggested enhancements in libpng-1.0.1
STATUS: Fixed in libpng-1.0.1c
17. May 10, 1998 -- DOCUMENTATION -- Greg
There are a number of incorrect usages of "which" and "it's" in the
comments.
STATUS:
Fixed in libpng-1.0.1c
18. May 20, 1998 -- BUG -- illegal use of side effects -- Magnus Holmgren
In libpng-1.0.1b several illegal uses of side effects were
introduced while tuning loops in pngrutil.c; also one in pngtrans.c.
STATUS:
Fixed in libpng-1.0.1d
19. May 20, 1998 -- ENHANCEMENT -- script for making DLL -- Bob Dellaca
Bob Dellaca contributed script for making PNG DLL on Borland C++ 4.5
STATUS:
Added to distribution in libpng-1.0.1d

2
README
View File

@ -178,6 +178,8 @@ Files in this distribution:
makefile.wat => Watcom 10a+ Makefile, 32-bit flat memory model
pngos2.def => OS/2 module definition file used by makefile.os2
makevms.com => VMS build script
pngdll.mak => To make a png32bd.dll with Borland C++ 4.5
pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
Good luck, and happy coding.

View File

@ -316,18 +316,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 */
for (y = 0; y < height; y++)
{
png_bytep row_pointers = row[y];
png_read_rows(png_ptr, &row_pointers, NULL, 1);
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
}
#else no_single /* Read the image several rows at a time */
for (y = 0; y < height; y += number_of_rows)
{
#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], NULL, number_of_rows);
png_read_rows(png_ptr, NULL, row_pointers[y], number_of_rows);
#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, NULL, &row_pointers[y], number_of_rows);
#endif no_sparkle /* use only one of these two methods */
}
@ -581,7 +581,7 @@ void write_png(char *file_name /* , ... other image information ... */)
text_ptr[2].key = "Description";
text_ptr[2].text = "<long text>";
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
png_set_text(png_ptr, info_ptr, text_ptr, 2);
png_set_text(png_ptr, info_ptr, text_ptr, 3);
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
/* note that if sRGB is present the cHRM chunk must be ignored
@ -638,7 +638,11 @@ void write_png(char *file_name /* , ... other image information ... */)
* layout, however, so choose what fits your needs best). You need to
* 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];
png_bytep row_pointers[height];
for (k = 0; k < height; k++)
row_pointers[k] = image + k*width;
/* One of the following output methods is REQUIRED */
#ifdef entire /* write out the entire image data in one call */
@ -653,13 +657,12 @@ void write_png(char *file_name /* , ... other image information ... */)
for (pass = 0; pass < number_passes; pass++)
{
/* 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 */
for (y = 0; y < height; y++)
{
png_bytep row_pointers = row[y];
png_write_rows(png_ptr, &row_pointers, 1);
png_write_rows(png_ptr, &row_pointers[y], 1);
}
}
#endif no_entire /* use only one output method */

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "May 9, 1998"
.TH LIBPNG 3 "May 21, 1998"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library
.SH SYNOPSIS
@ -396,7 +396,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.1c May 9, 1998
libpng version 1.0.1d May 21, 1998
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson
@ -2374,7 +2374,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.1c May 9, 1998:
Libpng version 1.0.1d May 21, 1998:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.1c May 9, 1998
libpng version 1.0.1d May 21, 1998
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson

View File

@ -1,4 +1,4 @@
.TH LIBPNGPF 3 "May 9, 1998"
.TH LIBPNGPF 3 "May 21, 1998"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library
(private functions)

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "May 9, 1998"
.TH PNG 5 "May 21, 1998"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

6
png.c
View File

@ -1,12 +1,12 @@
/* png.c - location for general purpose libpng functions
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*/
#define PNG_INTERNAL
@ -16,7 +16,7 @@
/* Version information for C files. This had better match the version
* string defined in png.h.
*/
char png_libpng_ver[12] = "1.0.1c";
char png_libpng_ver[12] = "1.0.1d";
/* Place to hold the signature string for a PNG file. */
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};

34
png.h
View File

@ -1,12 +1,12 @@
/* png.h - header file for PNG reference library
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998 Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* Note about libpng version numbers:
*
@ -120,7 +120,7 @@ extern "C" {
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.1c"
#define PNG_LIBPNG_VER_STRING "1.0.1d"
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
@ -233,7 +233,7 @@ typedef png_time FAR * FAR * png_timepp;
* With libpng < 0.95, it was only possible to directly set and read the
* the values in the png_info_struct, which meant that the contents and
* order of the values had to remain fixed. With libpng 0.95 and later,
* however, * there are now functions which abstract the contents of
* however, there are now functions that abstract the contents of
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
@ -291,14 +291,14 @@ typedef struct png_info_struct
/* The tEXt and zTXt chunks contain human-readable textual data in
* uncompressed and compressed forms, respectively. The data in "text"
* is an array of pointers to uncompressed, null-terminated C strings.
* Each chunk has a keyword which describes the textual data contained
* Each chunk has a keyword that describes the textual data contained
* in that chunk. Keywords are not required to be unique, and the text
* string may be empty. Any number of text chunks may be in an image.
*/
int num_text; /* number of comments read/to write */
int max_text; /* current size of text array */
png_textp text; /* array of comments read/to write */
#endif /* PNG_READ_tEXt/zTXt_SUPPORTED || PNG_WRITE_tEXt/zTXt_SUPPORTED */
#endif /* PNG_READ_OR_WRITE_tEXt_OR_zTXt_SUPPORTED */
#if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
@ -321,7 +321,7 @@ typedef struct png_info_struct
* same order as the palette colors, starting from index 0. Values
* for the data are in the range [0, 255], ranging from fully transparent
* to fully opaque, respectively. For non-paletted images, there is a
* single color specified which should be treated as fully transparent.
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
png_bytep trans; /* transparent values for paletted image */
@ -493,10 +493,11 @@ typedef struct png_row_info_struct
typedef png_row_info FAR * png_row_infop;
typedef png_row_info FAR * FAR * png_row_infopp;
/* These are the function types for the I/O functions, and the functions which
* modify the default I/O functions to user I/O functions. The png_error_ptr
* type should match that of user supplied warning and error functions, while
* the png_rw_ptr type should match that of the user read/write data functions.
/* These are the function types for the I/O functions and for the functions
* that allow the user to override the default I/O functions with his or her
* own. The png_error_ptr type should match that of user-supplied warning
* and error functions, while the png_rw_ptr type should match that of the
* user read/write data functions.
*/
typedef struct png_struct_def png_struct;
typedef png_struct FAR * png_structp;
@ -1140,7 +1141,7 @@ extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
/* function which combines rows. Not very much different than the
/* function that combines rows. Not very much different than the
* png_combine_row() call. Is this even used?????
*/
extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
@ -1392,8 +1393,7 @@ extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED)
extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif /* PNG_READ_tEXt_SUPPORTED || PNG_WRITE_tEXt_SUPPORTED ||
PNG_READ_zTXt_SUPPORTED || PNG_WRITE_zTXt_SUPPORTED */
#endif /* PNG_READ_OR_WRITE_tEXt_OR_zTXt_SUPPORTED */
#if defined(PNG_READ_tIME_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
@ -1446,9 +1446,9 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
#endif /* (PNG_DEBUG > 0) */
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines, we avoid an integer divide, which will be slower on
* many machines. However, it does take more operations than the corresponding
* divide method, so it may be slower on some RISC systems. There are two
/* With these routines we avoid an integer divide, which will be slower on
* most machines. However, it does take more operations than the corresponding
* divide method, so it may be slower on a few RISC systems. There are two
* shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
*
* Note that the rounding factors are NOT supposed to be the same! 128 and

View File

@ -1,12 +1,12 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*/
/* Any machine specific code is near the front of this file, so if you
@ -47,7 +47,7 @@
#define PNG_MAX_MALLOC_64K
#endif
/* This protects us against compilers which run on a windowing system
/* This protects us against compilers that run on a windowing system
* and thus don't have or would rather us not use the stdio types:
* stdin, stdout, and stderr. The only one currently used is stderr
* in png_error() and png_warning(). #defining PNG_NO_STDIO will
@ -309,7 +309,9 @@ __dont__ include it again
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#endif
/* the following aren't implemented yet
#ifndef PNG_NO_READ_RGB_TO_GRAY
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
#endif
*/
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
@ -428,88 +430,88 @@ __dont__ include it again
#endif
#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#ifndef PNG_NO_PNG_READ_bKGD
#ifndef PNG_NO_READ_bKGD
#define PNG_READ_bKGD_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_cHRM
#ifndef PNG_NO_READ_cHRM
#define PNG_READ_cHRM_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_gAMA
#ifndef PNG_NO_READ_gAMA
#define PNG_READ_gAMA_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_hIST
#ifndef PNG_NO_READ_hIST
#define PNG_READ_hIST_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_oFFs
#ifndef PNG_NO_READ_oFFs
#define PNG_READ_oFFs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_pCAL
#ifndef PNG_NO_READ_pCAL
#define PNG_READ_pCAL_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_pHYs
#ifndef PNG_NO_READ_pHYs
#define PNG_READ_pHYs_SUPPORTED
#endif
#ifndef PNG_NO_READ_sBIT
#define PNG_READ_sBIT_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_sRGB
#ifndef PNG_NO_READ_sRGB
#define PNG_READ_sRGB_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tEXt
#ifndef PNG_NO_READ_tEXt
#define PNG_READ_tEXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tIME
#ifndef PNG_NO_READ_tIME
#define PNG_READ_tIME_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tRNS
#ifndef PNG_NO_READ_tRNS
#define PNG_READ_tRNS_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_zTXt
#ifndef PNG_NO_READ_zTXt
#define PNG_READ_zTXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_OPT_PLTE
#ifndef PNG_NO_READ_OPT_PLTE
#define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */
#endif /* PLTE chunk in RGB and RGBA images */
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#ifndef PNG_NO_PNG_WRITE_bKGD
#ifndef PNG_NO_WRITE_bKGD
#define PNG_WRITE_bKGD_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_cHRM
#ifndef PNG_NO_WRITE_cHRM
#define PNG_WRITE_cHRM_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_gAMA
#ifndef PNG_NO_WRITE_gAMA
#define PNG_WRITE_gAMA_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_hIST
#ifndef PNG_NO_WRITE_hIST
#define PNG_WRITE_hIST_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_oFFs
#ifndef PNG_NO_WRITE_oFFs
#define PNG_WRITE_oFFs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_pCAL
#ifndef PNG_NO_WRITE_pCAL
#define PNG_WRITE_pCAL_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_pHYs
#ifndef PNG_NO_WRITE_pHYs
#define PNG_WRITE_pHYs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_sBIT
#ifndef PNG_NO_WRITE_sBIT
#define PNG_WRITE_sBIT_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_sRGB
#ifndef PNG_NO_WRITE_sRGB
#define PNG_WRITE_sRGB_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tEXt
#ifndef PNG_NO_WRITE_tEXt
#define PNG_WRITE_tEXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tIME
#ifndef PNG_NO_WRITE_tIME
#define PNG_WRITE_tIME_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tRNS
#ifndef PNG_NO_WRITE_tRNS
#define PNG_WRITE_tRNS_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_zTXt
#ifndef PNG_NO_WRITE_zTXt
#define PNG_WRITE_zTXt_SUPPORTED
#endif
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */

View File

@ -1,14 +1,14 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 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
* and use png_set_error_fn() to use those functions. See the instructions
* at each function.
@ -52,7 +52,7 @@ png_warning(png_structp png_ptr, png_const_charp message)
png_default_warning(png_ptr, message);
}
/* 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,
* 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 []

View File

@ -1,12 +1,12 @@
/* pngget.c - retrieval of values from info struct
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*/
#define PNG_INTERNAL

View File

@ -1,12 +1,12 @@
/* pngmem.c - stub functions for memory allocation
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* This file provides a location for all memory allocation. Users who
* need special memory handling are expected to modify the code in this file
@ -72,7 +72,7 @@ png_destroy_struct(png_voidp struct_ptr)
* have the ability to do that.
*
* 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
* 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

View File

@ -1,12 +1,12 @@
/* pngpread.c - read a png file in push mode
*
* 1.0.1c
* 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*/
#define PNG_INTERNAL
@ -1070,7 +1070,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
#endif
/* This function is called when we haven't found a handler for this
* chunk. In the future we will have code here which can handle
* chunk. In the future we will have code here that can handle
* user-defined callback functions for unknown chunks before they are
* ignored or cause an error. If there isn't a problem with the
* chunk itself (ie a bad chunk name or a critical chunk), the chunk

View File

@ -1,12 +1,12 @@
/* pngread.c - read a PNG file
*
* 1.0.1c
* 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* This file contains routines that an application calls directly to
* read a PNG file or stream.
@ -520,7 +520,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
/* save jump buffer and error functions */
rp = row;
dp = display_row;
if(rp != NULL && dp != NULL)
if (rp != NULL && dp != NULL)
for (i = 0; i < num_rows; i++)
{
png_bytep rptr = *rp++;
@ -528,25 +528,19 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
png_read_row(png_ptr, rptr, dptr);
}
else
else if(rp != NULL)
for (i = 0; i < num_rows; i++)
{
png_bytep rptr;
png_bytep dptr;
if (rp != NULL)
rptr = *rp;
else
rptr = NULL;
if (dp != NULL)
dptr = *dp;
else
dptr = NULL;
png_read_row(png_ptr, rptr, dptr);
if (row != NULL)
rp++;
if (display_row != NULL)
dp++;
png_bytep rptr = *rp;
png_read_row(png_ptr, rptr, NULL);
rp++;
}
else if(dp != NULL)
for (i = 0; i < num_rows; i++)
{
png_bytep dptr = *dp;
png_read_row(png_ptr, NULL, dptr);
dp++;
}
}

View File

@ -1,17 +1,17 @@
/* pngrio.c - functions for data input
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* This file provides a location for all input. Users which need
* special handling are expected to write a function which has the same
* arguments as this, and perform a similar function, but possibly has
* a different input method. Note that you shouldn't change this
* This file provides a location for all input. Users who need
* special handling are expected to write a function that has the same
* arguments as this and performs a similar function, but that possibly
* has a different input method. Note that you shouldn't change this
* function, but rather write a replacement function and then make
* libpng use it at run time with png_set_read_fn(...).
*/
@ -35,7 +35,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
#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
read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */
@ -114,10 +114,10 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_ptr - pointer to a png input data structure
io_ptr - pointer to user supplied structure containing info about
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
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
function should call png_error(png_ptr, "Error msg"). */
void

View File

@ -1,16 +1,16 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* 1.0.1c
* 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* This file contains functions optionally called by an application
* in order to tell libpng how to handle data when reading a PNG.
* Transformations which are used in both reading and writing are
* Transformations that are used in both reading and writing are
* in pngtrans.c.
*/
@ -208,11 +208,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
/* swap the palette around, and set up a table, if necessary */
if (full_dither)
{
int j;
int j = num_palette;
/* put all the useful colors within the max, but don't
move the others */
for (i = 0, j = num_palette; i < maximum_colors; i++)
for (i = 0; i < maximum_colors; i++)
{
if ((int)sort[i] >= maximum_colors)
{
@ -225,11 +225,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
}
else
{
int j;
int j = num_palette;
/* move all the used colors inside the max limit, and
develop a translation table */
for (i = 0, j = num_palette; i < maximum_colors; i++)
for (i = 0; i < maximum_colors; i++)
{
/* only move the colors we need to */
if ((int)sort[i] >= maximum_colors)
@ -576,16 +576,19 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
void
png_init_read_transformations(png_structp png_ptr)
{
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if(png_ptr == NULL) return;
#endif
png_debug(1, "in png_init_read_transformations\n");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if(png_ptr != NULL)
#endif
{
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \
|| defined(PNG_READ_GAMMA_SUPPORTED)
int color_type = png_ptr->color_type;
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
if (png_ptr->transformations & PNG_BACKGROUND_EXPAND)
{
int color_type = png_ptr->color_type;
if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */
{
/* expand background chunk. */
@ -881,6 +884,7 @@ png_init_read_transformations(png_structp png_ptr)
}
}
#endif
}
}
/* Modify the info structure to reflect the transformations. The
@ -1334,19 +1338,20 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
}
case 4:
{
png_bytep bp;
png_bytep bp = row;
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
png_byte mask = (png_byte)(((int)0xf0 >> shift[0]) & (int)0xf0) |
(png_byte)((int)0xf >> shift[0]);
for (bp = row, i = 0; i < istop; i++)
for (i = 0; i < istop; i++)
{
*bp >>= shift[0];
*bp++ &= mask;
}
break;
}
#ifndef PNG_SLOW_SHIFT
case 8:
{
png_bytep bp = row;
@ -1374,6 +1379,43 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
}
break;
}
#else
case 8:
{
png_bytep bp;
png_uint_32 i;
int cstop;
cstop=(int)row_info->channels;
for (bp = row, i = 0; i < row_width; i++)
{
for (c = 0; c < cstop; c++, bp++)
{
*bp >>= shift[c];
}
}
break;
}
case 16:
{
png_bytep bp;
png_size_t i;
int cstop;
cstop=(int)row_info->channels;
for (bp = row, i = 0; i < row_width; i++)
{
for (c = 0; c < cstop; c++, bp += 2)
{
value = (png_uint_16)((*bp << 8) + *(bp + 1));
value >>= shift[c];
*bp = (png_byte)(value >> 8);
*(bp + 1) = (png_byte)(value & 0xff);
}
}
break;
}
#endif
}
}
}

View File

@ -1,14 +1,14 @@
/* pngrutil.c - utilities to read a PNG file
*
* 1.0.1c
* 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* This file contains routines which are only called from within
* This file contains routines that are only called from within
* libpng itself during the course of reading an image.
*/
@ -16,7 +16,7 @@
#include "png.h"
#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
/* Grab an unsigned 32-bit integer from a buffer in big endian format. */
/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */
png_uint_32
png_get_uint_32(png_bytep buf)
{
@ -29,7 +29,7 @@ png_get_uint_32(png_bytep buf)
}
#if defined(PNG_READ_pCAL_SUPPORTED)
/* Grab a signed 32-bit integer from a buffer in big endian format. The
/* Grab a signed 32-bit integer from a buffer in big-endian format. The
* data is stored in the PNG file in two's complement format, and it is
* assumed that the machine format for signed integers is the same. */
png_int_32
@ -44,7 +44,7 @@ png_get_int_32(png_bytep buf)
}
#endif /* PNG_READ_pCAL_SUPPORTED */
/* Grab an unsigned 16-bit integer from a buffer in big endian format. */
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
png_uint_16
png_get_uint_16(png_bytep buf)
{
@ -1724,7 +1724,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc = 1;
}
for (i = row_info->width; i; i--)
for (i = 0; i < row_info->width; i++)
{
v = (png_byte)((*sp >> sshift) & 0x1);
for (j = 0; j < jstop; j++)
@ -1777,7 +1777,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc = 2;
}
for (i = row_info->width; i; i--)
for (i = 0; i < row_info->width; i++)
{
png_byte v;
int j;
@ -1833,7 +1833,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc = 4;
}
for (i = row_info->width; i; i--)
for (i = 0; i < row_info->width; i++)
{
png_byte v = (png_byte)((*sp >> sshift) & 0xf);
int j;
@ -1868,7 +1868,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
int jstop = png_pass_inc[pass];
png_uint_32 i;
for (i = row_info->width; i; i--)
for (i = 0; i < row_info->width; i++)
{
png_byte v[8];
int j;
@ -1914,7 +1914,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
for (i = bpp; i < istop; i++)
{
*rp++ = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
*rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
rp++;
}
break;
}
@ -1927,7 +1928,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
for (i = 0; i < istop; i++)
{
*rp++ = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
*rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
rp++;
}
break;
}
@ -1938,18 +1940,20 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
png_bytep pp = prev_row;
png_bytep lp = row;
png_uint_32 bpp = (row_info->pixel_depth + 7) / 8;
png_uint_32 istop = row_info->rowbytes;
png_uint_32 istop = row_info->rowbytes - bpp;
for (i = 0; i < bpp; i++)
{
*rp++ = (png_byte)(((int)(*rp) +
*rp = (png_byte)(((int)(*rp) +
((int)(*pp++) / 2)) & 0xff);
rp++;
}
for (lp = row; i < istop; i++)
for (i = 0; i < istop; i++)
{
*rp++ = (png_byte)(((int)(*rp) +
*rp = (png_byte)(((int)(*rp) +
(int)(*pp++ + *lp++) / 2) & 0xff);
rp++;
}
break;
}
@ -1961,14 +1965,15 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
png_bytep lp = row;
png_bytep cp = prev_row;
png_uint_32 bpp = (row_info->pixel_depth + 7) / 8;
png_uint_32 istop=row_info->rowbytes;
png_uint_32 istop=row_info->rowbytes - bpp;
for (i = 0; i < bpp; i++)
{
*rp++ = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
*rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
rp++;
}
for ( ; i < istop; i++) /* use leftover i,rp,pp */
for (i = 0; i < istop; i++) /* use leftover rp,pp */
{
int a, b, c, pa, pb, pc, p;
@ -2000,7 +2005,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
*rp++ = (png_byte)(((int)(*rp) + p) & 0xff);
*rp = (png_byte)(((int)(*rp) + p) & 0xff);
rp++;
}
break;
}

View File

@ -1,12 +1,12 @@
/* pngset.c - storage of image information into info struct
*
* 1.0.1c
* 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* The functions here are used during reads to store data from the file
* into the info struct, and during writes to store application data

View File

@ -1,12 +1,12 @@
/* pngtest.c - a simple test program to test libpng
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* This program reads in a PNG image, writes it out again, and then
* compares the two files. If the files are identical, this shows that
@ -180,7 +180,7 @@ static int wrote_question = 0;
/* START of code to validate stdio-free compilation */
/* These copies of the default read/write functions come from pngrio.c and */
/* pngwio.c. They allow "don't include stdio" testing of the library. */
/* 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
read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */
@ -262,7 +262,7 @@ png_default_flush(png_structp png_ptr)
}
#endif
/* 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
write_data function and use it at run time with png_set_write_fn(), rather
than changing the library. */
@ -352,8 +352,8 @@ static void
png_default_error(png_structp png_ptr, png_const_charp message)
{
png_default_warning(png_ptr, message);
/* We can return because png_error calls the default handler which is
* actually ok in this case. */
/* We can return because png_error calls the default handler, which is
* actually OK in this case. */
}
#endif /* PNG_NO_STDIO */
/* END of code to validate stdio-free compilation */
@ -439,7 +439,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
if (current_allocation < 0)
fprintf(STDERR, "Duplicate free of memory\n");
/* We must free the list element too, but first kill
the memory which is to be freed. */
the memory that is to be freed. */
memset(ptr, 0x55, pinfo->size);
png_debug_free(png_ptr, pinfo);
break;

View File

@ -1,12 +1,12 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* 1.0.1c
* 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*/
#define PNG_INTERNAL
@ -87,8 +87,8 @@ png_set_interlace_handling(png_structp png_ptr)
#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.
* 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
* which don't like bytes as parameters.
* for 48-bit input data, as well as to avoid problems with some compilers
* that don't like bytes as parameters.
*/
void
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
@ -148,7 +148,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
for (i = 0; i < istop; i++)
{
*rp++ = (png_byte)(~(*rp));
*rp = (png_byte)(~(*rp));
rp++;
}
}
}

View File

@ -1,17 +1,17 @@
/* pngwio.c - functions for data output
*
* libpng 1.0.1c
* libpng 1.0.1d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 9, 1998
* May 21, 1998
*
* This file provides a location for all output. Users which need
* special handling are expected to write functions which have the same
* arguments as these, and perform similar functions, but possibly use
* different output methods. Note that you shouldn't change these
* This file provides a location for all output. Users who need
* special handling are expected to write functions that have the same
* arguments as these and perform similar functions, but that possibly
* use different output methods. Note that you shouldn't change these
* functions, but rather write replacement functions and then change
* them at run time with png_set_write_fn(...).
*/
@ -35,7 +35,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
#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
write_data function and use it at run time with png_set_write_fn(), rather
than changing the library. */
@ -133,13 +133,13 @@ png_default_flush(png_structp png_ptr)
png_ptr - pointer to a png output data structure
io_ptr - pointer to user supplied structure containing info about
the output functions. May be NULL.