Imported from libpng-1.0.7beta17.tar

This commit is contained in:
Glenn Randers-Pehrson 2000-06-23 21:38:16 -05:00
parent d436672048
commit db66d44801
61 changed files with 2481 additions and 308 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.0.7beta16 - June 4, 2000 Libpng 1.0.7beta17 - June 24, 2000
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.
@ -80,15 +80,18 @@ Changes since the last public release (1.0.6):
Set each pointer to NULL after freeing it in png_free_data(). 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" 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) macro that conflicts with libpng's png_color_16.index. (Dimitri Papadapoulos)
Added "msvc" directory with MSVC++ project files (Simon-Pierre Cadieux).
Added PNG_NO_POINTER_INDEXING macro to use array-indexing instead of pointer 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. indexing in pngrutil.c and pngwutil.c to accommodate a buggy compiler.
Added a check for overlength PLTE chunk in pngrutil.c. Added a check for overlength PLTE chunk in pngrutil.c.
Added PNG_NO_POINTER_INDEXING macro to use array-indexing instead of pointer 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. 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. Added a warning in png_decompress_chunk() when it runs out of data.
Added PNG_USE_DLL macro.
Revised the copyright/disclaimer/license notice. Revised the copyright/disclaimer/license notice.
Corrected the definition of PNG_TRANSFORM_INVERT_ALPHA (0x0400 not 0x0200)
Added PNG_USE_DLL macro.
Added "msvc" and contrib/msvctest directories with MSVC++ project files
(Simon-Pierre Cadieux) and contrib/visupng directory (Willem van Schaik).
Removed leading underscores from "_PNG_H" and "_PNG_SAVE_BSD_SOURCE" macros.
Send comments/corrections/commendations to Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

12
CHANGES
View File

@ -757,7 +757,7 @@ version 1.0.7beta14 [May 17, 2000] (beta13 was not published)
Removed info_ptr->valid tests from png_free_data(), as in version 1.0.5. Removed info_ptr->valid tests from png_free_data(), as in version 1.0.5.
Added png_set_invalid() function. Added png_set_invalid() function.
Fixed incorrect illustrations of png_destroy_write_struct() in example.c. Fixed incorrect illustrations of png_destroy_write_struct() in example.c.
version 1.0.7beta15 [May 29, 2000] version 1.0.7beta15 [May 30, 2000]
Revised the deliberately erroneous Linux setjmp code in pngconf.h to produce Revised the deliberately erroneous Linux setjmp code in pngconf.h to produce
fewer error messages. fewer error messages.
Rearranged checks for Z_OK to check the most likely path first in pngpread.c Rearranged checks for Z_OK to check the most likely path first in pngpread.c
@ -779,6 +779,16 @@ version 1.0.7beta16 [June 4, 2000]
Added a warning in png_decompress_chunk() when it runs out of data. Added a warning in png_decompress_chunk() when it runs out of data.
Added PNG_USE_DLL macro. Added PNG_USE_DLL macro.
Revised the copyright/disclaimer/license notice. 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.7beta17 [June 24, 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.
Send comments/corrections/commendations to Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

22
INSTALL
View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.7beta16 - June 4, 2000 Installing libpng version 1.0.7beta17 - June 24, 2000
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,7 +10,7 @@ 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.7beta16" or "lpng106" and "zlib-1.1.3" might be called "libpng-1.0.7beta17" or "lpng107" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng". or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@ -26,6 +26,7 @@ Your directory structure should look like this:
msvctest msvctest
pngminus pngminus
pngsuite pngsuite
visupng
msvc msvc
scripts scripts
makefile.* makefile.*
@ -42,18 +43,19 @@ If the line endings in the files look funny, you may wish to get the other
distribution of libpng. It is available in both tar.gz (UNIX style line distribution of libpng. It is available in both tar.gz (UNIX style line
endings) and zip (DOS style line endings) formats. endings) and zip (DOS style line endings) formats.
If you are building libpng with MSVC, you can enter the msvc directory and If you are building libpng with MSVC, you can enter the libpng\msvc directory
follow the instructions in msvc/README.txt. and follow the instructions in msvc\README.txt.
Else enter the zlib directory and follow the instructions in zlib/README. 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 then come back here and choose the appropriate makefile.sys in the scripts
directory. directory.
The files that are presently available in the scripts directory The files that are presently available in the scripts directory
include include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7beta16) makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7beta17)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7beta16, makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7beta17,
uses assembler code tuned for Intel MMX platform) uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
@ -65,9 +67,9 @@ include
makefile.intel => Intel C/C++ version 4.0 and later makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta16) makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta17)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.7beta16) makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.7beta17)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile makefile.acorn => Acorn makefile

100
KNOWNBUG
View File

@ -1,97 +1,7 @@
Known bugs and suggested enhancements in libpng-1.0.6 Known bugs and suggested enhancements in libpng-1.0.7
1. April 24, 2000 -- BUG -- binary incompatibility 1. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
Libpng-1.0.6 is binary incompatible with old applications that
allocate the png_struct and png_info structures themselves instead
of using png_create_*(). They do not allocate enough space for
the structures because they have an incorrect notion of
sizeof(png_struct) and sizeof(png_info). Although such applications
should be considered broken rather than considering libpng to be broken,
they are numerous and include products of the PNG group, such
as gif2png and pnmtopng-2.36 (pnmtopng-2.37 is OK), so libpng will
be fixed in version 1.0.7 to work around this problem.
Applications that use png_create_*() instead of png_ptr=malloc(...)
are immune to this problem.
STATUS: Fixed in libpng-1.0.6ad, libpng-1.0.6j, and patch-d
which are currently being tested by the PNG group.
The fix necessarily reintroduces a binary incompatibility with any
application that makes direct access to the png_info and
png_struct members that deal with the pCAL chunk, palette_lookup,
dither_index, time_buffer, or weighted filtering, i.e., any members
coming after the new "free_me" member of either structure. It
is believed that applications affected by this reintroduced binary
incompatibility are rare (none are known to the PNG group). An
effective workaround for this and the next bug is to recompile the
old applications with the installed version of libpng.
2. April 23, 2000 -- BUG -- binary incompatibility
Libpng-1.0.6 introduced binary incompatibility for applications that
make direct access to members of the png_struct and png_info structures,
due to the insertion of the free_me member ahead of some previously
existing members.
Applications that use png_set_*(), png_get_*() are immune to this
problem, but people are still to this day writing applications that
make ill-advised direct access to members of the png_struct and
png_info structures, so libpng-1.0.6 will be patched to work around
this problem.
STATUS: Fixed in libpng-1.0.6j and patch-d, which are currently being
tested by the PNG group. Users can work around the problem without
patching libpng by recompiling their applications.
3. April 15, 2000 -- BUG -- pnggccrd.c
If PNG_NO_GLOBAL_ARRAYS is defined, pnggccrd.c will not compile.
STATUS: Fixed in libpng-1.0.6g
4. April 1, 2000 -- BUG
Under some circumstances old applications that make direct access to
the info_ptr->text and its members might free the same memory that
is also free'ed by libpng during the png_destroy_struct process.
Fixed in libpng-1.0.6-patch-c and libpng-1.0.6d. The PNG_FREE_TEXT flag
bit in info_ptr->free_me is now checked to make sure libpng is responsible
for freeing the memory.
5. April 1, 2000 -- BUG
The non-ISO-C "strdup()" function is used in png.c
STATUS: The function has been simplified and no longer uses strdup()
in libpng-1.0.6-patch-c and libpng-1.0.6d.
6. March 24, 2000 -- BUG
The png_set_rgb_to_gray_fixed() function is setting incorrect weighting
factors.
STATUS: Fixed in libpng-1.0.6-patch-b and libpng-1.0.6d.
7. March 22, 2000 -- BUG
There are some printf() and fprintf() statements active in pngwutil.c
when PNG_NO_STDIO and PNG_sCAL_SUPPORTED are both defined.
STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d. The strcpy()
function is used instead.
8. March 22, 2000 -- BUG
The length of the iCCP chunk data is calculated incorrectly; because
it can contain zeroes, strlen() doesn't work.
STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d by adding a
data_length parameter to the png_decompress_chunk() function.
9. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
Loops need to be optimized everywhere Loops need to be optimized everywhere
@ -106,7 +16,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
libpng-1.1.0. About 160 loops will be turned around libpng-1.1.0. About 160 loops will be turned around
in libpng-1.1.Nn, for testing. in libpng-1.1.Nn, for testing.
10. July 4, 1998 -- ENHANCEMENT -- Glenn R-P 2. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
libpng-1.0.5 and earlier transform colors to gamma=1.0 space for libpng-1.0.5 and earlier transform colors to gamma=1.0 space for
merging with background, and then back to the image's gamma. The merging with background, and then back to the image's gamma. The
@ -118,12 +28,12 @@ Known bugs and suggested enhancements in libpng-1.0.6
STATUS: under development. STATUS: under development.
11. September 1999 -- ENHANCEMENT -- 3. September 1999 -- ENHANCEMENT --
It should be possible to use libpng without floating-point aritmetic. It should be possible to use libpng without floating-point aritmetic.
STATUS: Under investigation, implementation postponed until after STATUS: Under investigation, implementation postponed until after
libpng-1.0.6. The application interface will change because replacements libpng-1.0.7. The application interface will change because replacements
for the png_set_gAMA(), png_set_cHRM(), and corresponding png_get_() for the png_set_gAMA(), png_set_cHRM(), and corresponding png_get_()
functions will be needed. functions will be needed.

View File

@ -5,7 +5,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.90, December 1996, through 0.96, May 1997) (libpng versions 0.90, December 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.7beta16, June 4, 2000) (libpng versions 0.97, January 1998, through 1.0.7beta17, June 24, 2000)
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: is defined as the following set of individuals:
@ -68,4 +68,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
randeg@alum.rpi.edu randeg@alum.rpi.edu
June 4, 2000 June 24, 2000

11
README
View File

@ -1,4 +1,4 @@
README for libpng 1.0.7beta16 - June 4, 2000 (shared library 2.1) README for libpng 1.0.7beta17 - June 24, 2000 (shared library 2.1)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
@ -169,15 +169,16 @@ Files in this distribution:
msvctest => Builds and runs pngtest using a MSVC workspace msvctest => Builds and runs pngtest using a MSVC workspace
pngminus => Simple pnm2png and png2pnm programs pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images pngsuite => Test images
visupng => Contains a MSVC workspace for VisualPng
msvc => Contains a Microsoft Visual C++ (MSVC) workspace msvc => Contains a Microsoft Visual C++ (MSVC) workspace
for building libpng and zlib for building libpng and zlib
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 (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.7beta16) (gcc, creates libpng.so.2.1.0.7beta17)
makefile.gcmmx => Linux/ELF makefile (gcc, creates makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng.so.2.1.0.7beta16, uses assembler code libpng.so.2.1.0.7beta17, uses assembler code
tuned for Intel MMX platform) tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
@ -189,10 +190,10 @@ Files in this distribution:
makefile.intel => Intel C/C++ version 4.0 and later makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta16) makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta17)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.7beta16) (gcc, creates libpng.so.2.1.0.7beta17)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile makefile.acorn => Acorn makefile

View File

@ -1,13 +1,13 @@
Y2K compliance in libpng: Y2K compliance in libpng:
========================= =========================
June 4, 2000 June 24, 2000
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.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.7beta16 are Y2K compliant. It is my belief that earlier upward through 1.0.7beta17 are Y2K compliant. It is my belief that earlier
versions were 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

2
configure vendored
View File

@ -1,5 +1,5 @@
echo " echo "
There is no \"configure\" script for Libpng-1.0.7beta16. Instead, please There is no \"configure\" script for Libpng-1.0.7beta17. Instead, please
copy the appropriate makefile for your system from the \"scripts\" copy the appropriate makefile for your system from the \"scripts\"
directory. Read the INSTALL file for more details. directory. Read the INSTALL file for more details.
" "

View File

@ -119,7 +119,7 @@ LINK32=link.exe
OutDir=.\dll_asm OutDir=.\dll_asm
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PostBuild_Desc=[Run Test] PostBuild_Desc=[Run Test]
PostBuild_Cmds=set path=..\..\msvc\win32\libpng\dll_asm;..\..\msvc\win32\zlib\dll; $(outdir)\msvctest.exe ..\..\pngtest.png PostBuild_Cmds=set path=..\..\msvc\win32\libpng\dll_asm;..\..\msvc\win32\zlib\dll_asm; $(outdir)\msvctest.exe ..\..\pngtest.png
# End Special Build Tool # End Special Build Tool
!ELSEIF "$(CFG)" == "msvctest - Win32 Debug ASM DLL" !ELSEIF "$(CFG)" == "msvctest - Win32 Debug ASM DLL"
@ -149,7 +149,7 @@ LINK32=link.exe
OutDir=.\dll_dbga OutDir=.\dll_dbga
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PostBuild_Desc=[Run Test] PostBuild_Desc=[Run Test]
PostBuild_Cmds=set path=..\..\msvc\win32\libpng\dll_dbga;..\..\msvc\win32\zlib\dll_dbg; $(outdir)\msvctest.exe ..\..\pngtest.png PostBuild_Cmds=set path=..\..\msvc\win32\libpng\dll_dbga;..\..\msvc\win32\zlib\dll_dbga; $(outdir)\msvctest.exe ..\..\pngtest.png
# End Special Build Tool # End Special Build Tool
!ELSEIF "$(CFG)" == "msvctest - Win32 LIB" !ELSEIF "$(CFG)" == "msvctest - Win32 LIB"

443
contrib/visupng/PngFile.c Normal file
View File

@ -0,0 +1,443 @@
//-------------------------------------
// PNGFILE.C -- Image File Functions
//-------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and
// use, see the copyright/license/disclaimer notice in png.h
#include <windows.h>
#include <commdlg.h>
#include <stdio.h>
#include <stdlib.h>
#include "png.h"
#include "pngfile.h"
#include "cexcept.h"
define_exception_type(const char *);
extern struct exception_context the_exception_context[1];
struct exception_context the_exception_context[1];
png_const_charp msg;
static OPENFILENAME ofn;
static png_structp png_ptr = NULL;
static png_infop info_ptr = NULL;
// cexcept interface
static void
png_cexcept_error(png_structp png_ptr, png_const_charp msg)
{
if(png_ptr)
;
#ifndef PNG_NO_CONSOLE_IO
fprintf(stderr, "libpng error: %s\n", msg);
#endif
{
Throw msg;
}
}
// Windows open-file functions
void PngFileInitialize (HWND hwnd)
{
static TCHAR szFilter[] = TEXT ("PNG Files (*.PNG)\0*.png\0")
TEXT ("All Files (*.*)\0*.*\0\0");
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.hInstance = NULL;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 0;
ofn.lpstrFile = NULL; // Set in Open and Close functions
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFileTitle = NULL; // Set in Open and Close functions
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = NULL;
ofn.Flags = 0; // Set in Open and Close functions
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = TEXT ("png");
ofn.lCustData = 0;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
}
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName)
{
ofn.hwndOwner = hwnd;
ofn.lpstrFile = pstrFileName;
ofn.lpstrFileTitle = pstrTitleName;
ofn.Flags = OFN_HIDEREADONLY;
return GetOpenFileName (&ofn);
}
BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName)
{
ofn.hwndOwner = hwnd;
ofn.lpstrFile = pstrFileName;
ofn.lpstrFileTitle = pstrTitleName;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
return GetSaveFileName (&ofn);
}
// PNG image handler functions
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor)
{
static FILE *pfFile;
png_byte pbSig[8];
int iBitDepth;
int iColorType;
double dGamma;
png_color_16 *pBackground;
png_uint_32 ulChannels;
png_uint_32 ulRowBytes;
png_byte *pbImageData = *ppbImageData;
static png_byte **ppbRowPointers = NULL;
int i;
// open the PNG input file
if (!pstrFileName)
{
*ppbImageData = pbImageData = NULL;
return FALSE;
}
if (!(pfFile = fopen(pstrFileName, "rb")))
{
*ppbImageData = pbImageData = NULL;
return FALSE;
}
// first check the eight byte PNG signature
fread(pbSig, 1, 8, pfFile);
if (!png_check_sig(pbSig, 8))
{
*ppbImageData = pbImageData = NULL;
return FALSE;
}
// create the two png(-info) structures
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
if (!png_ptr)
{
*ppbImageData = pbImageData = NULL;
return FALSE;
}
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
png_destroy_read_struct(&png_ptr, NULL, NULL);
*ppbImageData = pbImageData = NULL;
return FALSE;
}
Try
{
// initialize the png structure
#if !defined(PNG_NO_STDIO)
png_init_io(png_ptr, pfFile);
#else
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
#endif
png_set_sig_bytes(png_ptr, 8);
// read all PNG info up to image data
png_read_info(png_ptr, info_ptr);
// get width, height, bit-depth and color-type
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
&iColorType, NULL, NULL, NULL);
// expand images of all color-type and bit-depth to 3x8 bit RGB images
// let the library process things like alpha, transparency, background
if (iBitDepth == 16)
png_set_strip_16(png_ptr);
if (iColorType == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
if (iBitDepth < 8)
png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr);
if (iColorType == PNG_COLOR_TYPE_GRAY ||
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);
// set the background color to draw transparent and alpha images over.
if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
{
png_set_background(png_ptr, pBackground, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
pBkgColor->red = (byte) pBackground->red;
pBkgColor->green = (byte) pBackground->green;
pBkgColor->blue = (byte) pBackground->blue;
}
else
{
pBkgColor = NULL;
}
// if required set gamma conversion
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
png_set_gamma(png_ptr, (double) 2.2, dGamma);
// after the transformations have been registered update info_ptr data
png_read_update_info(png_ptr, info_ptr);
// get again width, height and the new bit-depth and color-type
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
&iColorType, NULL, NULL, NULL);
// row_bytes is the width x number of channels
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
ulChannels = png_get_channels(png_ptr, info_ptr);
*piChannels = ulChannels;
// now we can allocate memory to store the image
if (pbImageData)
{
free (pbImageData);
pbImageData = NULL;
}
if ((pbImageData = (png_byte *) malloc(ulRowBytes * (*piHeight)
* sizeof(png_byte))) == NULL)
{
png_error(png_ptr, "Visual PNG: out of memory");
}
*ppbImageData = pbImageData;
// and allocate memory for an array of row-pointers
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
* sizeof(png_bytep))) == NULL)
{
png_error(png_ptr, "Visual PNG: out of memory");
}
// set the individual row-pointers to point at the correct offsets
for (i = 0; i < (*piHeight); i++)
ppbRowPointers[i] = pbImageData + i * ulRowBytes;
// now we can go ahead and just read the whole image
png_read_image(png_ptr, ppbRowPointers);
// read the additional chunks in the PNG file (not really needed)
png_read_end(png_ptr, NULL);
// and we're done
free (ppbRowPointers);
ppbRowPointers = NULL;
// yepp, done
}
Catch (msg)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
*ppbImageData = pbImageData = NULL;
if(ppbRowPointers)
free (ppbRowPointers);
fclose(pfFile);
return FALSE;
}
fclose (pfFile);
return TRUE;
}
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
int iWidth, int iHeight, png_color bkgColor)
{
const int ciBitDepth = 8;
const int ciChannels = 3;
static FILE *pfFile;
png_uint_32 ulRowBytes;
static png_byte **ppbRowPointers = NULL;
int i;
// open the PNG output file
if (!pstrFileName)
return FALSE;
if (!(pfFile = fopen(pstrFileName, "wb")))
return FALSE;
// prepare the standard PNG structures
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
if (!png_ptr)
{
fclose(pfFile);
return FALSE;
}
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
fclose(pfFile);
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
return FALSE;
}
Try
{
// initialize the png structure
#if !defined(PNG_NO_STDIO)
png_init_io(png_ptr, pfFile);
#else
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
#endif
// we're going to write a very simple 3x8 bit RGB image
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
PNG_FILTER_TYPE_BASE);
// write the file header information
png_write_info(png_ptr, info_ptr);
// swap the BGR pixels in the DiData structure to RGB
png_set_bgr(png_ptr);
// row_bytes is the width x number of channels
ulRowBytes = iWidth * ciChannels;
// we can allocate memory for an array of row-pointers
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
{
fclose(pfFile);
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
return FALSE;
}
// set the individual row-pointers to point at the correct offsets
for (i = 0; i < iHeight; i++)
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
// write out the entire image data in one call
png_write_image (png_ptr, ppbRowPointers);
// write the additional chunks to the PNG file (not really needed)
png_write_end(png_ptr, info_ptr);
// and we're done
free (ppbRowPointers);
ppbRowPointers = NULL;
// clean up after the write, and free any memory allocated
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
// yepp, done
}
Catch (msg)
{
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
if(ppbRowPointers)
free (ppbRowPointers);
fclose(pfFile);
return FALSE;
}
fclose (pfFile);
return TRUE;
}
#ifdef PNG_NO_STDIO
static void
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
/* 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.
*/
check = (png_size_t)fread(data, (png_size_t)1, length,
(FILE *)png_ptr->io_ptr);
if (check != length)
{
png_error(png_ptr, "Read Error");
}
}
static void
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_uint_32 check;
check = fwrite(data, 1, length, (FILE *)(png_ptr->io_ptr));
if (check != length)
{
png_error(png_ptr, "Write Error");
}
}
static void
png_flush(png_structp png_ptr)
{
FILE *io_ptr;
io_ptr = (FILE *)CVT_PTR((png_ptr->io_ptr));
if (io_ptr != NULL)
fflush(io_ptr);
}
#endif
//-----------------
// end of source
//-----------------

27
contrib/visupng/PngFile.h Normal file
View File

@ -0,0 +1,27 @@
//------------------------------------------
// PNGFILE.H -- Header File for pngfile.c
//------------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and
// use, see the copyright/license/disclaimer notice in png.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
void PngFileInitialize (HWND hwnd) ;
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor);
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
int iWidth, int iHeight, png_color BkgColor);
#if defined(PNG_NO_STDIO)
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void png_flush(png_structp png_ptr);
#endif

View File

@ -0,0 +1,58 @@
Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng
------------------------------------------------------------------------
Copyright 2000, Willem van Schaik. For conditions of distribution and
use, see the copyright/license/disclaimer notice in png.h
As a PNG .dll demo VisualPng is finished. More features would only hinder
the program's objective. However, further extensions (like support for other
graphics formats) are in development. To get these, or for pre-compiled
binaries, go to "http://www.schaik.com/png/visualpng.html".
------------------------------------------------------------------------
Assumes that
libpng DLLs and LIBs are in ..\..\msvc\win32\libpng
zlib DLLs and LIBs are in ..\..\msvc\win32\zlib
libpng header files are in ..\..\..\libpng
zlib header files are in ..\..\..\zlib
the pngsuite images are in ..\pngsuite
To build:
1) On the main menu Select "Build|Set Active configuration".
Choose the configuration that corresponds to the library you want to test.
This library must have been built using the libpng MS project located in
the "..\..\mscv" subdirectory.
2) Select "Build|Clean"
3) Select "Build|Rebuild All"
4) After compiling and linking VisualPng will be started to view an image
from the PngSuite directory. Press Ctrl-N (and Ctrl-V) for other images.
To install:
When distributing VisualPng (or a further development) the following options
are available:
1) Build the program with the configuration "Win32 LIB" and you only need to
include the executable from the ./lib directory in your distribution.
2) Build the program with the configuration "Win32 DLL" and you need to put
in your distribution the executable from the ./dll directory and the dll's
libpng1.dll, zlib.dll and msvcrt.dll. These need to be in the user's PATH.
Willem van Schaik
Calgary, June 6th 2000
P.S. VisualPng was written based on preliminary work of:
- Simon-Pierre Cadieux
- Glenn Randers-Pehrson
- Greg Roelofs

961
contrib/visupng/VisualPng.c Normal file
View File

@ -0,0 +1,961 @@
//------------------------------------
// VisualPng.C -- Shows a PNG image
//------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and
// use, see the copyright/license/disclaimer notice in png.h
// switches
// defines
#define PROGNAME "VisualPng"
#define LONGNAME "Win32 Viewer for PNG-files"
#define VERSION "1.0 of 2000 June 07"
// constants
#define MARGIN 8
// standard includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
// application includes
#include "png.h"
#include "pngfile.h"
#include "resource.h"
// macros
// function prototypes
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM) ;
BOOL CenterAbout (HWND hwndChild, HWND hwndParent);
BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
int *pFileIndex);
BOOL SearchPngList (TCHAR *pFileList, int FileCount, int *pFileIndex,
PTSTR pstrPrevName, PTSTR pstrNextName);
BOOL LoadImageFile(HWND hwnd, PTSTR pstrPathName,
png_byte **ppbImage, int *pxImgSize, int *pyImgSize, int *piChannels,
png_color *pBkgColor);
BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
BYTE **ppDiData, int cxWinSize, int cyWinSize,
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
BOOL bStretched);
BOOL InitBitmap (
BYTE *pDiData, int cxWinSize, int cyWinSize);
BOOL FillBitmap (
BYTE *pDiData, int cxWinSize, int cyWinSize,
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
BOOL bStretched);
// a few global variables
static char *szProgName = PROGNAME;
static char *szAppName = LONGNAME;
static char *szIconName = PROGNAME;
static char szCmdFileName [MAX_PATH];
// MAIN routine
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
HACCEL hAccel;
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
int ixBorders, iyBorders;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, szIconName) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = NULL; // (HBRUSH) GetStockObject (GRAY_BRUSH);
wndclass.lpszMenuName = szProgName;
wndclass.lpszClassName = szProgName;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("Error: this program requires Windows NT!"),
szProgName, MB_ICONERROR);
return 0;
}
// if filename given on commandline, store it
if ((szCmdLine != NULL) && (*szCmdLine != '\0'))
if (szCmdLine[0] == '"')
strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2);
else
strcpy (szCmdFileName, szCmdLine);
else
strcpy (szCmdFileName, "");
// calculate size of window-borders
ixBorders = 2 * (GetSystemMetrics (SM_CXBORDER) +
GetSystemMetrics (SM_CXDLGFRAME));
iyBorders = 2 * (GetSystemMetrics (SM_CYBORDER) +
GetSystemMetrics (SM_CYDLGFRAME)) +
GetSystemMetrics (SM_CYCAPTION) +
GetSystemMetrics (SM_CYMENUSIZE) +
1; /* WvS: don't ask me why? */
hwnd = CreateWindow (szProgName, szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
512 + 2 * MARGIN + ixBorders, 384 + 2 * MARGIN + iyBorders,
// CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
ShowWindow (hwnd, iCmdShow);
UpdateWindow (hwnd);
hAccel = LoadAccelerators (hInstance, szProgName);
while (GetMessage (&msg, NULL, 0, 0))
{
if (!TranslateAccelerator (hwnd, hAccel, &msg))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
return msg.wParam;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
static HINSTANCE hInstance ;
static HDC hdc;
static PAINTSTRUCT ps;
static HMENU hMenu;
static BITMAPFILEHEADER *pbmfh;
static BITMAPINFOHEADER *pbmih;
static BYTE *pbImage;
static int cxWinSize, cyWinSize;
static int cxImgSize, cyImgSize;
static int cImgChannels;
static png_color bkgColor = {127, 127, 127};
static BOOL bStretched = TRUE;
static BYTE *pDib = NULL;
static BYTE *pDiData = NULL;
static TCHAR szImgPathName [MAX_PATH];
static TCHAR szTitleName [MAX_PATH];
static TCHAR *pPngFileList = NULL;
static int iPngFileCount;
static int iPngFileIndex;
BOOL bOk;
switch (message)
{
case WM_CREATE:
hInstance = ((LPCREATESTRUCT) lParam)->hInstance ;
PngFileInitialize (hwnd);
strcpy (szImgPathName, "");
// in case we process file given on command-line
if (szCmdFileName[0] != '\0')
{
strcpy (szImgPathName, szCmdFileName);
// read the other png-files in the directory for later
// next/previous commands
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
&iPngFileIndex);
// load the image from file
if (!LoadImageFile (hwnd, szImgPathName,
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
return 0;
// invalidate the client area for later update
InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
}
return 0;
case WM_SIZE:
cxWinSize = LOWORD (lParam);
cyWinSize = HIWORD (lParam);
// invalidate the client area for later update
InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
return 0;
case WM_INITMENUPOPUP:
hMenu = GetMenu (hwnd);
if (pbImage)
EnableMenuItem (hMenu, IDM_FILE_SAVE, MF_ENABLED);
else
EnableMenuItem (hMenu, IDM_FILE_SAVE, MF_GRAYED);
return 0;
case WM_COMMAND:
hMenu = GetMenu (hwnd);
switch (LOWORD (wParam))
{
case IDM_FILE_OPEN:
// show the File Open dialog box
if (!PngFileOpenDlg (hwnd, szImgPathName, szTitleName))
return 0;
// read the other png-files in the directory for later
// next/previous commands
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
&iPngFileIndex);
// load the image from file
if (!LoadImageFile (hwnd, szImgPathName,
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
return 0;
// invalidate the client area for later update
InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
return 0;
case IDM_FILE_SAVE:
// show the File Save dialog box
if (!PngFileSaveDlg (hwnd, szImgPathName, szTitleName))
return 0;
// save the PNG to a disk file
SetCursor (LoadCursor (NULL, IDC_WAIT));
ShowCursor (TRUE);
bOk = PngSaveImage (szImgPathName, pDiData, cxWinSize, cyWinSize,
bkgColor);
ShowCursor (FALSE);
SetCursor (LoadCursor (NULL, IDC_ARROW));
if (!bOk)
MessageBox (hwnd, TEXT ("Error in saving the PNG image"),
szProgName, MB_ICONEXCLAMATION | MB_OK);
return 0;
case IDM_FILE_NEXT:
// read next entry in the directory
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
NULL, szImgPathName))
{
if (strcmp (szImgPathName, "") == 0)
return 0;
// load the image from file
if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
return 0;
// invalidate the client area for later update
InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
}
return 0;
case IDM_FILE_PREVIOUS:
// read previous entry in the directory
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
szImgPathName, NULL))
{
if (strcmp (szImgPathName, "") == 0)
return 0;
// load the image from file
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
&cyImgSize, &cImgChannels, &bkgColor))
return 0;
// invalidate the client area for later update
InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
}
return 0;
case IDM_FILE_EXIT:
// more cleanup needed...
// free image buffer
if (pDib != NULL)
{
free (pDib);
pDib = NULL;
}
// free file-list
if (pPngFileList != NULL)
{
free (pPngFileList);
pPngFileList = NULL;
}
// let's go ...
exit (0);
return 0;
case IDM_OPTIONS_STRETCH:
bStretched = !bStretched;
if (bStretched)
CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_CHECKED);
else
CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_UNCHECKED);
// invalidate the client area for later update
InvalidateRect (hwnd, NULL, TRUE);
// display the PNG into the DIBitmap
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
return 0;
case IDM_HELP_ABOUT:
DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc) ;
return 0;
} // end switch
break;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps);
if (pDib)
SetDIBitsToDevice (hdc, 0, 0, cxWinSize, cyWinSize, 0, 0,
0, cyWinSize, pDiData, (BITMAPINFO *) pDib, DIB_RGB_COLORS);
EndPaint (hwnd, &ps);
return 0;
case WM_DESTROY:
if (pbmfh)
{
free (pbmfh);
pbmfh = NULL;
}
PostQuitMessage (0);
return 0;
}
return DefWindowProc (hwnd, message, wParam, lParam);
}
BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG :
ShowWindow (hDlg, SW_HIDE);
CenterAbout (hDlg, GetWindow (hDlg, GW_OWNER));
ShowWindow (hDlg, SW_SHOW);
return TRUE ;
case WM_COMMAND :
switch (LOWORD (wParam))
{
case IDOK :
case IDCANCEL :
EndDialog (hDlg, 0) ;
return TRUE ;
}
break ;
}
return FALSE ;
}
//---------------
// CenterAbout
//---------------
BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
{
RECT rChild, rParent, rWorkArea;
int wChild, hChild, wParent, hParent;
int xNew, yNew;
BOOL bResult;
// Get the Height and Width of the child window
GetWindowRect (hwndChild, &rChild);
wChild = rChild.right - rChild.left;
hChild = rChild.bottom - rChild.top;
// Get the Height and Width of the parent window
GetWindowRect (hwndParent, &rParent);
wParent = rParent.right - rParent.left;
hParent = rParent.bottom - rParent.top;
// Get the limits of the 'workarea'
bResult = SystemParametersInfo(
SPI_GETWORKAREA, // system parameter to query or set
sizeof(RECT),
&rWorkArea,
0);
if (!bResult) {
rWorkArea.left = rWorkArea.top = 0;
rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
}
// Calculate new X position, then adjust for workarea
xNew = rParent.left + ((wParent - wChild) /2);
if (xNew < rWorkArea.left) {
xNew = rWorkArea.left;
} else if ((xNew+wChild) > rWorkArea.right) {
xNew = rWorkArea.right - wChild;
}
// Calculate new Y position, then adjust for workarea
yNew = rParent.top + ((hParent - hChild) /2);
if (yNew < rWorkArea.top) {
yNew = rWorkArea.top;
} else if ((yNew+hChild) > rWorkArea.bottom) {
yNew = rWorkArea.bottom - hChild;
}
// Set it, and return
return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE |
SWP_NOZORDER);
}
//----------------
// BuildPngList
//----------------
BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
int *pFileIndex)
{
static TCHAR szImgPathName [MAX_PATH];
static TCHAR szImgFileName [MAX_PATH];
static TCHAR szImgFindName [MAX_PATH];
WIN32_FIND_DATA finddata;
HANDLE hFind;
static TCHAR szTmp [MAX_PATH];
BOOL bOk;
int i, ii;
int j, jj;
// free previous file-list
if (*ppFileList != NULL)
{
free (*ppFileList);
*ppFileList = NULL;
}
// extract foldername, filename and search-name
strcpy (szImgPathName, pstrPathName);
strcpy (szImgFileName, strrchr (pstrPathName, '\\') + 1);
strcpy (szImgFindName, szImgPathName);
*(strrchr (szImgFindName, '\\') + 1) = '\0';
strcat (szImgFindName, "*.png");
// first cycle: count number of files in directory for memory allocation
*pFileCount = 0;
hFind = FindFirstFile(szImgFindName, &finddata);
bOk = (hFind != (HANDLE) -1);
while (bOk)
{
*pFileCount += 1;
bOk = FindNextFile(hFind, &finddata);
}
FindClose(hFind);
// allocation memory for file-list
*ppFileList = (TCHAR *) malloc (*pFileCount * MAX_PATH);
// second cycle: read directory and store filenames in file-list
hFind = FindFirstFile(szImgFindName, &finddata);
bOk = (hFind != (HANDLE) -1);
i = 0;
ii = 0;
while (bOk)
{
strcpy (*ppFileList + ii, szImgPathName);
strcpy (strrchr(*ppFileList + ii, '\\') + 1, finddata.cFileName);
if (strcmp(pstrPathName, *ppFileList + ii) == 0)
*pFileIndex = i;
ii += MAX_PATH;
i++;
bOk = FindNextFile(hFind, &finddata);
}
FindClose(hFind);
// finally we must sort the file-list
for (i = 0; i < *pFileCount - 1; i++)
{
ii = i * MAX_PATH;
for (j = i+1; j < *pFileCount; j++)
{
jj = j * MAX_PATH;
if (strcmp (*ppFileList + ii, *ppFileList + jj) > 0)
{
strcpy (szTmp, *ppFileList + jj);
strcpy (*ppFileList + jj, *ppFileList + ii);
strcpy (*ppFileList + ii, szTmp);
// check if this was the current image that we moved
if (*pFileIndex == i)
*pFileIndex = j;
else
if (*pFileIndex == j)
*pFileIndex = i;
}
}
}
return TRUE;
}
//----------------
// SearchPngList
//----------------
BOOL SearchPngList (
TCHAR *pFileList, int FileCount, int *pFileIndex,
PTSTR pstrPrevName, PTSTR pstrNextName)
{
if (FileCount > 0)
{
// get previous entry
if (pstrPrevName != NULL)
{
if (*pFileIndex > 0)
*pFileIndex -= 1;
else
*pFileIndex = FileCount - 1;
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
}
// get next entry
if (pstrNextName != NULL)
{
if (*pFileIndex < FileCount - 1)
*pFileIndex += 1;
else
*pFileIndex = 0;
strcpy (pstrNextName, pFileList + (*pFileIndex * MAX_PATH));
}
return TRUE;
}
else
{
return FALSE;
}
}
//-----------------
// LoadImageFile
//-----------------
BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
png_byte **ppbImage, int *pxImgSize, int *pyImgSize,
int *piChannels, png_color *pBkgColor)
{
static TCHAR szTmp [MAX_PATH];
// if there's an existing PNG, free the memory
if (*ppbImage)
{
free (*ppbImage);
*ppbImage = NULL;
}
// Load the entire PNG into memory
SetCursor (LoadCursor (NULL, IDC_WAIT));
ShowCursor (TRUE);
PngLoadImage (pstrPathName, ppbImage, pxImgSize, pyImgSize, piChannels,
pBkgColor);
ShowCursor (FALSE);
SetCursor (LoadCursor (NULL, IDC_ARROW));
if (*ppbImage != NULL)
{
sprintf (szTmp, "VisualPng - %s", strrchr(pstrPathName, '\\') + 1);
SetWindowText (hwnd, szTmp);
}
else
{
MessageBox (hwnd, TEXT ("Error in loading the PNG image"),
szProgName, MB_ICONEXCLAMATION | MB_OK);
return FALSE;
}
return TRUE;
}
//----------------
// DisplayImage
//----------------
BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
BYTE **ppDiData, int cxWinSize, int cyWinSize,
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
BOOL bStretched)
{
BYTE *pDib = *ppDib;
BYTE *pDiData = *ppDiData;
// BITMAPFILEHEADER *pbmfh;
BITMAPINFOHEADER *pbmih;
WORD wDIRowBytes;
png_color bkgBlack = {0, 0, 0};
png_color bkgGray = {127, 127, 127};
png_color bkgWhite = {255, 255, 255};
// allocate memory for the Device Independant bitmap
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;
if (pDib)
{
free (pDib);
pDib = NULL;
}
if (!(pDib = (BYTE *) malloc (sizeof(BITMAPINFOHEADER) +
wDIRowBytes * cyWinSize)))
{
MessageBox (hwnd, TEXT ("Error in displaying the PNG image"),
szProgName, MB_ICONEXCLAMATION | MB_OK);
*ppDib = pDib = NULL;
return FALSE;
}
*ppDib = pDib;
memset (pDib, 0, sizeof(BITMAPINFOHEADER));
// initialize the dib-structure
pbmih = (BITMAPINFOHEADER *) pDib;
pbmih->biSize = sizeof(BITMAPINFOHEADER);
pbmih->biWidth = cxWinSize;
pbmih->biHeight = -((long) cyWinSize);
pbmih->biPlanes = 1;
pbmih->biBitCount = 24;
pbmih->biCompression = 0;
pDiData = pDib + sizeof(BITMAPINFOHEADER);
*ppDiData = pDiData;
// first fill bitmap with gray and image border
InitBitmap (pDiData, cxWinSize, cyWinSize);
// then fill bitmap with image
if (pbImage)
{
FillBitmap (
pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels,
bStretched);
}
return TRUE;
}
//--------------
// InitBitmap
//--------------
BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
{
BYTE *dst;
int x, y, col;
// initialize the background with gray
dst = pDiData;
for (y = 0; y < cyWinSize; y++)
{
col = 0;
for (x = 0; x < cxWinSize; x++)
{
// fill with GRAY
*dst++ = 127;
*dst++ = 127;
*dst++ = 127;
col += 3;
}
// rows start on 4 byte boundaries
while ((col % 4) != 0)
{
dst++;
col++;
}
}
return TRUE;
}
//--------------
// FillBitmap
//--------------
BOOL FillBitmap (
BYTE *pDiData, int cxWinSize, int cyWinSize,
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
BOOL bStretched)
{
BYTE *pStretchedImage;
BYTE *pImg;
BYTE *src, *dst;
BYTE r, g, b, a;
const int cDIChannels = 3;
WORD wImgRowBytes;
WORD wDIRowBytes;
int cxNewSize, cyNewSize;
int cxImgPos, cyImgPos;
int xImg, yImg;
int xWin, yWin;
int xOld, yOld;
int xNew, yNew;
if (bStretched)
{
cxNewSize = cxWinSize - 2 * MARGIN;
cyNewSize = cyWinSize - 2 * MARGIN;
// stretch the image to it's window determined size
// the following two are the same, but the first has side-effects
// because of rounding
// if ((cyNewSize / cxNewSize) > (cyImgSize / cxImgSize))
if ((cyNewSize * cxImgSize) > (cyImgSize * cxNewSize))
{
cyNewSize = cxNewSize * cyImgSize / cxImgSize;
cxImgPos = MARGIN;
cyImgPos = (cyWinSize - cyNewSize) / 2;
}
else
{
cxNewSize = cyNewSize * cxImgSize / cyImgSize;
cyImgPos = MARGIN;
cxImgPos = (cxWinSize - cxNewSize) / 2;
}
pStretchedImage = malloc (cImgChannels * cxNewSize * cyNewSize);
pImg = pStretchedImage;
for (yNew = 0; yNew < cyNewSize; yNew++)
{
yOld = yNew * cyImgSize / cyNewSize;
for (xNew = 0; xNew < cxNewSize; xNew++)
{
xOld = xNew * cxImgSize / cxNewSize;
r = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 0);
g = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 1);
b = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 2);
*pImg++ = r;
*pImg++ = g;
*pImg++ = b;
if (cImgChannels == 4)
{
a = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld)
+ 3);
*pImg++ = a;
}
}
}
// calculate row-bytes
wImgRowBytes = cImgChannels * cxNewSize;
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
// copy image to screen
for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin++)
{
if (yWin >= cyWinSize - cyImgPos)
break;
src = pStretchedImage + yImg * wImgRowBytes;
dst = pDiData + yWin * wDIRowBytes + cxImgPos * cDIChannels;
for (xImg = 0, xWin = cxImgPos; xImg < cxNewSize; xImg++, xWin++)
{
if (xWin >= cxWinSize - cxImgPos)
break;
r = *src++;
g = *src++;
b = *src++;
*dst++ = b; /* note the reverse order */
*dst++ = g;
*dst++ = r;
if (cImgChannels == 4)
{
a = *src++;
}
}
}
// free memory
if (pStretchedImage != NULL)
{
free (pStretchedImage);
pStretchedImage = NULL;
}
}
// process the image not-stretched
else
{
// calculate the central position
cxImgPos = (cxWinSize - cxImgSize) / 2;
cyImgPos = (cyWinSize - cyImgSize) / 2;
// check for image larger than window
if (cxImgPos < MARGIN)
cxImgPos = MARGIN;
if (cyImgPos < MARGIN)
cyImgPos = MARGIN;
// calculate both row-bytes
wImgRowBytes = cImgChannels * cxImgSize;
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
// copy image to screen
for (yImg = 0, yWin = cyImgPos; yImg < cyImgSize; yImg++, yWin++)
{
if (yWin >= cyWinSize - MARGIN)
break;
src = pbImage + yImg * wImgRowBytes;
dst = pDiData + yWin * wDIRowBytes + cxImgPos * cDIChannels;
for (xImg = 0, xWin = cxImgPos; xImg < cxImgSize; xImg++, xWin++)
{
if (xWin >= cxWinSize - MARGIN)
break;
r = *src++;
g = *src++;
b = *src++;
*dst++ = b; /* note the reverse order */
*dst++ = g;
*dst++ = r;
if (cImgChannels == 4)
{
a = *src++;
}
}
}
}
return TRUE;
}
//-----------------
// end of source
//-----------------

View File

@ -0,0 +1,223 @@
# Microsoft Developer Studio Project File - Name="VisualPng" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# Copyright 2000, Willem van Schaik. For conditions of distribution and
# use, see the copyright/license/disclaimer notice in png.h
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=VisualPng - Win32 Debug LIB
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "VisualPng.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "VisualPng.mak" CFG="VisualPng - Win32 Debug LIB"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "VisualPng - Win32 DLL" (based on "Win32 (x86) Application")
!MESSAGE "VisualPng - Win32 Debug DLL" (based on "Win32 (x86) Application")
!MESSAGE "VisualPng - Win32 LIB" (based on "Win32 (x86) Application")
!MESSAGE "VisualPng - Win32 Debug LIB" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "VisualPng - Win32 DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "VisualPng___Win32_DLL"
# PROP BASE Intermediate_Dir "VisualPng___Win32_DLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "dll"
# PROP Intermediate_Dir "dll"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /I "libpng" /I "zlib" /D "PNG_USE_DLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_USE_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 libpng1.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib"
# ADD LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\msvc\win32\libpng\dll"
# Begin Special Build Tool
OutDir=.\dll
SOURCE="$(InputPath)"
PostBuild_Cmds=set path=..\..\msvc\win32\libpng\dll;..\..\msvc\win32\zlib\dll; $(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
# End Special Build Tool
!ELSEIF "$(CFG)" == "VisualPng - Win32 Debug DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "VisualPng___Win32_Debug_DLL"
# PROP BASE Intermediate_Dir "VisualPng___Win32_Debug_DLL"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "dll_dbg"
# PROP Intermediate_Dir "dll_dbg"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "libpng" /I "zlib" /D "PNG_USE_DLL" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_USE_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 libpng1.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib"
# SUBTRACT BASE LINK32 /nodefaultlib
# ADD LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\msvc\win32\libpng\dll_dbg"
# SUBTRACT LINK32 /nodefaultlib
# Begin Special Build Tool
OutDir=.\dll_dbg
SOURCE="$(InputPath)"
PostBuild_Cmds=set path=..\..\msvc\win32\libpng\dll_dbg;..\..\msvc\win32\zlib\dll_dbg; $(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
# End Special Build Tool
!ELSEIF "$(CFG)" == "VisualPng - Win32 LIB"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "VisualPng___Win32_LIB"
# PROP BASE Intermediate_Dir "VisualPng___Win32_LIB"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "lib"
# PROP Intermediate_Dir "lib"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_USE_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\msvc\win32\libpng\dll"
# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\msvc\win32\libpng\lib"
# Begin Special Build Tool
OutDir=.\lib
SOURCE="$(InputPath)"
PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
# End Special Build Tool
!ELSEIF "$(CFG)" == "VisualPng - Win32 Debug LIB"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "VisualPng___Win32_Debug_LIB"
# PROP BASE Intermediate_Dir "VisualPng___Win32_Debug_LIB"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "lib_dbg"
# PROP Intermediate_Dir "lib_dbg"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_USE_DLL" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\libpng" /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\msvc\win32\libpng\dll_dbg"
# SUBTRACT BASE LINK32 /nodefaultlib
# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\msvc\win32\libpng\lib_dbg"
# SUBTRACT LINK32 /nodefaultlib
# Begin Special Build Tool
OutDir=.\lib_dbg
SOURCE="$(InputPath)"
PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
# End Special Build Tool
!ENDIF
# Begin Target
# Name "VisualPng - Win32 DLL"
# Name "VisualPng - Win32 Debug DLL"
# Name "VisualPng - Win32 LIB"
# Name "VisualPng - Win32 Debug LIB"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\PngFile.c
# End Source File
# Begin Source File
SOURCE=.\VisualPng.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\cexcept.h
# End Source File
# Begin Source File
SOURCE=.\PngFile.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\VisualPng.ico
# End Source File
# Begin Source File
SOURCE=.\VisualPng.rc
# End Source File
# End Group
# End Target
# End Project

View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "VisualPng"=.\VisualPng.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

View File

@ -0,0 +1,152 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
VISUALPNG MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open Image...\tCtrl+O", IDM_FILE_OPEN
MENUITEM "Save &As...", IDM_FILE_SAVE
MENUITEM SEPARATOR
MENUITEM "&Next Image\tCtrl+N", IDM_FILE_NEXT
MENUITEM "Pre&vious Image\tCtrl+V", IDM_FILE_PREVIOUS
MENUITEM SEPARATOR
MENUITEM "E&xit\tAlt+X", IDM_FILE_EXIT
END
POPUP "&Options"
BEGIN
MENUITEM "&Stretch", IDM_OPTIONS_STRETCH, CHECKED
END
POPUP "&Help"
BEGIN
MENUITEM "&About", IDM_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
VISUALPNG ACCELERATORS DISCARDABLE
BEGIN
"N", IDM_FILE_NEXT, VIRTKEY, CONTROL, NOINVERT
"O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"P", IDM_FILE_PREVIOUS, VIRTKEY, CONTROL, NOINVERT
"V", IDM_FILE_PREVIOUS, VIRTKEY, CONTROL, NOINVERT
"X", IDM_FILE_EXIT, VIRTKEY, ALT, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
VISUALPNG ICON DISCARDABLE "VisualPng.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
ABOUTBOX DIALOG DISCARDABLE 0, 0, 186, 94
STYLE DS_MODALFRAME | WS_POPUP
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,68,67,50,14
CTEXT "VisualPng 1.0 - June 2000",IDC_STATIC,49,14,88,8
LTEXT "a PNG image viewer",IDC_STATIC,60,30,66,8
LTEXT "(c) Willem van Schaik, 2000",IDC_STATIC,48,52,90,8
LTEXT "to demonstrate the use of libpng in Visual C",
IDC_STATIC,25,38,136,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"ABOUTBOX", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 87
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

244
contrib/visupng/cexcept.h Normal file
View File

@ -0,0 +1,244 @@
/*===
cexcept.h 1.0.0 (2000-Jun-21-Wed)
Adam M. Costello <amc@cs.berkeley.edu>
An interface for exception-handling in ANSI C, developed jointly with
Cosmin Truta <cosmin@cs.toronto.edu>.
Copyright (c) 2000 Adam M. Costello and Cosmin Truta. Everyone
is hereby granted permission to do whatever they like with this
file, provided that if they modify it they take reasonable steps to
avoid confusing or misleading people about the authors, version,
and terms of use of the derived file. The copyright holders make
no guarantees about the correctness of this file, and are not
responsible for any damage resulting from its use.
If this interface is used by multiple .c files, they shouldn't include
this header file directly. Instead, create a wrapper header file that
includes this header file and then invokes the define_exception_type
macro (see below), and let your .c files include that header file.
The interface consists of one type, one well-known name, and six macros.
define_exception_type(type_name);
This macro is used like an external declaration. It specifies
the type of object that gets copied from the exception thrower to
the exception catcher. The type_name can be any type that can be
assigned to, that is, a non-constant arithmetic type, struct, union,
or pointer. Examples:
define_exception_type(int);
enum exception { out_of_memory, bad_arguments, disk_full };
define_exception_type(enum exception);
struct exception { int code; const char *msg; };
define_exception_type(struct exception);
struct exception_context;
This type may be used after the define_exception_type() macro has
been invoked. A struct exception_context must be known to both
the thrower and the catcher. It is expected that there be one
context for each thread that uses exceptions. It would certainly
be dangerous for multiple threads to access the same context.
One thread can use multiple contexts, but that is likely to be
confusing and not typically useful. The application can allocate
this structure in any way it pleases--automatic, static, or dynamic.
The application programmer should pretend not to know the structure
members, which are subject to change.
struct exception_context *the_exception_context;
The Try/Catch and Throw statements (described below) implicitly
refer to a context, using the name the_exception_context. It is
the application's responsibility to make sure that this name yields
the address of a mutable (non-constant) struct exception_context
wherever those statements are used. Subject to that constraint, the
application may declare a variable of this name anywhere it likes
(inside a function, in a parameter list, or externally), and may
use whatever storage class specifiers (static, extern, etc) or type
qualifiers (const, volatile) it likes. Examples:
static struct exception_context
* const the_exception_context = &foo;
{ struct exception_context *the_exception_context = bar; ... }
int blah(struct exception_context *the_exception_context, ...);
extern struct exception_context the_exception_context[1];
The last example illustrates a trick that avoids creating a pointer
object separate from the structure object.
The name could even be a macro, for example:
struct exception_context ec_array[numthreads];
#define the_exception_context (ec_array + thread_id)
Be aware that the_exception_context is used several times by the
Try/Catch/Throw macros, so it shouldn't be expensive or have side
effects. The expansion must be a drop-in replacement for an
identifier, so it's safest to put parentheses around it.
void init_exception_context(struct exception_context *ec);
For context structures allocated statically (by an external
definition or using the "static" keyword), the implicit
initialization to all zeros is sufficient, but contexts allocated
by other means must be initialized using this macro before they
are used by a Try/Catch statement. It does no harm to initialize
a context more than once (by using this macro on a statically
allocated context, or using this macro twice on the same context),
but a context must not be re-initialized after it has been used by a
Try/Catch statement.
Try statement
Catch (expression) statement
The Try/Catch/Throw macros are capitalized in order to avoid
confusion with the C++ keywords, which have subtly different
semantics.
A Try/Catch statement has a syntax similar to an if/else
statement, except that the parenthesized expression goes after
the second keyword rather than the first. As with if/else,
there are two clauses, each of which may be a simple statement
ending with a semicolon or a brace-enclosed compound statement.
But whereas the else clause is optional, the Catch clause is
required. The expression must be a modifiable lvalue (something
capable of being assigned to) of the exact same type passed to
define_exception_type().
If a Throw that uses the same exception context as the Try/Catch is
executed within the Try clause (typically within a function called
by the Try clause), and the exception is not caught by a nested
Try/Catch statement, then a copy of the exception will be assigned
to the expression, and control will jump to the Catch clause. If no
such Throw is executed, then the assignment is not performed, and
the Catch clause is not executed.
Regardless of whether an exception is caught, the expression is
always evaluated exactly once, which is significant if it has side
effects, for example:
Try foo();
Catch (p[++i].e) { ... }
IMPORTANT: Jumping into or out of a Try clause (for example via
return, break, continue, goto, longjmp) is forbidden--the compiler
will not complain, but bad things will happen at run-time. Jumping
into or out of a Catch clause is okay, and so is jumping around
inside a Try clause. In many cases where one is tempted to return
from a Try clause, it will suffice to use Throw, and then return
from the Catch clause. Another option is to set a flag variable and
use goto to jump to the end of the Try clause, then check the flag
after the Try/Catch statement.
IMPORTANT: The values of any non-volatile automatic variables
changed within the Try clause are undefined after an exception is
caught. Therefore, variables modified inside the Try block whose
values are needed later outside the Try block must either use static
storage or be declared with the "volatile" type qualifier.
Throw expression;
A Throw statement is very much like a return statement, except that
the expression is required. Whereas return jumps back to the place
where the current function was called, Throw jumps back to the Catch
clause of the innermost enclosing Try clause. The expression must
be compatible with the type passed to define_exception_type(). The
exception must be caught, otherwise the program may crash.
Slight limitation: If the expression is a comma-expression it must
be enclosed in parentheses.
Try statement
Catch_anonymous statement
When the value of the exception is not needed, a Try/Catch statement
can use Catch_anonymous instead of Catch (expression).
Everything below this point is for the benefit of the compiler. The
application programmer should pretend not to know any of it, because it
is subject to change.
===*/
#ifndef CEXCEPT_H
#define CEXCEPT_H
#include <setjmp.h>
#define define_exception_type(etype) \
struct exception__state { \
etype *exception; \
jmp_buf env; \
}
struct exception_context { \
struct exception__state *last; \
int caught; \
};
#define init_exception_context(ec) ((void)((ec)->last = 0))
#define Catch(e) exception__catch(&(e))
#define Catch_anonymous exception__catch(0)
#define Try \
{ \
struct exception__state *exception__p, exception__s; \
int exception__i; \
exception__p = the_exception_context->last; \
the_exception_context->last = &exception__s; \
for (exception__i = 0; ; exception__i = 1) \
if (exception__i) { \
if (setjmp(exception__s.env) == 0) { \
if (&exception__s)
#define exception__catch(e_addr) \
else { } \
the_exception_context->caught = 0; \
} \
else the_exception_context->caught = 1; \
the_exception_context->last = exception__p; \
break; \
} \
else exception__s.exception = e_addr; \
} \
if (!the_exception_context->caught) { } \
else
/* Try ends with if(), and Catch begins and ends with else. This */
/* ensures that the Try/Catch syntax is really the same as the */
/* if/else syntax. */
/* */
/* We use &exception__s instead of 1 to appease compilers that */
/* warn about constant expressions inside if(). Most compilers */
/* should still recognize that &exception__s is never zero and avoid */
/* generating test code. */
/* */
/* We use the variable exception__i to start the loop at the bottom, */
/* rather than jump into the loop using a switch statement, to */
/* appease compilers that warn about jumping into loops. */
#define Throw \
for (;; longjmp(the_exception_context->last->env, 1)) \
if (the_exception_context->last->exception) \
*the_exception_context->last->exception =
#endif /* CEXCEPT_H */

View File

@ -0,0 +1,23 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by VisualPng.rc
//
#define IDM_FILE_OPEN 40001
#define IDM_FILE_SAVE 40002
#define IDM_FILE_NEXT 40003
#define IDM_FILE_PREVIOUS 40004
#define IDM_FILE_EXIT 40005
#define IDM_OPTIONS_BACKGROUND 40006
#define IDM_OPTIONS_STRETCH 40007
#define IDM_HELP_ABOUT 40008
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_COMMAND_VALUE 40009
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "June 4, 2000" .TH LIBPNG 3 "June 24, 2000"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta16 libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta17
.SH SYNOPSIS .SH SYNOPSIS
\fI\fB \fI\fB
@ -747,7 +747,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.7beta16 - June 4, 2000 libpng version 1.0.7beta17 - June 24, 2000
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu> <randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -3379,13 +3379,13 @@ application:
.SH VII. Y2K Compliance in libpng .SH VII. Y2K Compliance in libpng
June 4, 2000 June 24, 2000
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.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.7beta16 are Y2K compliant. It is my belief that earlier upward through 1.0.7beta17 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that
@ -3526,7 +3526,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.7beta16 - June 4, 2000: Libpng version 1.0.7beta17 - June 24, 2000:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu). Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
@ -3541,7 +3541,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.89c, May 1996, through 0.96, May 1997) (libpng versions 0.89c, May 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.7beta16, June 4, 2000) (libpng versions 0.97, January 1998, through 1.0.7beta17, June 24, 2000)
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: is defined as the following set of individuals:

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.7beta16 - June 4, 2000 libpng version 1.0.7beta17 - June 24, 2000
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu> <randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -2632,13 +2632,13 @@ application:
VII. Y2K Compliance in libpng VII. Y2K Compliance in libpng
June 4, 2000 June 24, 2000
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.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.7beta16 are Y2K compliant. It is my belief that earlier upward through 1.0.7beta17 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "June 4, 2000" .TH LIBPNGPF 3 "June 24, 2000"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta16 libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta17
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP \fB#include <png.h>\fP

View File

@ -1,5 +1,5 @@
Microsoft Developer Studio Build File, Format Version 6.00 for Microsoft Developer Studio Build File, Format Version 6.00 for
libpng 1.0.7beta16 (June 4, 2000) and zlib libpng 1.0.7beta17 (June 24, 2000) and zlib
Copyright (C) 2000 Simon-Pierre Cadieux Copyright (C) 2000 Simon-Pierre Cadieux
For conditions of distribution and use, see copyright notice in png.h For conditions of distribution and use, see copyright notice in png.h

View File

@ -19,11 +19,11 @@ CFG=libpng - Win32 DLL
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "libpng - Win32 DLL" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "libpng - Win32 DLL" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "libpng - Win32 Debug DLL" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "libpng - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "libpng - Win32 ASM DLL" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "libpng - Win32 DLL ASM" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "libpng - Win32 Debug ASM DLL" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "libpng - Win32 DLL Debug ASM" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "libpng - Win32 LIB" (based on "Win32 (x86) Static Library") !MESSAGE "libpng - Win32 LIB" (based on "Win32 (x86) Static Library")
!MESSAGE "libpng - Win32 Debug LIB" (based on "Win32 (x86) Static Library") !MESSAGE "libpng - Win32 LIB Debug" (based on "Win32 (x86) Static Library")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
@ -59,7 +59,7 @@ LINK32=link.exe
# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng1.dll" # ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng1.dll"
# SUBTRACT LINK32 /pdb:none # SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "libpng - Win32 Debug DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
@ -86,7 +86,7 @@ LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbg\libpng1d.dll" # ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbg\libpng1d.dll"
!ELSEIF "$(CFG)" == "libpng - Win32 ASM DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
@ -105,16 +105,16 @@ CPP=cl.exe
MTL=midl.exe MTL=midl.exe
RSC=rc.exe RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /i ".." /d "NDEBUG" # ADD RSC /l 0x409 /i ".." /d "NDEBUG" /d "PNG_USE_PNGVCRD"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386 # ADD BASE LINK32 /nologo /dll /machine:I386
# ADD LINK32 .\win32\zlib\dll\zlib.lib /nologo /dll /machine:I386 /out:".\win32\libpng\dll_asm\libpng1a.dll" # ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_asm\libpng1a.dll"
# SUBTRACT LINK32 /pdb:none # SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "libpng - Win32 Debug ASM DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug ASM"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
@ -133,13 +133,13 @@ CPP=cl.exe
MTL=midl.exe MTL=midl.exe
RSC=rc.exe RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /i ".." /d "_DEBUG" /d PNG_DEBUG=1 # ADD RSC /l 0x409 /i ".." /d "_DEBUG" /d PNG_DEBUG=1 /d "PNG_USE_PNGVCRD"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 .\win32\zlib\dll_dbg\zlibd.lib /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbga\libpng1b.dll" # ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbga\libpng1b.dll"
!ELSEIF "$(CFG)" == "libpng - Win32 LIB" !ELSEIF "$(CFG)" == "libpng - Win32 LIB"
@ -167,7 +167,7 @@ LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo # ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "libpng - Win32 Debug LIB" !ELSEIF "$(CFG)" == "libpng - Win32 LIB Debug"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
@ -198,11 +198,11 @@ LIB32=link.exe -lib
# Begin Target # Begin Target
# Name "libpng - Win32 DLL" # Name "libpng - Win32 DLL"
# Name "libpng - Win32 Debug DLL" # Name "libpng - Win32 DLL Debug"
# Name "libpng - Win32 ASM DLL" # Name "libpng - Win32 DLL ASM"
# Name "libpng - Win32 Debug ASM DLL" # Name "libpng - Win32 DLL Debug ASM"
# Name "libpng - Win32 LIB" # Name "libpng - Win32 LIB"
# Name "libpng - Win32 Debug LIB" # Name "libpng - Win32 LIB Debug"
# Begin Group "Source Files" # Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@ -217,17 +217,17 @@ SOURCE=.\png.rc
!IF "$(CFG)" == "libpng - Win32 DLL" !IF "$(CFG)" == "libpng - Win32 DLL"
!ELSEIF "$(CFG)" == "libpng - Win32 Debug DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
!ELSEIF "$(CFG)" == "libpng - Win32 ASM DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM"
!ELSEIF "$(CFG)" == "libpng - Win32 Debug ASM DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug ASM"
!ELSEIF "$(CFG)" == "libpng - Win32 LIB" !ELSEIF "$(CFG)" == "libpng - Win32 LIB"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 Debug LIB" !ELSEIF "$(CFG)" == "libpng - Win32 LIB Debug"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
@ -240,17 +240,17 @@ SOURCE=.\png32ms.def
!IF "$(CFG)" == "libpng - Win32 DLL" !IF "$(CFG)" == "libpng - Win32 DLL"
!ELSEIF "$(CFG)" == "libpng - Win32 Debug DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
!ELSEIF "$(CFG)" == "libpng - Win32 ASM DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM"
!ELSEIF "$(CFG)" == "libpng - Win32 Debug ASM DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug ASM"
!ELSEIF "$(CFG)" == "libpng - Win32 LIB" !ELSEIF "$(CFG)" == "libpng - Win32 LIB"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 Debug LIB" !ELSEIF "$(CFG)" == "libpng - Win32 LIB Debug"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
@ -306,19 +306,19 @@ SOURCE=..\pngvcrd.c
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 Debug DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 ASM DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM"
!ELSEIF "$(CFG)" == "libpng - Win32 Debug ASM DLL" !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug ASM"
!ELSEIF "$(CFG)" == "libpng - Win32 LIB" !ELSEIF "$(CFG)" == "libpng - Win32 LIB"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 Debug LIB" !ELSEIF "$(CFG)" == "libpng - Win32 LIB Debug"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1

View File

@ -12,6 +12,14 @@
# error PRIVATEBUILD or SPECIALBUILD must be defined as a string describing the type of change brought to the standard library # error PRIVATEBUILD or SPECIALBUILD must be defined as a string describing the type of change brought to the standard library
#endif /* defined(DLLFNAME_POSTFIX)... */ #endif /* defined(DLLFNAME_POSTFIX)... */
#if !defined(DLLFNAME_POSTFIX) && defined(PNG_USE_PNGVCRD)
# if defined(PNG_DEBUG) && (PNG_DEBUG > 0)
# define DLLFNAME_POSTFIX "B"
# else
# define DLLFNAME_POSTFIX "A"
# endif /* !defined(DLLFNAME_POSTFIX)... */
#endif
#if defined(PNG_DEBUG) && (PNG_DEBUG > 0) #if defined(PNG_DEBUG) && (PNG_DEBUG > 0)
# define VS_DEBUG VS_FF_DEBUG # define VS_DEBUG VS_FF_DEBUG
# ifndef DLLFNAME_POSTFIX # ifndef DLLFNAME_POSTFIX
@ -22,7 +30,9 @@
# endif /* COMMENTS */ # endif /* COMMENTS */
#else #else
# define VS_DEBUG 0 # define VS_DEBUG 0
# ifndef DLLFNAME_POSTFIX
# define DLLFNAME_POSTFIX # define DLLFNAME_POSTFIX
# endif /* DLLFNAME_POSTFIX */
#endif /* defined(DEBUG)... */ #endif /* defined(DEBUG)... */
#ifdef PRIVATEBUILD #ifdef PRIVATEBUILD
@ -54,7 +64,7 @@ BEGIN
VALUE "FileDescription", "PNG image compression library\000" VALUE "FileDescription", "PNG image compression library\000"
VALUE "FileVersion", PNG_LIBPNG_VER_STRING "\000" VALUE "FileVersion", PNG_LIBPNG_VER_STRING "\000"
VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_MAJOR) DLLFNAME_POSTFIX " (Windows 32 bit)\000" VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_MAJOR) DLLFNAME_POSTFIX " (Windows 32 bit)\000"
VALUE "LegalCopyright", "Copyright 1998-2000 Glenn Randers-Pehrson\000" VALUE "LegalCopyright", "\251 1998-2000 Glenn Randers-Pehrson\000"
VALUE "OriginalFilename", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_MAJOR) DLLFNAME_POSTFIX ".DLL\000" VALUE "OriginalFilename", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_MAJOR) DLLFNAME_POSTFIX ".DLL\000"
#ifdef PRIVATEBUILD #ifdef PRIVATEBUILD
VALUE "PrivateBuild", PRIVATEBUILD VALUE "PrivateBuild", PRIVATEBUILD

View File

@ -1,12 +1,12 @@
;------------------------------------------ ;------------------------------------------
; PNGLIB module definition file for Windows ; LIBPNG module definition file for Windows
;------------------------------------------ ;------------------------------------------
LIBRARY LIBRARY
DESCRIPTION "PNG image compression library for Windows" DESCRIPTION "PNG image compression library for Windows"
EXPORTS EXPORTS
;Version 1.0.7beta16 ;Version 1.0.7beta17
png_build_grayscale_palette @1 png_build_grayscale_palette @1
png_check_sig @2 png_check_sig @2
png_chunk_error @3 png_chunk_error @3

View File

@ -19,9 +19,11 @@ CFG=zlib - Win32 DLL
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "zlib - Win32 DLL" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "zlib - Win32 DLL" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "zlib - Win32 Debug DLL" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "zlib - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "zlib - Win32 DLL ASM" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "zlib - Win32 DLL Debug ASM" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "zlib - Win32 LIB" (based on "Win32 (x86) Static Library") !MESSAGE "zlib - Win32 LIB" (based on "Win32 (x86) Static Library")
!MESSAGE "zlib - Win32 Debug LIB" (based on "Win32 (x86) Static Library") !MESSAGE "zlib - Win32 LIB Debug" (based on "Win32 (x86) Static Library")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
@ -53,11 +55,11 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD BASE LINK32 /nologo /dll /machine:I386
# ADD LINK32 /nologo /dll /machine:I386 # ADD LINK32 /nologo /dll /machine:I386
# SUBTRACT LINK32 /pdb:none # SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "zlib - Win32 Debug DLL" !ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
@ -81,9 +83,64 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\zlib\dll_dbg\zlibd.dll" # ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\zlib\dll_dbg\zlibd.dll"
!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\win32\zlib\dll_asm"
# PROP Intermediate_Dir ".\win32\zlib\dll_asm"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /c
# ADD CPP /nologo /MD /W3 /O1 /I "..\..\zlib" /D "NDEBUG" /D "WIN32" /D "_WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FD /c
MTL=midl.exe
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /i ".." /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386
# ADD LINK32 gvmat32.obj /nologo /dll /machine:I386 /out:".\win32\zlib\dll_asm\zliba.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug ASM"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\win32\zlib\dll_dbga"
# PROP Intermediate_Dir ".\win32\zlib\dll_dbga"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Zi /Od /I "..\..\zlib" /D "_DEBUG" /D "WIN32" /D "_WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FD /GZ /c
MTL=midl.exe
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /i ".." /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 gvmat32d.obj /nologo /dll /debug /machine:I386 /out:".\win32\zlib\dll_dbga\zlibb.dll"
!ELSEIF "$(CFG)" == "zlib - Win32 LIB" !ELSEIF "$(CFG)" == "zlib - Win32 LIB"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
@ -110,7 +167,7 @@ LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo # ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "zlib - Win32 Debug LIB" !ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
@ -141,9 +198,11 @@ LIB32=link.exe -lib
# Begin Target # Begin Target
# Name "zlib - Win32 DLL" # Name "zlib - Win32 DLL"
# Name "zlib - Win32 Debug DLL" # Name "zlib - Win32 DLL Debug"
# Name "zlib - Win32 DLL ASM"
# Name "zlib - Win32 DLL Debug ASM"
# Name "zlib - Win32 LIB" # Name "zlib - Win32 LIB"
# Name "zlib - Win32 Debug LIB" # Name "zlib - Win32 LIB Debug"
# Begin Group "Source Files" # Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@ -165,6 +224,33 @@ SOURCE=..\..\zlib\deflate.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\zlib\contrib\asm386\gvmat32c.c
!IF "$(CFG)" == "zlib - Win32 DLL"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM"
!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug ASM"
!ELSEIF "$(CFG)" == "zlib - Win32 LIB"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\zlib\gzio.c SOURCE=..\..\zlib\gzio.c
# ADD CPP /Yc"zutil.h" # ADD CPP /Yc"zutil.h"
# End Source File # End Source File
@ -212,13 +298,17 @@ SOURCE=.\zlib.def
!IF "$(CFG)" == "zlib - Win32 DLL" !IF "$(CFG)" == "zlib - Win32 DLL"
!ELSEIF "$(CFG)" == "zlib - Win32 Debug DLL" !ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM"
!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug ASM"
!ELSEIF "$(CFG)" == "zlib - Win32 LIB" !ELSEIF "$(CFG)" == "zlib - Win32 LIB"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "zlib - Win32 Debug LIB" !ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
@ -231,13 +321,17 @@ SOURCE=..\..\zlib\msdos\zlib.rc
!IF "$(CFG)" == "zlib - Win32 DLL" !IF "$(CFG)" == "zlib - Win32 DLL"
!ELSEIF "$(CFG)" == "zlib - Win32 Debug DLL" !ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM"
!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug ASM"
!ELSEIF "$(CFG)" == "zlib - Win32 LIB" !ELSEIF "$(CFG)" == "zlib - Win32 LIB"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "zlib - Win32 Debug LIB" !ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "June 4, 2000" .TH PNG 5 "June 24, 2000"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION

12
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* libpng version 1.0.7beta16 - June 4, 2000 * libpng version 1.0.7beta17 - June 24, 2000
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -14,14 +14,14 @@
#include "png.h" #include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_7beta16 Your_png_h_is_not_version_1_0_7beta16; typedef version_1_0_7beta17 Your_png_h_is_not_version_1_0_7beta17;
/* 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. */
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */ /* png_libpng_ver was changed to a function in version 1.0.5c */
char png_libpng_ver[12] = "1.0.7beta16"; char png_libpng_ver[12] = "1.0.7beta17";
/* png_sig was changed to a function in version 1.0.5c */ /* 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. */
@ -605,7 +605,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */ if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
return ("\n libpng version 1.0.7beta16 - June 4, 2000\n\ return ("\n libpng version 1.0.7beta17 - June 24, 2000\n\
Copyright (c) 1998-2000 Glenn Randers-Pehrson\n\ Copyright (c) 1998-2000 Glenn Randers-Pehrson\n\
Copyright (c) 1996, 1997 Andreas Dilger\n\ Copyright (c) 1996, 1997 Andreas Dilger\n\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n"); Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
@ -623,8 +623,8 @@ png_get_libpng_ver(png_structp png_ptr)
{ {
/* Version of *.c files used when building libpng */ /* Version of *.c files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return("1.0.7beta16"); return("1.0.7beta17");
return("1.0.7beta16"); return("1.0.7beta17");
} }
png_charp PNGAPI png_charp PNGAPI

32
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.0.7beta16 - June 4, 2000 * libpng version 1.0.7beta17 - June 24, 2000
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -9,7 +9,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.7beta16 - June 4, 2000: Glenn * libpng versions 0.97, January 1998, through 1.0.7beta17 - June 24, 2000: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -52,9 +52,9 @@
* 1.0.6h 10007 10.6h (testing xy.z so-numbering) * 1.0.6h 10007 10.6h (testing xy.z so-numbering)
* 1.0.6i 10007 10.6i * 1.0.6i 10007 10.6i
* 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
* 1.0.7beta11-16 10007 2.1.0.7beta11-16 (binary compatible) * 1.0.7beta11-17 10007 2.1.0.7beta11-17 (binary compatible)
* 1.0.7rc1-2 10007 2.1.0.7rc1-2 (binary compatible)
* planned: * planned:
* 1.0.7rc1 10007 2.1.0.7rc1 (binary compatible)
* 1.0.6patch4 (w/4 patches) 10006 2.1.0.6 (binary compatible) * 1.0.6patch4 (w/4 patches) 10006 2.1.0.6 (binary compatible)
* 1.0.7 10007 (still compatible) * 1.0.7 10007 (still compatible)
* *
@ -83,7 +83,7 @@
* If you modify libpng you may insert additional notices immediately following * If you modify libpng you may insert additional notices immediately following
* this sentence. * this sentence.
* *
* libpng versions 1.0.6, March 20, 2000, through 1.0.7beta16, June 4, 2000, are * libpng versions 1.0.6, March 20, 2000, through 1.0.7beta17, June 24, 2000, are
* Copyright (c) 2000 Glenn Randers-Pehrson * Copyright (c) 2000 Glenn Randers-Pehrson
* Distributed according to the same disclaimer and license as libpng-1.0.5 * Distributed according to the same disclaimer and license as libpng-1.0.5
* with the following individuals added to the list of Contributing Authors: * with the following individuals added to the list of Contributing Authors:
@ -179,13 +179,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* June 4, 2000 * June 24, 2000
* *
* 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.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.0.7beta16 are Y2K compliant. It is my belief that earlier * upward through 1.0.7beta17 are Y2K compliant. It is my belief that earlier
* versions were 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
@ -231,8 +231,8 @@
* PNG Development Group * PNG Development Group
*/ */
#ifndef _PNG_H #ifndef PNG_H
#define _PNG_H #define PNG_H
/* This is not the place to learn how to use libpng. The file libpng.txt /* This is not the place to learn how to use libpng. The file libpng.txt
* describes how to use libpng, and the file example.c summarizes it * describes how to use libpng, and the file example.c summarizes it
@ -241,7 +241,7 @@
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.7beta16" #define PNG_LIBPNG_VER_STRING "1.0.7beta17"
#define PNG_LIBPNG_VER_SONUM 2 #define PNG_LIBPNG_VER_SONUM 2
@ -251,7 +251,7 @@
#define PNG_LIBPNG_VER_RELEASE 7 #define PNG_LIBPNG_VER_RELEASE 7
/* This should match the numeric part of the final component of /* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */ * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
#define PNG_LIBPNG_VER_BUILD 16 #define PNG_LIBPNG_VER_BUILD 17
/* Careful here. At one time, Guy wanted to use 082, but that would be octal. /* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros. * We must not include leading zeros.
@ -892,7 +892,7 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ #define PNG_TRANSFORM_BGR 0x0080 /* read and write */
#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
#define PNG_TRANSFORM_INVERT_ALPHA 0x0200 /* read and write */ #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t)); typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
@ -1140,9 +1140,9 @@ struct png_struct_def
}; };
/* This prevents a compiler error in png_get_copyright() in png.c if png.c /* This prevents a compiler error in png_get_copyright() in png.c if png.c
and png.h are both at * version 1.0.7beta16 and png.h are both at * version 1.0.7beta17
*/ */
typedef png_structp version_1_0_7beta16; typedef png_structp version_1_0_7beta17;
typedef png_struct FAR * FAR * png_structpp; typedef png_struct FAR * FAR * png_structpp;
@ -2161,7 +2161,7 @@ extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)
extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.7beta16 - June 4, 2000 (header)\n" " libpng version 1.0.7beta17 - June 24, 2000 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on /* With these routines we avoid an integer divide, which will be slower on
@ -2955,4 +2955,4 @@ PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
#endif /* PNG_VERSION_INFO_ONLY */ #endif /* PNG_VERSION_INFO_ONLY */
/* do not put anything past this line */ /* do not put anything past this line */
#endif /* _PNG_H */ #endif /* PNG_H */

View File

@ -1,11 +1,14 @@
/* pngasmrd.h - assembler version of utilities to read a PNG file /* pngasmrd.h - assembler version of utilities to read a PNG file
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1999, 2000 Glenn Randers-Pehrson
* *
*/ */
#ifndef PNGASMRD_H
#define PNGASMRD_H
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED #ifdef PNG_ASSEMBLER_CODE_SUPPORTED
/* Set this in the makefile for VC++ on Pentium, not in pngconf.h */ /* Set this in the makefile for VC++ on Pentium, not in pngconf.h */
@ -33,3 +36,4 @@
*/ */
#endif #endif
#endif /* PNGASMRD_H */

View File

@ -1,6 +1,6 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -133,7 +133,7 @@
# ifdef __linux__ # ifdef __linux__
# ifdef _BSD_SOURCE # ifdef _BSD_SOURCE
# define _PNG_SAVE_BSD_SOURCE # define PNG_SAVE_BSD_SOURCE
# undef _BSD_SOURCE # undef _BSD_SOURCE
# endif # endif
# ifdef _SETJMP_H # ifdef _SETJMP_H
@ -146,9 +146,9 @@
#include <setjmp.h> #include <setjmp.h>
# ifdef __linux__ # ifdef __linux__
# ifdef _PNG_SAVE_BSD_SOURCE # ifdef PNG_SAVE_BSD_SOURCE
# define _BSD_SOURCE # define _BSD_SOURCE
# undef _PNG_SAVE_BSD_SOURCE # undef PNG_SAVE_BSD_SOURCE
# endif # endif
# endif /* __linux__ */ # endif /* __linux__ */
#endif /* PNG_SETJMP_SUPPORTED */ #endif /* PNG_SETJMP_SUPPORTED */
@ -950,7 +950,15 @@ typedef z_stream FAR * png_zstreamp;
# endif # endif
#endif #endif
#if defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) #ifndef PNGAPI
#if defined(__MINGW32__) || defined(__CYGWIN32__) && !defined(PNG_MODULEDEF)
# ifndef PNG_NO_MODULEDEF
# define PNG_NO_MODULEDEF
# endif
#endif
#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
# define PNG_IMPEXP # define PNG_IMPEXP
#endif #endif
@ -958,7 +966,11 @@ typedef z_stream FAR * png_zstreamp;
defined(_Windows) || defined(_WINDOWS) || \ defined(_Windows) || defined(_WINDOWS) || \
defined(WIN32) || defined(_WIN32) || defined(__WIN32__) defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# ifdef __GNUC__
# define PNGAPI __cdecl
# else
# define PNGAPI _cdecl # define PNGAPI _cdecl
# endif
# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ # if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
@ -994,19 +1006,17 @@ typedef z_stream FAR * png_zstreamp;
# endif # endif
# endif # endif
# endif /* PNG_IMPEXP */ # endif /* PNG_IMPEXP */
#else #else /* !(DLL || WINDOWS) */
# if 0 /* ... other platforms, with other meanings */ # if 0 /* ... other platforms, with other meanings */
# else # else
# define PNGAPI # define PNGAPI
# define PNG_IMPEXP
# endif # endif
#endif #endif
#endif
#ifndef PNG_EXPORT #ifndef PNG_EXPORT
# define PNG_EXPORT(type,symbol) type PNGAPI symbol # define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
#endif
#if defined(__MINGW32__) || defined(__CYGWIN32__)
# define PNG_ATTR_DLLIMP
#endif #endif
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -6,7 +6,7 @@
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code. * for Intel's performance analysis of the MMX vs. non-MMX code.
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, Intel Corporation
@ -43,8 +43,8 @@
*/ */
/* /*
* GRR NOTES * NOTES (mostly by Greg Roelofs)
* ========= * =====
* *
* 19991006: * 19991006:
* - fixed sign error in post-MMX cleanup code (16- & 32-bit cases) * - fixed sign error in post-MMX cleanup code (16- & 32-bit cases)
@ -125,9 +125,10 @@
* 20000319: * 20000319:
* - fixed a register-name typo in png_do_read_interlace(), default (MMX) case, * - fixed a register-name typo in png_do_read_interlace(), default (MMX) case,
* pass == 4 or 5, that caused visible corruption of interlaced images * pass == 4 or 5, that caused visible corruption of interlaced images
*
* - When compiling with gcc, be sure to use -fomit-frame-pointer
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
@ -143,8 +144,9 @@ static const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
static const int png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1}; static const int png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
#endif #endif
// djgpp adds its own underscores to global variables, so define them without: // djgpp and Win32 add their own underscores to global variables,
#ifdef __DJGPP__ // so define them without:
#if (defined __DJBPP__) || defined (WIN32)
# define _unmask unmask # define _unmask unmask
# define _const4 const4 # define _const4 const4
# define _const6 const6 # define _const6 const6

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -697,7 +697,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
* not called png_set_interlace_handling(), the display_row buffer will * not called png_set_interlace_handling(), the display_row buffer will
* be ignored, so pass NULL to it. * be ignored, so pass NULL to it.
* *
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta16 * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta17
*/ */
void PNGAPI void PNGAPI
@ -746,7 +746,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
* only call this function once. If you desire to have an image for * only call this function once. If you desire to have an image for
* each pass of a interlaced image, use png_read_rows() instead. * each pass of a interlaced image, use png_read_rows() instead.
* *
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta16 * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta17
*/ */
void PNGAPI void PNGAPI
png_read_image(png_structp png_ptr, png_bytepp image) png_read_image(png_structp png_ptr, png_bytepp image)

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -224,8 +224,18 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
} }
} }
if (ret != Z_STREAM_END) if (ret != Z_STREAM_END)
{
#if !defined(PNG_NO_STDIO)
char umsg[50];
sprintf(umsg,"Incomplete compressed datastream in %s chunk",
png_ptr->chunk_name);
png_warning(png_ptr, umsg);
#else
png_warning(png_ptr, png_warning(png_ptr,
"End of datastream not found in a compressed chunk (other than IDAT)"); "Incomplete compressed datastream in chunk other than IDAT");
#endif
}
inflateReset(&png_ptr->zstream); inflateReset(&png_ptr->zstream);
png_ptr->zstream.avail_in = 0; png_ptr->zstream.avail_in = 0;
@ -234,7 +244,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
chunkdata = text; chunkdata = text;
*newlength=text_size; *newlength=text_size;
} }
else /* if (comp_type >= PNG_TEXT_COMPRESSION_LAST) */ else /* if (comp_type != PNG_TEXT_COMPRESSION_zTXt) */
{ {
#if !defined(PNG_NO_STDIO) #if !defined(PNG_NO_STDIO)
char umsg[50]; char umsg[50];

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -1159,7 +1159,7 @@ main(int argc, char *argv[])
fprintf(STDERR," library (%lu):%s", png_access_version_number(), fprintf(STDERR," library (%lu):%s", png_access_version_number(),
png_get_header_version(NULL)); png_get_header_version(NULL));
/* Show the version of libpng used in building the application */ /* Show the version of libpng used in building the application */
fprintf(STDERR," pngtest (%lu):%s", PNG_LIBPNG_VER, fprintf(STDERR," pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER,
PNG_HEADER_VERSION_STRING); PNG_HEADER_VERSION_STRING);
fprintf(STDERR," sizeof(png_struct)=%d, sizeof(png_info)=%d\n", fprintf(STDERR," sizeof(png_struct)=%d, sizeof(png_info)=%d\n",
sizeof(png_struct), sizeof(png_info)); sizeof(png_struct), sizeof(png_info));
@ -1392,4 +1392,4 @@ main(int argc, char *argv[])
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_7beta16 your_png_h_is_not_version_1_0_7beta16; typedef version_1_0_7beta17 your_png_h_is_not_version_1_0_7beta17;

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -2,7 +2,7 @@
* *
* For Intel x86 CPU and Microsoft Visual C++ compiler * For Intel x86 CPU and Microsoft Visual C++ compiler
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, Intel Corporation

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* libpng 1.0.7beta16 - June 4, 2000 * libpng 1.0.7beta17 - June 24, 2000
* 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) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,48 +0,0 @@
# Commodore Amiga Makefile
# makefile for libpng and SAS C V6.5x compiler
# Copyright (C) 1995-2000 Wolf Faust
# For conditions of distribution and use, see copyright notice in png.h
#
# Note: Use #define PNG_READ_BIG_ENDIAN_SUPPORTED in pngconf.h
#
# Location/path of zlib include files
ZLIB=/zlib
#compiler
CC=sc
#compiler flags
# WARNING: a bug in V6.51 causes bad code with OPTGO
# So use V6.55 or set NOOPTGO!!!!!!!!!
CFLAGS= NOSTKCHK PARMS=REG OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL\
OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 INCLUDEDIR=$(ZLIB) \
DEFINE=PNG_INTERNAL
#linker flags
LDFLAGS= SD ND BATCH
#link libs
LDLIBS= libpng.lib libgz.lib LIB:scm.lib LIB:sc.lib Lib:amiga.lib
# linker
LN= slink
# file deletion command
RM= delete quiet
# library (.lib) file creation command
AR= oml
# make directory command
MKDIR= makedir
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o
all: libpng.lib pngtest
libpng.lib: $(OBJS)
-$(RM) libpng.lib
$(AR) libpng.lib r $(OBJS)
pngtest: pngtest.o libpng.lib
$(LN) <WITH <
$(LDFLAGS)
TO pngtest
FROM LIB:c.o pngtest.o
LIB $(LDLIBS)
<

View File

@ -1,15 +1,20 @@
# Commodore Amiga Makefile # Commodore Amiga Makefile
# makefile for libpng and SAS C V6.55 compiler # makefile for libpng and SAS C V6.5x compiler
# Copyright (C) 1995 Wolf Faust # Copyright (C) 1995-2000 Wolf Faust
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
#
# Note: Use #define PNG_READ_BIG_ENDIAN_SUPPORTED in pngconf.h
#
# Location/path of zlib include files
ZLIB=/zlib
#compiler #compiler
CC=sc CC=sc
#compiler flags #compiler flags
# WARNING: a bug in V6.51 causes bad code with OPTGO # WARNING: a bug in V6.51 causes bad code with OPTGO
# So use V6.55 or set NOOPTGO!!!!!!!!! # So use V6.55 or set NOOPTGO!!!!!!!!!
CFLAGS= NOSTKCHK PARMS=REG OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL\ CFLAGS= NOSTKCHK PARMS=REG OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL\
OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 DEFINE=PNG_INTERNAL OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 INCLUDEDIR=$(ZLIB) \
DEFINE=PNG_INTERNAL
#linker flags #linker flags
LDFLAGS= SD ND BATCH LDFLAGS= SD ND BATCH
#link libs #link libs
@ -23,8 +28,9 @@ AR= oml
# make directory command # make directory command
MKDIR= makedir MKDIR= makedir
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o pngpread.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngerror.o pngwrite.o pngrtran.o pngwtran.o pngrio.o pngwio.o pngmem.o pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o
all: libpng.lib pngtest all: libpng.lib pngtest
@ -40,4 +46,3 @@ FROM LIB:c.o pngtest.o
LIB $(LDLIBS) LIB $(LDLIBS)
< <

View File

@ -31,7 +31,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.7beta16 PNGMIN = 1.0.7beta17
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h # where make install puts libpng.a, libpng.so*, and png.h

View File

@ -14,7 +14,7 @@ ZLIBINC=../zlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.7beta16 PNGMIN = 1.0.7beta17
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
CC=cc CC=cc

View File

@ -34,7 +34,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.7beta16 PNGMIN = 1.0.7beta17
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@ -34,7 +34,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.7beta16 PNGMIN = 1.0.7beta17
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@ -25,7 +25,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.7beta16 PNGMIN = 1.0.7beta17
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 # -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=gcc -shared LDSHARED=gcc -shared
VER=1.0.7beta16 VER=1.0.7beta17
LIBS=libpng.so.1.0.7beta16 LIBS=libpng.so.1.0.7beta17
SHAREDLIB=libpng.so SHAREDLIB=libpng.so
libdir=$(prefix)/lib32 libdir=$(prefix)/lib32

View File

@ -31,7 +31,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.7beta16 PNGMIN = 1.0.7beta17
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@ -5,7 +5,7 @@ unit pngdef;
interface interface
const const
PNG_LIBPNG_VER_STRING = '1.0.7beta16'; PNG_LIBPNG_VER_STRING = '1.0.7beta17';
PNG_LIBPNG_VER = 10007; PNG_LIBPNG_VER = 10007;
type type

View File

@ -1,5 +1,5 @@
;---------------------------------------- ;----------------------------------------
; PNGLIB module definition file for OS/2 ; PNG.LIB module definition file for OS/2
;---------------------------------------- ;----------------------------------------
; Caution: This file is probably out of date. ; Caution: This file is probably out of date.