Imported from libpng-0.90.tar
This commit is contained in:
parent
c21f90c334
commit
02ad0efbc8
@ -93,11 +93,30 @@ version 0.89
|
||||
fixed gamma and background correction for paletted images, so
|
||||
png_correct_palette is not needed unless you are correcting an
|
||||
external palette (you will need to #define PNG_CORRECT_PALETTE_SUPPORTED
|
||||
in pngconf.h)
|
||||
in pngconf.h) - if nobody uses this, it may disappear in the future.
|
||||
fixed bug with Borland 64K memory allocation (Alexander Lehmann)
|
||||
fixed bug in interlace handling (Smaraderagd, I think)
|
||||
fixed bug in interlace handling (Smarasderagd, I think)
|
||||
added more error checking for writing and image to reduce invalid files
|
||||
separated read and write functions so that they won't both be linked
|
||||
into a binary when only reading or writing functionality is used
|
||||
new pngtest image also has interlacing and zTXt
|
||||
updated dcumentation to reflect new API
|
||||
updated documentation to reflect new API
|
||||
version 0.90
|
||||
made CRC errors/warnings on critical and ancillary chunks configurable
|
||||
libpng will use the zlib CRC routines by (compile-time) default
|
||||
changed DOS small/medium model memory support - needs zlib 1.04 (Tim Wegner)
|
||||
added external C++ wrapper statements to png.h (Gilles Dauphin)
|
||||
allow PNG file to be read when some or all of file signature has already
|
||||
been read from the beginning of the stream (this affects the size of
|
||||
info_struct and invalidates all programs that use a shared libpng)
|
||||
fixed png_filler() declarations
|
||||
fixed? background color conversions
|
||||
fixed order of error function pointers to match documentation
|
||||
current chunk name is now available in png_struct to reduce the number
|
||||
of nearly identical error messages (will simplify multi-lingual
|
||||
support when available)
|
||||
try to get ready for unknown-chunk callback functions:
|
||||
- previously read critical chunks are flagged, so the chunk handling
|
||||
routines can determine if the chunk is in the right place
|
||||
- all chunk handling routines have the same prototypes, so we will
|
||||
be able to handle all chunks via a callback mechanism
|
168
README
Normal file
168
README
Normal file
@ -0,0 +1,168 @@
|
||||
readme.txt - for libpng 0.90
|
||||
|
||||
This is the fourth beta version of libpng 1.0. The changes from
|
||||
libpng-0.89 include bug fixes, a C++ wrapper for png.h, some
|
||||
additions to the API, as well as internal changes to the library.
|
||||
|
||||
**
|
||||
Note that some of the changes to the png_info structure render
|
||||
this version of the library binary incompatible with libpng-0.89
|
||||
if you are using a shared library. Re-compiling the application
|
||||
should be enough to remove this problem.
|
||||
**
|
||||
|
||||
The additions to 0.89 include the ability to read from a PNG stream
|
||||
which has had some (or all) of the signature bytes read by the
|
||||
calling application. This also allows the reading of embedded PNG
|
||||
streams that do not have the PNG file signature. As well, it is
|
||||
now possible to set the library action on the detection of chunk
|
||||
CRC errors. It is possible to set different actions based on
|
||||
whether the error occurred in a critical or an ancillary chunk.
|
||||
|
||||
The callback functions for the error/warning messages have changed
|
||||
since the 0.88 release because their implementation was broken,
|
||||
and it was thought best to change the API itself (which was only
|
||||
introduced in libpng-0.88 itself) to alert the user to the change,
|
||||
rather than mislead the user into thinking their application was
|
||||
OK after re-compiling. This means that calls to png_set_message_fn()
|
||||
no longer exist, because the previously suggested method of calling
|
||||
them before png_read_init() or png_write_init() is now ineffective.
|
||||
|
||||
The preferred method of setting the error and warning callbacks
|
||||
has been incorporated into the allocation of the png_struct and
|
||||
info_struct itself, which allow them to be safely used during the
|
||||
initialization of the structure, as well as to keep the size of
|
||||
the png_struct internal to the library, rather than at compile time
|
||||
of the application. This will hopefully remove any problems with
|
||||
dynamically linked libraries, and should be considered the preferred
|
||||
method of creating these structures, although the previous
|
||||
initialization API is still available for compatibility. See libpng.txt
|
||||
for more information on the new API.
|
||||
|
||||
The changes made to the library, and bugs fixed are based on discussions
|
||||
on the PNG implementation mailing list <png-implement@dworking.wustl.edu>
|
||||
and not on material submitted to Guy.
|
||||
|
||||
For a detailed description on using libpng, read libpng.txt. For
|
||||
usage information and restrictions (what little they are) on libpng,
|
||||
see png.h. For a description on using zlib (the compression library
|
||||
used by libpng) and zlib's restrictions, see zlib.h
|
||||
|
||||
I have included a general makefile, as well as several machine and compiler
|
||||
specific ones, but you may have to modify one for your own needs.
|
||||
|
||||
You should use zlib 1.0.4 or later to run this, but it MAY work with
|
||||
versions as old as zlib 0.95. Even so, there are bugs in older zlib
|
||||
versions which can cause the output of invalid compression streams for
|
||||
some images. You will definitely need zlib 1.0.4 or later if you are
|
||||
taking advantage of the MS-DOS "far" structure allocation for the small
|
||||
and medium memory models. You should also note that zlib is a
|
||||
compression library that is useful for more things than just PNG files.
|
||||
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||
you are so inclined.
|
||||
|
||||
zlib should be available at the same place that libpng is.
|
||||
If not, it should be at ftp.uu.net in /graphics/png
|
||||
Eventually, it will be at ftp.uu.net in /pub/archiving/zip/zlib
|
||||
|
||||
You may also want a copy of the PNG specification. It is available
|
||||
as an Internet Draft, and RFC, and a W3C Recommendation. Failing
|
||||
these resources you can try ftp.uu.net in the /graphics/png directory.
|
||||
|
||||
This code is currently being archived at ftp.uu.net in the
|
||||
/graphics/png directory, and on CompuServe, Lib 20 (PNG SUPPORT)
|
||||
at GO GRAPHSUP. If you can't find it in any of those places,
|
||||
e-mail me, and I'll help you find it.
|
||||
|
||||
If you have any code changes, requests, problems, etc., please e-mail
|
||||
them to me. Also, I'd appreciate any make files or project files,
|
||||
and any modifications you needed to make to get libpng to compile,
|
||||
along with a #define variable to tell what compiler/system you are on.
|
||||
If you needed to add transformations to libpng, or wish libpng would
|
||||
provide the image in a different way, drop me a note (and code, if
|
||||
possible), so I can consider supporting the transformation.
|
||||
Finally, if you get any warning messages when compiling libpng
|
||||
(note: not zlib), and they are easy to fix, I'd appreciate the
|
||||
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
||||
|
||||
This release was created and will be supported by myself (of course
|
||||
based in a large way on Guy's earlier work), and the PNG group.
|
||||
|
||||
adilger@enel.ucalgary.ca
|
||||
png-implement@dworkin.wustl.edu
|
||||
|
||||
You can reach Guy, the original libpng author, at (internet preferred):
|
||||
|
||||
internet: schalnat@group42.com
|
||||
CompuServe: 75501,1625
|
||||
|
||||
Please do not send general questions about PNG. Send them to
|
||||
the address in the specification. At the same time, please do
|
||||
not send libpng questions to that address, send them to me. I'll
|
||||
get them in the end anyway. If you have a question about something
|
||||
in the PNG specification that is related to using libpng, send it
|
||||
to me. Send me any questions that start with "I was using libpng,
|
||||
and ...". If in doubt, send questions to me. I'll bounce them
|
||||
to others, if necessary.
|
||||
|
||||
Please do not send suggestions on how to change PNG. We have
|
||||
been discussing PNG for a couple years now, and it is official and
|
||||
finished. If you have suggestions for libpng, however, I'll
|
||||
gladly listen. Even if your suggestion is not used for version
|
||||
1.0, it may be used later.
|
||||
|
||||
Files in this distribution:
|
||||
|
||||
CHANGES.txt => Description of changes between libpng versions
|
||||
README => This file
|
||||
TODO => Things not implemented in the current library
|
||||
ansi2knr.c => Converts files to K&R style function declarations
|
||||
build.bat => MS-DOS batch file for Borland compiler
|
||||
descrip.mms => VMS project file
|
||||
example.c => Example code for using libpng functions
|
||||
libpng.txt => Description of libpng and its functions
|
||||
makefile => Defualt makefile
|
||||
makefile.aco => ACORN makefile
|
||||
makefile.ama => Amiga makefile
|
||||
makefile.atr => Atari makefile
|
||||
makefile.bor => Borland makefile
|
||||
makefile.dj2 => DJGPP 2 makefile
|
||||
makefile.elf => Unix ELF makefile
|
||||
makefile.knr => Makefile which calls ansi2knr to convert files
|
||||
makefile.mip => MIPS makefile
|
||||
makefile.msc => Microsoft C makefile
|
||||
makefile.std => Standard Unix makefile
|
||||
makefile.tc => Turbo C makefile
|
||||
makevms.com => VMS make program
|
||||
png.c => Basic interface functions common to library
|
||||
png.h => Library function and interface declarations
|
||||
pngconf.h => System specific library configuration
|
||||
pngerror.c => Error/warning message I/O functions
|
||||
pngmem.c => Memory handling functions
|
||||
pngpread.c => Progressive reading functions
|
||||
pngrcb.c => Read callback (data handling) low-level functions
|
||||
pngread.c => Read data/helper high-level functions
|
||||
pngrio.c => Lowest-level data read I/O functions
|
||||
pngrtran.c => Read data transformation functions
|
||||
pngrutil.c => Read data utility functions
|
||||
pngtest.c => Library test program
|
||||
pngtest.png => Library test sample image
|
||||
pngtrans.c => Common data transformation functions
|
||||
pngwio.c => Lowest-level write I/O functions
|
||||
pngwrite.c => High-level write functions
|
||||
pngwtran.c => Write data transformations
|
||||
pngwutil.c => Write utility functions
|
||||
|
||||
Good luck, and happy coding.
|
||||
|
||||
-Andreas Eric Dilger
|
||||
University of Calgary
|
||||
Internet: adilger@enel.ucalgary.ca
|
||||
Web: www-mddsp.enel.ucalgary.ca/People/adilger/
|
||||
|
||||
-Guy Eric Schalnat
|
||||
Group 42, Inc.
|
||||
Internet: schalnat@group42.com
|
||||
CompuServe: 75501,1625
|
||||
Web: www.group42.com
|
||||
|
@ -5,21 +5,19 @@ for 0.9
|
||||
final bug fixes
|
||||
cHRM transformation
|
||||
better documentation
|
||||
multi-lingual message support
|
||||
|
||||
after 1.0
|
||||
overlaying one image on top of another
|
||||
optional palette creation
|
||||
histogram creation
|
||||
text conversion between different code types
|
||||
support for other chunks being defined (sCAl, the gIF series,
|
||||
and others that people come up with).
|
||||
support for application-defined chunk handlers
|
||||
support for embedded PNG usage (MNG)
|
||||
pull writer
|
||||
better dithering
|
||||
keep up with public chunks
|
||||
other compression libraries
|
||||
more exotic interlace handling
|
||||
better filtering (counting huffman bits? filter type inertia?)
|
||||
better filter selection (counting huffman bits? filter type inertia?)
|
||||
C++ wrapper
|
||||
other languages (pascal, for one)
|
||||
comments of > 64K
|
||||
|
||||
comments of > 64K for DOS
|
61
example.c
61
example.c
@ -14,45 +14,61 @@
|
||||
|
||||
#include <png.h>
|
||||
|
||||
/* check to see if a file is a png file using png_check_sig() */
|
||||
int check_png(char * file_name)
|
||||
/* Check to see if a file is a png file using png_check_sig().
|
||||
|
||||
If this call is successful, and you are going to keep the file
|
||||
open, you should call png_set_sig_bytes_read(png_ptr, 8);
|
||||
once you have created the png_ptr, so that libpng knows it
|
||||
doesn't have to read the signature again. Make sure you don't
|
||||
call png_set_sig_bytes_read() with more than 8 bytes read or
|
||||
give it an incorrect number of bytes read, or you will either
|
||||
have read too many bytes (your fault), or you are telling libpng
|
||||
to read the wrong number of magic bytes (also your fault). */
|
||||
int check_png(char *file_name, FILE **fp)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[8];
|
||||
int ret;
|
||||
|
||||
fp = fopen(file_name, "rb");
|
||||
*fp = fopen(file_name, "rb");
|
||||
if (!fp)
|
||||
return 0;
|
||||
ret = fread(buf, 1, 8, fp);
|
||||
fclose(fp);
|
||||
ret = fread(buf, 1, 8, *fp);
|
||||
|
||||
if (ret != 8)
|
||||
return 0;
|
||||
|
||||
ret = png_check_sig(buf, 8);
|
||||
/* Check the signature starting at byte 0, and check all 8 bytes */
|
||||
ret = png_check_sig(buf, 0, 8);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* read a png file. You may want to return an error code if the read
|
||||
fails (depending upon the failure). */
|
||||
void read_png(char *file_name)
|
||||
fails (depending upon the failure). There are two "prototypes" given
|
||||
here - one where we are given the filename, and we need to open the
|
||||
file, and the other where we are given an open file (possibly with
|
||||
some or all of the magic bytes read - see above) and an opened file
|
||||
for reading. */
|
||||
------- prototype 1 ----------
|
||||
void read_png(char *file_name) /* We need to open the file */
|
||||
{
|
||||
FILE *fp;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
FILE *fp;
|
||||
|
||||
/* open the file */
|
||||
fp = fopen(file_name, "rb");
|
||||
if (!fp)
|
||||
if ((fp = fopen(file_name, "rb")) == NULL)
|
||||
return;
|
||||
------- prototype 2 ----------
|
||||
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
------- only use one! --------
|
||||
|
||||
/* Create and initialize the png_struct with the desired error handler
|
||||
functions. If you want to use the default stderr and longjump method,
|
||||
you can supply NULL for the last three parameters. We also check that
|
||||
the header file is compatible with the library version.
|
||||
*/
|
||||
the header file is compatible with the library version. */
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
(void *)user_error_ptr, user_error_fn, user_warning_fn);
|
||||
|
||||
@ -88,7 +104,11 @@ void read_png(char *file_name)
|
||||
png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn);
|
||||
/* where user_io_ptr is a structure you want available to the callbacks */
|
||||
|
||||
/* read the file information */
|
||||
/* if we have already read some of the signature from the beginning call */
|
||||
png_set_sig_bytes_read(png_ptr, sig_read);
|
||||
|
||||
/* The call to png_read_info() gives us all of the information
|
||||
from the PNG file before the first IDAT (image data chunk). */
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
/* set up the transformations you want. Note that these are
|
||||
@ -120,7 +140,10 @@ void read_png(char *file_name)
|
||||
png_set_background(png_ptr, &my_background,
|
||||
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
||||
|
||||
/* tell libpng to handle the gamma conversion for you */
|
||||
/* tell libpng to handle the gamma conversion for you. We only
|
||||
need the second call if the screen_gamma isn't the usual 2.2
|
||||
or if it is controllable by the user. It may also be a good
|
||||
idea to allow the user to set the file gamma if it is unknown. */
|
||||
if (info_ptr->valid & PNG_INFO_gAMA)
|
||||
png_set_gamma(png_ptr, screen_gamma, info_ptr->gamma);
|
||||
else
|
||||
@ -398,10 +421,6 @@ void write_png(char *file_name, ... other image information ...)
|
||||
/* set up the output control if you are using standard C streams */
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
/* if you are using replacement message functions, here you would call */
|
||||
png_set_message_fn(png_ptr, (void *)msg_ptr, user_error_fn, user_warning_fn);
|
||||
/* where msg_ptr is a structure you want available to the callbacks */
|
||||
|
||||
/* set the file information here */
|
||||
info_ptr->width = ;
|
||||
info_ptr->height = ;
|
||||
|
73
libpng.txt
73
libpng.txt
@ -56,14 +56,14 @@ II. Structures
|
||||
There are two main structures that are important to libpng, png_struct
|
||||
and png_info. The first, png_struct, is an internal structure that
|
||||
will not, for the most part, be used by a user except as the first
|
||||
variable passed to every png function call.
|
||||
variable passed to every libpng function call.
|
||||
|
||||
The png_info structure is designed to provide information about the
|
||||
png file. All of its fields are intended to be examined or modified
|
||||
by the user. See png.h for a good description of the png_info fields.
|
||||
png.h is also an invaluable reference for programming with libpng.
|
||||
|
||||
And while I'm on the topic, make sure you include the png header file:
|
||||
And while I'm on the topic, make sure you include the libpng header file:
|
||||
|
||||
#include <png.h>
|
||||
|
||||
@ -86,11 +86,13 @@ file. Libpng provides a simple check to see if a file is a PNG file.
|
||||
To use it, pass in the first 1 to 8 bytes of the file, and it will
|
||||
return true or false (1 or 0) depending on whether the bytes could be
|
||||
part of a PNG file. Of course, the more bytes you pass in, the
|
||||
greater the accuracy of the prediction. If you pass in more then
|
||||
eight bytes, libpng will only look at the first eight bytes. However,
|
||||
because libpng automatically checks the file header, this is not often
|
||||
necessary, and you should pass a newly opened file pointer to libpng
|
||||
when reading a file.
|
||||
greater the accuracy of the prediction.
|
||||
|
||||
If you are intending to keep the file pointer open for use in libpng,
|
||||
you must ensure you don't read more than 8 bytes from the beginning
|
||||
of the file, and you also have to make a call to png_set_sig_bytes_read()
|
||||
with the number of bytes you read from the beginning. Libpng will
|
||||
then only check the bytes (if any) that your program didn't read.
|
||||
|
||||
(*): If you are not using the standard I/O functions, you will need
|
||||
to replace them with custom functions. See the discussion under
|
||||
@ -102,12 +104,11 @@ Customizing libpng.
|
||||
return;
|
||||
}
|
||||
fread(header, 1, number, fp);
|
||||
is_png = png_check_sig(header, number);
|
||||
is_png = png_check_sig(header, 0, number);
|
||||
if (!is_png)
|
||||
{
|
||||
return;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
Next, png_struct and png_info need to be allocated and initialized.
|
||||
In order to ensure that the size of these structures is correct even
|
||||
@ -134,20 +135,20 @@ Changes to Libpng below regarding the old initialization functions.
|
||||
return;
|
||||
}
|
||||
|
||||
The error handling routines passed to png_create_read_struct()
|
||||
are only necessary if you are not using the libpng supplied
|
||||
error handling functions. When libpng encounters an error,
|
||||
it expects to longjmp back to your routine. Therefore, you
|
||||
will need to call setjmp and pass the jmpbuf field of your
|
||||
png_struct. If you read the file from different routines, you
|
||||
will need to update the jmpbuf field every time you enter a new
|
||||
routine that will call a png_ function. See your documentation
|
||||
of setjmp/longjmp for your compiler for more information on
|
||||
setjmp/longjmp. See the discussion on libpng error handling
|
||||
in the Customizing Libpng section below for more information on
|
||||
the libpng error handling. If an error occurs, and libpng
|
||||
longjmp's back to your setjmp, you will want to call
|
||||
png_destroy_read_struct() to free any memory.
|
||||
The error handling routines passed to png_create_read_struct() are only
|
||||
necessary if you are not using the libpng supplied error handling
|
||||
functions. When libpng encounters an error, it expects to longjmp back
|
||||
to your routine. Therefore, you will need to call setjmp and pass the
|
||||
jmpbuf field of your png_struct. If you read the file from different
|
||||
routines, you will need to update the jmpbuf field every time you enter
|
||||
a new routine that will call a png_ function.
|
||||
|
||||
See your documentation of setjmp/longjmp for your compiler for more
|
||||
information on setjmp/longjmp. See the discussion on libpng error
|
||||
handling in the Customizing Libpng section below for more information on
|
||||
the libpng error handling. If an error occurs, and libpng longjmp's
|
||||
back to your setjmp, you will want to call png_destroy_read_struct() to
|
||||
free any memory.
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
{
|
||||
@ -165,10 +166,16 @@ Libpng section below.
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
If you had previously opened the file and read any of the signature from
|
||||
the beginning in order to see if this was a PNG file, you need to let
|
||||
libpng know that there are some bytes missing from the start of the file.
|
||||
|
||||
png_set_sig_bytes(png_ptr, number);
|
||||
|
||||
You are now ready to read all the file information up to the actual
|
||||
image data. You do this with a call to png_read_info().
|
||||
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
The png_info structure is now filled in with all the data necessary
|
||||
to read the file. Some of the more important parts of the info_ptr are:
|
||||
@ -183,8 +190,13 @@ to read the file. Some of the more important parts of the info_ptr are:
|
||||
bit_depth times the channels
|
||||
rowbytes - number of bytes needed to hold a row
|
||||
interlace_type - currently 0 for none, 1 for interlaced
|
||||
signature - holds the signature read from the file (if any). The
|
||||
data is kept in the same offset it would be if the
|
||||
whole signature were read (ie if you had already read
|
||||
in 4 bytes of signature, the remaining 4 bytes would
|
||||
be in signature[4] through signature[7]).
|
||||
valid - this details which optional chunks were found in the
|
||||
file to see if a chunk was present, AND '&' valid with
|
||||
file. To see if a chunk was present, AND '&' valid with
|
||||
the appropriate PNG_INFO_<chunk name> define.
|
||||
|
||||
These are also important, but their validity depends on whether a
|
||||
@ -217,7 +229,7 @@ keyword/text pairs, one pair per chunk. While there are suggested
|
||||
keywords, there is no requirement to restrict the use to these
|
||||
strings. There is a requirement to have at least one character for a
|
||||
keyword. It is strongly suggested that keywords be sensible to humans
|
||||
(that's the point), so don't use abbreviations. See the png
|
||||
(that's the point), so don't use abbreviations. See the PNG
|
||||
specification for more details. There is also no requirement to have
|
||||
text after the keyword.
|
||||
|
||||
@ -243,6 +255,13 @@ checks to see if it has data that it can do somthing with, you should
|
||||
make sure to only enable a transformation if it will be valid for the
|
||||
data. For example, don't swap red and blue on grayscale data.
|
||||
|
||||
The colors used for the background and transparency values should be
|
||||
supplied in the same format/depth as the current image data. They
|
||||
are stored in the same format/depth as the image data in a bKGD or tRNS
|
||||
chunk, so this is what libpng expects for this data. The colors are
|
||||
transformed to keep in sync with the image data when an application
|
||||
calls the png_update_info() routine (see below).
|
||||
|
||||
Data will be decoded into the supplied row buffers packed into bytes
|
||||
unless the library has been told to transform it into another format.
|
||||
For example, 4 bit/pixel paletted or grayscale data will be returned
|
||||
@ -747,7 +766,7 @@ Libpng section below.
|
||||
|
||||
You now have the option of modifying how the compression library will
|
||||
run. The following functions are mainly for testing, but may be useful
|
||||
in some cases, like if you need to write png files extremely fast and
|
||||
in some cases, like if you need to write PNG files extremely fast and
|
||||
are willing to give up some compression, or if you want to get the
|
||||
maximum possible compression at the expense of slower writing. If you
|
||||
have no special needs in this area, let the library do what it wants by
|
||||
|
112
makefile.aco
112
makefile.aco
@ -1,4 +1,3 @@
|
||||
# makefile for libpng on Acorn RISCOS
|
||||
# Project: libpng
|
||||
|
||||
|
||||
@ -8,108 +7,43 @@ C++flags = -c -depend !Depend -IC: -throwback
|
||||
Linkflags = -aif -c++ -o $@
|
||||
ObjAsmflags = -throwback -NoCache -depend !Depend
|
||||
CMHGflags =
|
||||
LibFileflags = -c -o $@
|
||||
LibFileflags = -c -l -o $@
|
||||
Squeezeflags = -o $@
|
||||
|
||||
|
||||
# Final targets:
|
||||
@.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \
|
||||
@.o.pngpread @.o.pngrcb @.o.pngread @.o.pngrtran @.o.pngrutil \
|
||||
@.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
|
||||
@.o.pngpread @.o.pngrcb @.o.pngread @.o.pngrtran @.o.pngrutil @.o.pngtrans @.o.pngwrite \
|
||||
@.o.pngwtran @.o.pngwutil
|
||||
LibFile $(LibFileflags) @.o.png @.o.pngerror @.o.pngrio @.o.pngwio \
|
||||
@.o.pngmem @.o.pngpread @.o.pngrcb @.o.pngread @.o.pngrtran \
|
||||
@.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
|
||||
@.test: @.tests.pngtest
|
||||
echo Please run "Test" in directory tests
|
||||
@.tests.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
||||
Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
||||
@.o.pngmem @.o.pngpread @.o.pngrcb @.o.pngread @.o.pngrtran @.o.pngrutil @.o.pngtrans \
|
||||
@.o.pngwrite @.o.pngwtran @.o.pngwutil
|
||||
@.mm-libpng-lib: @.mm.png @.mm.pngerror @.mm.pngrio @.mm.pngwio @.mm.pngmem \
|
||||
@.mm.pngpread @.mm.pngrcb @.mm.pngread @.mm.pngrtran @.mm.pngrutil @.mm.pngtrans \
|
||||
@.mm.pngwrite @.mm.pngwtran @.mm.pngwutil
|
||||
LibFile $(LibFileflags) @.mm.png @.mm.pngerror @.mm.pngrio @.mm.pngwio \
|
||||
@.mm.pngmem @.mm.pngpread @.mm.pngrcb @.mm.pngread @.mm.pngrtran @.mm.pngrutil \
|
||||
@.mm.pngtrans @.mm.pngwrite @.mm.pngwtran @.mm.pngwutil
|
||||
|
||||
|
||||
# User-editable dependencies:
|
||||
Test: @.pngtest
|
||||
<Prefix$Dir>.PngTest
|
||||
@remove <Prefix$Dir>.pngout_png
|
||||
|
||||
#It would be nice if you could stop "make" listing from here on!
|
||||
@.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
||||
Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
||||
|
||||
.SUFFIXES: .o .mm .c
|
||||
|
||||
.c.mm:
|
||||
MemCheck.CC cc $(ccflags) -o $@ LibPng:$<
|
||||
.c.o:
|
||||
cc $(ccflags) -o $@ $<
|
||||
|
||||
|
||||
# Static dependencies:
|
||||
@.o.example: @.tests.c.example
|
||||
cc $(ccflags) -o @.o.example @.tests.c.example
|
||||
@.o.pngtest: @.tests.c.pngtest
|
||||
cc $(ccflags) -o @.o.pngtest @.tests.c.pngtest
|
||||
|
||||
|
||||
# Dynamic dependencies:
|
||||
o.png: c.png
|
||||
o.png: h.png
|
||||
o.png: Zlib:h.zlib
|
||||
o.png: Zlib:h.zconf
|
||||
o.png: h.pngconf
|
||||
o.pngerror: c.pngerror
|
||||
o.pngerror: h.png
|
||||
o.pngerror: Zlib:h.zlib
|
||||
o.pngerror: Zlib:h.zconf
|
||||
o.pngerror: h.pngconf
|
||||
o.pngrio: c.pngrio
|
||||
o.pngrio: h.png
|
||||
o.pngrio: Zlib:h.zlib
|
||||
o.pngrio: Zlib:h.zconf
|
||||
o.pngrio: h.pngconf
|
||||
o.pngwio: c.pngwio
|
||||
o.pngwio: h.png
|
||||
o.pngwio: Zlib:h.zlib
|
||||
o.pngwio: Zlib:h.zconf
|
||||
o.pngwio: h.pngconf
|
||||
o.pngmem: c.pngmem
|
||||
o.pngmem: h.png
|
||||
o.pngmem: Zlib:h.zlib
|
||||
o.pngmem: Zlib:h.zconf
|
||||
o.pngmem: h.pngconf
|
||||
o.pngpread: c.pngpread
|
||||
o.pngpread: h.png
|
||||
o.pngpread: Zlib:h.zlib
|
||||
o.pngpread: Zlib:h.zconf
|
||||
o.pngpread: h.pngconf
|
||||
o.pngrcb: c.pngrcb
|
||||
o.pngrcb: h.png
|
||||
o.pngrcb: Zlib:h.zlib
|
||||
o.pngrcb: Zlib:h.zconf
|
||||
o.pngrcb: h.pngconf
|
||||
o.pngread: c.pngread
|
||||
o.pngread: h.png
|
||||
o.pngread: Zlib:h.zlib
|
||||
o.pngread: Zlib:h.zconf
|
||||
o.pngread: h.pngconf
|
||||
o.pngrtran: c.pngrtran
|
||||
o.pngrtran: h.png
|
||||
o.pngrtran: Zlib:h.zlib
|
||||
o.pngrtran: Zlib:h.zconf
|
||||
o.pngrtran: h.pngconf
|
||||
o.pngrutil: c.pngrutil
|
||||
o.pngrutil: h.png
|
||||
o.pngrutil: Zlib:h.zlib
|
||||
o.pngrutil: Zlib:h.zconf
|
||||
o.pngrutil: h.pngconf
|
||||
o.pngtrans: c.pngtrans
|
||||
o.pngtrans: h.png
|
||||
o.pngtrans: Zlib:h.zlib
|
||||
o.pngtrans: Zlib:h.zconf
|
||||
o.pngtrans: h.pngconf
|
||||
o.pngwrite: c.pngwrite
|
||||
o.pngwrite: h.png
|
||||
o.pngwrite: Zlib:h.zlib
|
||||
o.pngwrite: Zlib:h.zconf
|
||||
o.pngwrite: h.pngconf
|
||||
o.pngwtran: c.pngwtran
|
||||
o.pngwtran: h.png
|
||||
o.pngwtran: Zlib:h.zlib
|
||||
o.pngwtran: Zlib:h.zconf
|
||||
o.pngwtran: h.pngconf
|
||||
o.pngwutil: c.pngwutil
|
||||
o.pngwutil: h.png
|
||||
o.pngwutil: Zlib:h.zlib
|
||||
o.pngwutil: Zlib:h.zconf
|
||||
o.pngwutil: h.pngconf
|
||||
o.pngtest: tests.c.pngtest
|
||||
o.pngtest: h.png
|
||||
o.pngtest: Zlib:h.zlib
|
||||
o.pngtest: Zlib:h.zconf
|
||||
o.pngtest: h.pngconf
|
||||
|
35
makefile.elf
35
makefile.elf
@ -1,15 +1,18 @@
|
||||
# makefile for libpng on (linux) ELF
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
# For conditions of distribution and use, see copyright notice in png.h
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-I../zlib -O2 -Wall -fPIC
|
||||
CFLAGS=-I../zlib -Wall -Wwrite-strings -Wpointer-arith \
|
||||
-Wstrict-prototypes -Wmissing-prototypes -O2 -fPIC
|
||||
LDFLAGS=-L. -Wl,-rpath,. -L../zlib/ -Wl,-rpath,../zlib/ -lpng -lz -lm
|
||||
|
||||
RANLIB=ranlib
|
||||
#RANLIB=echo
|
||||
|
||||
PNGVER = 0.89
|
||||
PNGMAJ = 0
|
||||
PNGMIN = 90
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# where make install puts libpng.a, libpng.so*, and png.h
|
||||
prefix=/usr/local
|
||||
@ -24,14 +27,14 @@ libpng.a: $(OBJS)
|
||||
ar rc $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
libpng.so: libpng.so.1
|
||||
ln -sf libpng.so.1 libpng.so
|
||||
libpng.so: libpng.so.$(PNGMAJ)
|
||||
ln -sf libpng.so.$(PNGMAJ) libpng.so
|
||||
|
||||
libpng.so.1: libpng.so.1.$(PNGVER)
|
||||
ln -sf libpng.so.1.$(PNGVER) libpng.so.1
|
||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
||||
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
||||
|
||||
libpng.so.1.$(PNGVER): $(OBJS)
|
||||
gcc -shared -Wl,-soname,libpng.so.1 -o libpng.so.1.$(PNGVER) $(OBJS)
|
||||
libpng.so.$(PNGVER): $(OBJS)
|
||||
gcc -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) $(OBJS)
|
||||
|
||||
pngtest: pngtest.o libpng.so
|
||||
$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
|
||||
@ -39,21 +42,21 @@ pngtest: pngtest.o libpng.so
|
||||
test: pngtest
|
||||
./pngtest
|
||||
|
||||
install: libpng.so.1.$(PNGVER)
|
||||
install: libpng.so.$(PNGVER)
|
||||
-@mkdir $(prefix)/include
|
||||
-@mkdir $(prefix)/lib
|
||||
cp png.h $(prefix)/include
|
||||
cp pngconf.h $(prefix)/include
|
||||
chmod 644 $(prefix)/include/png.h
|
||||
chmod 644 $(prefix)/include/pngconf.h
|
||||
cp libpng.so.1.$(PNGVER) $(prefix)/lib
|
||||
chmod 755 $(prefix)/lib/libpng.so.1.$(PNGVER)
|
||||
-@/bin/rm $(prefix)/lib/libpng.so.1 $(prefix)/lib/libpng.so
|
||||
(cd $(prefix)/lib; ln -sf libpng.so.1.$(PNGVER) libpng.so.1; \
|
||||
ln -sf libpng.so.1 libpng.so)
|
||||
cp libpng.so.$(PNGVER) $(prefix)/lib
|
||||
chmod 755 $(prefix)/lib/libpng.so.$(PNGVER)
|
||||
-@/bin/rm $(prefix)/lib/libpng.so.$(PNGMAJ) $(prefix)/lib/libpng.so
|
||||
(cd $(prefix)/lib; ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
||||
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
||||
|
||||
clean:
|
||||
rm -f *.o libpng.so.1.$(PNGVER) libpng.so.1 libpng.so pngtest pngout.png
|
||||
rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
|
146
png.c
146
png.c
@ -1,10 +1,10 @@
|
||||
|
||||
/* png.c - location for general purpose png functions
|
||||
|
||||
libpng 1.0 beta 3 - version 0.89
|
||||
libpng 1.0 beta 4 - version 0.90
|
||||
For conditions of distribution and use, see copyright notice in png.h
|
||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
May 25, 1996
|
||||
January 10, 1997
|
||||
*/
|
||||
|
||||
#define PNG_INTERNAL
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
/* version information for c files. This better match the version
|
||||
string defined in png.h */
|
||||
char png_libpng_ver[] = "0.89";
|
||||
char png_libpng_ver[] = "0.90";
|
||||
|
||||
/* place to hold the signiture string for a png file. */
|
||||
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||
@ -70,15 +70,52 @@ int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||
int FARDATA png_pass_dsp_mask[] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||
|
||||
|
||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||
* of the PNG file signature. If the PNG data is embedded into another
|
||||
* stream we can set num_bytes = 8 so that libpng will not attempt to read
|
||||
* or write any of the magic bytes before it starts on the IHDR.
|
||||
*/
|
||||
void
|
||||
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
||||
{
|
||||
if (num_bytes > 8)
|
||||
png_error(png_ptr, "Too many bytes for PNG signature.");
|
||||
|
||||
png_ptr->sig_bytes = num_bytes < 0 ? 0 : num_bytes;
|
||||
}
|
||||
|
||||
/* Checks whether the supplied bytes match the PNG signature. We allow
|
||||
* checking less than the full 8-byte signature so that those apps that
|
||||
* already read the first few bytes of a file to determine the file type
|
||||
* can simply check the remaining bytes for extra assurance. Returns
|
||||
* an integer less than, equal to, or greater than zero if sig is found,
|
||||
* respectively, to be less than, to match, or be greater than the correct
|
||||
* PNG signature (this is the same behaviour as strcmp, memcmp, etc).
|
||||
*/
|
||||
int
|
||||
png_sig_cmp(png_bytep sig, int start, int num_to_check)
|
||||
{
|
||||
if (num_to_check > 8)
|
||||
num_to_check = 8;
|
||||
else if (num_to_check < 1)
|
||||
return 0;
|
||||
|
||||
if (start > 7 || start < 0)
|
||||
return 0;
|
||||
|
||||
if (start + num_to_check > 8)
|
||||
num_to_check = 8 - start;
|
||||
|
||||
return (png_memcmp(sig, &png_sig[start], (unsigned int)num_to_check));
|
||||
}
|
||||
|
||||
/* (Obsolete) function to check signature bytes. It does not allow one
|
||||
to check a partial signature. This function will be removed in the
|
||||
future - use png_sig_cmp(). */
|
||||
int
|
||||
png_check_sig(png_bytep sig, int num)
|
||||
{
|
||||
if (num > 8)
|
||||
num = 8;
|
||||
if (num < 1)
|
||||
return 0;
|
||||
|
||||
return (!png_memcmp(sig, png_sig, num));
|
||||
return !png_sig_cmp(sig, 0, num);
|
||||
}
|
||||
|
||||
/* Function to allocate memory for zlib. */
|
||||
@ -88,7 +125,7 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||
png_voidp ptr;
|
||||
png_uint_32 num_bytes;
|
||||
|
||||
ptr = png_large_malloc((png_structp)png_ptr,
|
||||
ptr = png_malloc((png_structp)png_ptr,
|
||||
(png_uint_32)items * (png_uint_32)size);
|
||||
num_bytes = (png_uint_32)items * (png_uint_32)size;
|
||||
if (num_bytes > (png_uint_32)0x7fff)
|
||||
@ -108,26 +145,27 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||
void
|
||||
png_zfree(voidpf png_ptr, voidpf ptr)
|
||||
{
|
||||
png_large_free((png_structp)png_ptr, (png_voidp)ptr);
|
||||
png_free((png_structp)png_ptr, (png_voidp)ptr);
|
||||
}
|
||||
|
||||
/* reset the crc variable to 32 bits of 1's. Care must be taken
|
||||
in case crc is > 32 bits to leave the top bits 0 */
|
||||
/* Reset the CRC variable to 32 bits of 1's. Care must be taken
|
||||
in case CRC is > 32 bits to leave the top bits 0. */
|
||||
void
|
||||
png_reset_crc(png_structp png_ptr)
|
||||
{
|
||||
/* set crc to all 1's */
|
||||
#ifdef PNG_USE_OWN_CRC
|
||||
png_ptr->crc = 0xffffffffL;
|
||||
#else
|
||||
png_ptr->crc = crc32(0, Z_NULL, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Note: the crc code below was copied from the sample code in the
|
||||
PNG spec, with appropriate modifications made to ensure the
|
||||
variables are large enough */
|
||||
|
||||
/* table of crc's of all 8-bit messages. If you wish to png_malloc this
|
||||
table, turn this into a pointer, and png_malloc it in make_crc_table().
|
||||
#ifdef PNG_USE_OWN_CRC
|
||||
/* Table of CRC's of all 8-bit messages. If you wish to png_malloc this
|
||||
table, turn this into a pointer, and png_malloc() it in make_crc_table().
|
||||
You may then want to hook it into png_struct and free it with the
|
||||
destroy functions. */
|
||||
destroy functions. Another alternative is to pre-fill the table. */
|
||||
static png_uint_32 crc_table[256];
|
||||
|
||||
/* Flag: has the table been computed? Initially false. */
|
||||
@ -150,9 +188,9 @@ make_crc_table(void)
|
||||
crc_table_computed = 1;
|
||||
}
|
||||
|
||||
/* update a running crc with the bytes buf[0..len-1]--the crc should be
|
||||
/* Update a running CRC with the bytes buf[0..len-1]--the crc should be
|
||||
initialized to all 1's, and the transmitted value is the 1's complement
|
||||
of the final running crc. */
|
||||
of the final running CRC. */
|
||||
static png_uint_32
|
||||
update_crc(png_uint_32 crc, png_bytep buf, png_uint_32 len)
|
||||
{
|
||||
@ -176,8 +214,9 @@ update_crc(png_uint_32 crc, png_bytep buf, png_uint_32 len)
|
||||
|
||||
return c;
|
||||
}
|
||||
#endif /* PNG_USE_OWN_CRC */
|
||||
|
||||
/* calculate the crc over a section of data. Note that while we
|
||||
/* Calculate the crc over a section of data. Note that while we
|
||||
are passing in a 32 bit value for length, on 16 bit machines, you
|
||||
would need to use huge pointers to access all that data. If you
|
||||
need this, put huge here and above. */
|
||||
@ -185,9 +224,18 @@ void
|
||||
png_calculate_crc(png_structp png_ptr, png_bytep ptr,
|
||||
png_uint_32 length)
|
||||
{
|
||||
#ifdef PNG_USE_OWN_CRC
|
||||
png_ptr->crc = update_crc(png_ptr->crc, ptr, length);
|
||||
#else
|
||||
png_ptr->crc = crc32(png_ptr->crc, ptr, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Allocate the memory for an info_struct for the application. We don't
|
||||
really need the png_ptr, but it could potentially be useful in the
|
||||
future. This should be used in favour of malloc(sizeof(png_info))
|
||||
and png_info_init() so that applications that want to use a shared
|
||||
libpng don't have to be recompiled if png_info changes size. */
|
||||
png_infop
|
||||
png_create_info_struct(png_structp png_ptr)
|
||||
{
|
||||
@ -195,23 +243,65 @@ png_create_info_struct(png_structp png_ptr)
|
||||
|
||||
if ((info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO)) != NULL)
|
||||
{
|
||||
png_memset(info_ptr, 0, sizeof(png_info));
|
||||
png_ptr->do_free |= PNG_FREE_INFO;
|
||||
png_info_init(info_ptr);
|
||||
}
|
||||
|
||||
return info_ptr;
|
||||
}
|
||||
|
||||
/* This function frees the memory associated with a single info struct.
|
||||
Normally, one would use either png_destroy_read_struct() or
|
||||
png_destroy_write_struct() to free an info struct, but this may be
|
||||
useful for some applications. */
|
||||
void
|
||||
png_info_init(png_infop info)
|
||||
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
||||
{
|
||||
png_infop info_ptr = NULL;
|
||||
|
||||
if (info_ptr_ptr)
|
||||
info_ptr = *info_ptr_ptr;
|
||||
|
||||
if (info_ptr)
|
||||
{
|
||||
png_info_destroy(png_ptr, info_ptr);
|
||||
|
||||
png_destroy_struct((png_voidp)info_ptr);
|
||||
*info_ptr_ptr = (png_infop)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the info structure. This is now an internal function (0.89)
|
||||
and applications using it are urged to use png_create_info_struct()
|
||||
instead. */
|
||||
void
|
||||
png_info_init(png_infop info_ptr)
|
||||
{
|
||||
/* set everything to 0 */
|
||||
png_memset(info, 0, sizeof (png_info));
|
||||
png_memset(info_ptr, 0, sizeof (png_info));
|
||||
}
|
||||
|
||||
/* This is an internal routine to free any memory that the info struct is
|
||||
pointing to before re-using it or freeing the struct itself. */
|
||||
void
|
||||
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
#if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < info_ptr->num_text; i++)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->text[i].key);
|
||||
}
|
||||
|
||||
png_free(png_ptr, info_ptr->text);
|
||||
#endif
|
||||
|
||||
png_info_init(info_ptr);
|
||||
}
|
||||
|
||||
/* This function returns a pointer to the io_ptr associated with the user
|
||||
functions. The application should free any memory associated with this
|
||||
pointer before png_write_destroy and png_read_destroy are called. */
|
||||
pointer before png_write_destroy() or png_read_destroy() are called. */
|
||||
png_voidp
|
||||
png_get_io_ptr(png_structp png_ptr)
|
||||
{
|
||||
|
467
png.h
467
png.h
@ -1,8 +1,8 @@
|
||||
|
||||
/* png.h - header file for png reference library
|
||||
|
||||
libpng 1.0 beta 3 - version 0.89
|
||||
May 25, 1996
|
||||
libpng 1.0 beta 4 - version 0.90
|
||||
January 10, 1997
|
||||
|
||||
Note: This is a beta version. It reads and writes valid files
|
||||
on the platforms I have, and has had a wide testing program.
|
||||
@ -10,14 +10,15 @@
|
||||
your system, and you may have to supply the correct compiler
|
||||
flags in the makefile, if you can't find a makefile suitable for
|
||||
your operating system/compiler combination. Read the libpng.txt
|
||||
for more information, and how to contact me if you have any
|
||||
for more information, and how to contact the authors if you have any
|
||||
problems, or if you want your compiler/platform to be supported
|
||||
in the next official libpng release.
|
||||
|
||||
See libpng.txt for more information
|
||||
See libpng.txt for more information.
|
||||
|
||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
Copyright (c) 1995, 1996, 1997 Guy Eric Schalnat, Group 42, Inc.
|
||||
Contributing Authors:
|
||||
Sam Bushnell
|
||||
Andreas Dilger
|
||||
Dave Martindale
|
||||
Guy Eric Schalnat
|
||||
@ -57,6 +58,10 @@
|
||||
#ifndef _PNG_H
|
||||
#define _PNG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
with some code to build around. This file is useful for looking
|
||||
@ -71,15 +76,14 @@
|
||||
/* This file is arranged in several sections. The first section details
|
||||
the functions most users will use. The third section describes the
|
||||
stub files that users will most likely need to change. The last
|
||||
section contains functions used internally by the code.
|
||||
*/
|
||||
section contains functions used internally by the code. */
|
||||
|
||||
/* version information for png.h - this should match the version
|
||||
number in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "0.89"
|
||||
/* careful here. I wanted to use 089, but that would be octal. Version
|
||||
#define PNG_LIBPNG_VER_STRING "0.90"
|
||||
/* careful here. I wanted to use 090, but that would be octal. Version
|
||||
1.0 will be 100 here, etc. */
|
||||
#define PNG_LIBPNG_VER 89
|
||||
#define PNG_LIBPNG_VER 90
|
||||
|
||||
/* variables defined in png.c - only it needs to define PNG_NO_EXTERN */
|
||||
#ifndef PNG_NO_EXTERN
|
||||
@ -154,9 +158,8 @@ typedef png_time FAR * FAR * png_timepp;
|
||||
If you are reading the file, This structure will tell you what is
|
||||
in the png file. If you are writing the file, fill in the information
|
||||
you want to put into the png file, then call png_write_info().
|
||||
The names chosen should be very close to the PNG
|
||||
specification, so consult that document for information
|
||||
about the meaning of each field. */
|
||||
The names chosen should be very close to the PNG specification, so
|
||||
consult that document for information about the meaning of each field. */
|
||||
typedef struct png_info_struct
|
||||
{
|
||||
/* the following are necessary for every png file */
|
||||
@ -177,6 +180,7 @@ typedef struct png_info_struct
|
||||
png_byte channels; /* number of channels of data per pixel */
|
||||
png_byte pixel_depth; /* number of bits per pixel */
|
||||
png_byte spare_byte; /* To align the data, and for future use */
|
||||
png_byte signature[8]; /* Signature read from start of file */
|
||||
|
||||
/* the rest are optional. If you are reading, check the valid
|
||||
field to see if the information in these are valid. If you
|
||||
@ -318,12 +322,11 @@ struct png_struct_def
|
||||
png_rw_ptr read_data_fn; /* Function for reading input data */
|
||||
png_voidp io_ptr; /* Pointer to user supplied struct for I/O functions */
|
||||
|
||||
png_byte mode; /* used to determine where we are in the png file */
|
||||
png_uint_32 do_free; /* flags indicating if libpng should free memory */
|
||||
png_uint_32 mode; /* used to determine where we are in the png file */
|
||||
png_uint_32 flags; /* flags indicating various things to libpng */
|
||||
png_uint_32 transformations; /* which transformations to perform */
|
||||
|
||||
z_stream * zstream; /* pointer to decompression structure (below) */
|
||||
z_stream zstream; /* pointer to decompression structure (below) */
|
||||
png_bytep zbuf; /* buffer for zlib */
|
||||
png_uint_32 zbuf_size; /* size of zbuf */
|
||||
int zlib_level; /* holds zlib compression level */
|
||||
@ -340,12 +343,12 @@ struct png_struct_def
|
||||
png_uint_32 iwidth; /* interlaced width */
|
||||
png_uint_32 irowbytes; /* interlaced rowbytes */
|
||||
png_uint_32 row_number; /* current row in pass */
|
||||
png_bytep row_buf; /* row buffer */
|
||||
png_bytep prev_row; /* previous row */
|
||||
png_bytep sub_row; /* place to save row when filtering */
|
||||
png_bytep up_row; /* place to save row when filtering */
|
||||
png_bytep avg_row; /* place to save row when filtering */
|
||||
png_bytep paeth_row; /* place to save row when filtering */
|
||||
png_bytep prev_row; /* place to save previous (unfiltered) row */
|
||||
png_bytep row_buf; /* place to save current (unfiltered) row */
|
||||
png_bytep sub_row; /* place to save "sub" row when filtering */
|
||||
png_bytep up_row; /* place to save "up" row when filtering */
|
||||
png_bytep avg_row; /* place to save "avg" row when filtering */
|
||||
png_bytep paeth_row; /* place to save "Paeth" row when filtering */
|
||||
png_row_info row_info; /* used for transformation routines */
|
||||
|
||||
png_uint_32 idat_size; /* current idat size for read */
|
||||
@ -353,17 +356,20 @@ struct png_struct_def
|
||||
png_colorp palette; /* files palette */
|
||||
png_uint_16 num_palette; /* number of entries in palette */
|
||||
png_uint_16 num_trans; /* number of transparency values */
|
||||
png_byte interlaced; /* interlace type of file */
|
||||
png_byte pass; /* current pass (0 - 6) */
|
||||
png_byte compression; /* compression type of file */
|
||||
png_byte filter; /* filter type */
|
||||
png_byte do_filter; /* non-zero if row filtering, zero if not */
|
||||
png_byte chunk_name[5]; /* name of current chunk being processed + '\0' */
|
||||
png_byte compression; /* file compression type (currently only '0' used) */
|
||||
png_byte filter; /* file filter type (currently only '0' used) */
|
||||
png_byte interlaced; /* file interlace type (currently only '0' and '1') */
|
||||
png_byte pass; /* current interlace pass (0 - 6) */
|
||||
png_byte do_filter; /* zero if not row filtering, non-zero if filtering */
|
||||
png_byte color_type; /* color type of file */
|
||||
png_byte bit_depth; /* bit depth of file */
|
||||
png_byte usr_bit_depth; /* bit depth of users row */
|
||||
png_byte pixel_depth; /* number of bits per pixel */
|
||||
png_byte channels; /* number of channels in file */
|
||||
png_byte usr_channels; /* channels at start of write */
|
||||
png_byte sig_bytes; /* signature bytes read/written from start of file */
|
||||
|
||||
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
png_byte filler; /* filler byte to be used for 32-bit frame buffers */
|
||||
@ -420,7 +426,6 @@ struct png_struct_def
|
||||
png_uint_32 current_buffer_size;
|
||||
int process_mode;
|
||||
int cur_palette;
|
||||
png_byte push_chunk_name[4];
|
||||
#if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
|
||||
png_uint_32 current_text_size;
|
||||
png_uint_32 current_text_left;
|
||||
@ -445,44 +450,37 @@ struct png_struct_def
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
/* flags for png_set_filter() to say which filters to use. The flags
|
||||
are chosen so that they don't conflict with real filter types, in case they
|
||||
are supplied instead of the #defined constants.
|
||||
*/
|
||||
#define PNG_NO_FILTERS 0x00
|
||||
#define PNG_FILTER_NONE 0x08
|
||||
#define PNG_FILTER_SUB 0x10
|
||||
#define PNG_FILTER_UP 0x20
|
||||
#define PNG_FILTER_AVG 0x40
|
||||
#define PNG_FILTER_PAETH 0x80
|
||||
#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
|
||||
PNG_FILTER_AVG | PNG_FILTER_PAETH)
|
||||
|
||||
/* Here are the function definitions most commonly used. This is not
|
||||
the place to find out how to use libpng. See libpng.txt for the
|
||||
full explanation, see example.c for the summary. This just provides
|
||||
a simple one line of the use of each function. */
|
||||
|
||||
/* check the first 1 - 8 bytes to see if it is a png file */
|
||||
/* Tell lib we have already handled the first <num_bytes> magic bytes.
|
||||
Handling more than 8 bytes from the beginning of the file is an error. */
|
||||
extern void png_set_sig_bytes PNGARG((png_structp png_ptr, int num_bytes));
|
||||
|
||||
/* Check sig[start] through sig[start + num_to_check] to see if it's a PNG
|
||||
file. Returns zero if the supplied bytes match the 8-byte PNG signature,
|
||||
and non-zero otherwise. Having num_to_check == 0 or start > 7 will
|
||||
always fail (ie return non-zero). */
|
||||
extern int png_sig_cmp PNGARG((png_bytep sig, int start, int num_to_check));
|
||||
|
||||
/* (Obsolete) signature checking function. This is the same as calling
|
||||
png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). To be removed in a
|
||||
future version. */
|
||||
extern int png_check_sig PNGARG((png_bytep sig, int num));
|
||||
|
||||
/* allocate and initialize png structure for reading, and any other memory */
|
||||
/* Allocate and initialize png structure for reading, and any other memory. */
|
||||
extern png_structp png_create_read_struct PNGARG((png_const_charp user_png_ver,
|
||||
voidp error_ptr, png_error_ptr warn_fn, png_error_ptr error_fn));
|
||||
voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn));
|
||||
|
||||
/* reset the png_struct to read a new image */
|
||||
extern void png_reset_read_struct PNGARG((png_structpp png_ptr));
|
||||
|
||||
/* initialize png structure for reading, and allocate any other memory (old) */
|
||||
extern void png_read_init PNGARG((png_structp png_ptr));
|
||||
|
||||
/* allocate and initialize png structure for reading, and any other memory */
|
||||
extern png_structp png_create_write_struct
|
||||
PNGARG((png_const_charp user_png_ver, voidp error_ptr,
|
||||
png_error_ptr warn_fn, png_error_ptr error_fn));
|
||||
|
||||
/* reset the png_struct to read a new image */
|
||||
extern void png_reset_write_struct PNGARG((png_structpp png_ptr));
|
||||
png_error_ptr error_fn, png_error_ptr warn_fn));
|
||||
|
||||
/* initialize png structure for writing, and allocate any other memory (old) */
|
||||
extern void png_write_init PNGARG((png_structp png_ptr));
|
||||
@ -491,13 +489,13 @@ extern void png_write_init PNGARG((png_structp png_ptr));
|
||||
extern png_infop png_create_info_struct PNGARG((png_structp png_ptr));
|
||||
|
||||
/* initialize the info structure (old interface) */
|
||||
extern void png_info_init PNGARG((png_infop info));
|
||||
extern void png_info_init PNGARG((png_infop info_ptr));
|
||||
|
||||
/* Writes all the png information before the image. */
|
||||
extern void png_write_info PNGARG((png_structp png_ptr, png_infop info));
|
||||
extern void png_write_info PNGARG((png_structp png_ptr, png_infop info_ptr));
|
||||
|
||||
/* read the information before the actual image data. */
|
||||
extern void png_read_info PNGARG((png_structp png_ptr, png_infop info));
|
||||
extern void png_read_info PNGARG((png_structp png_ptr, png_infop info_ptr));
|
||||
|
||||
#if defined(PNG_WRITE_tIME_SUPPORTED)
|
||||
/* convert from a struct tm to png_time */
|
||||
@ -524,15 +522,23 @@ extern void png_set_bgr PNGARG((png_structp png_ptr));
|
||||
extern void png_set_gray_to_rgb PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||
/* Reduce RGB to grayscale. (Not yet implemented) */
|
||||
extern void png_set_rgb_to_gray PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
extern void png_build_grayscale_palette PNGARG((int bit_depth,
|
||||
png_colorp palette));
|
||||
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
#define PNG_FILLER_BEFORE 0
|
||||
#define PNG_FILLER_AFTER 1
|
||||
/* Add a filler byte to rgb images. */
|
||||
extern void png_set_filler PNGARG((png_structp png_ptr, int filler,
|
||||
extern void png_set_filler PNGARG((png_structp png_ptr, png_byte filler,
|
||||
int flags));
|
||||
|
||||
/* old ways of doing this, still supported through 1.x for backwards
|
||||
compatability, but not suggested */
|
||||
/* Old way of doing this, still supported through 1.x for backwards
|
||||
compatability, but should not be used in new code. */
|
||||
|
||||
/* Add a filler byte to rgb images after the colors. */
|
||||
extern void png_set_rgbx PNGARG((png_structp png_ptr));
|
||||
@ -584,11 +590,6 @@ extern void png_set_background PNGARG((png_structp png_ptr,
|
||||
extern void png_set_strip_16 PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_GRAY_TO_RGB_SUPPORTED)
|
||||
/* convert a grayscale file into rgb. */
|
||||
extern void png_set_gray_to_rgb PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_DITHER_SUPPORTED)
|
||||
/* Turn on dithering, and reduce the palette to the number of colors available. */
|
||||
extern void png_set_dither PNGARG((png_structp png_ptr, png_colorp palette,
|
||||
@ -644,40 +645,74 @@ extern void png_write_rows PNGARG((png_structp png_ptr,
|
||||
extern void png_write_image PNGARG((png_structp png_ptr, png_bytepp image));
|
||||
|
||||
/* writes the end of the png file. */
|
||||
extern void png_write_end PNGARG((png_structp png_ptr, png_infop info));
|
||||
extern void png_write_end PNGARG((png_structp png_ptr, png_infop info_ptr));
|
||||
|
||||
/* read the end of the png file. */
|
||||
extern void png_read_end PNGARG((png_structp png_ptr, png_infop info));
|
||||
extern void png_read_end PNGARG((png_structp png_ptr, png_infop info_ptr));
|
||||
|
||||
/* free the info structure */
|
||||
/* free any memory associated with the info_struct */
|
||||
extern void png_destroy_info_struct PNGARG((png_structp png_ptr,
|
||||
png_infopp info_ptr));
|
||||
png_infopp info_ptr_ptr));
|
||||
|
||||
/* free any memory associated with the png_struct and the info_structs */
|
||||
extern void png_destroy_read_struct PNGARG((png_structpp png_ptr,
|
||||
png_infopp info, png_infopp end_info));
|
||||
extern void png_destroy_read_struct PNGARG((png_structpp png_ptr_ptr,
|
||||
png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
|
||||
|
||||
/* free all memory used by the read (old method) */
|
||||
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info,
|
||||
png_infop end_info));
|
||||
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||
png_infop end_info_ptr));
|
||||
|
||||
/* free any memory associated with the png_struct and the info_structs */
|
||||
extern void png_destroy_write_struct PNGARG((png_structpp png_ptr,
|
||||
png_infopp info));
|
||||
extern void png_destroy_write_struct PNGARG((png_structpp png_ptr_ptr,
|
||||
png_infopp info_ptr_ptr));
|
||||
|
||||
/* free any memory used in png struct */
|
||||
extern void png_write_destroy PNGARG((png_structp png_ptr));
|
||||
|
||||
/* These functions give the user control over the filtering and
|
||||
compression libraries used by zlib. These functions are mainly
|
||||
useful for testing, as the defaults should work with most users.
|
||||
Those users who are tight on memory, or are wanting faster
|
||||
performance at the expense of compression can modify them.
|
||||
See the compression library header file for an explination
|
||||
of these functions */
|
||||
/* set the libpng method of handling chunk CRC errors */
|
||||
extern void png_set_crc_action PNGARG((png_structp png_ptr, int crit_action,
|
||||
int ancil_action));
|
||||
|
||||
/* Values for png_set_crc_action() to say how to handle CRC errors in
|
||||
ancillary and critical chunks, and whether to use the data contained
|
||||
therein. Note that it is impossible to "discard" data in a critical
|
||||
chunk. For versions prior to 0.90, the action was always error/quit,
|
||||
whereas in version 0.90, the action for CRC errors in ancillary
|
||||
chunks is warn/discard.
|
||||
|
||||
value action:critical action:ancillary
|
||||
*/
|
||||
#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */
|
||||
#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */
|
||||
#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */
|
||||
#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */
|
||||
#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
|
||||
#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
|
||||
|
||||
/* These functions give the user control over the scan-line filtering
|
||||
in libpng and the compression methods used by zlib. These functions are
|
||||
mainly useful for testing, as the defaults should work with most users.
|
||||
Those users who are tight on memory, or are wanting faster performance
|
||||
at the expense of compression can modify them. See the compression
|
||||
library header file for an explination of the compression functions */
|
||||
|
||||
/* set the filtering method(s) used by libpng */
|
||||
extern void png_set_filter PNGARG((png_structp png_ptr, int method,
|
||||
int filters));
|
||||
|
||||
/* Flags for png_set_filter() to say which filters to use. The flags
|
||||
are chosen so that they don't conflict with real filter types, in case they
|
||||
are supplied instead of the #defined constants.
|
||||
*/
|
||||
#define PNG_NO_FILTERS 0x00
|
||||
#define PNG_FILTER_NONE 0x08
|
||||
#define PNG_FILTER_SUB 0x10
|
||||
#define PNG_FILTER_UP 0x20
|
||||
#define PNG_FILTER_AVG 0x40
|
||||
#define PNG_FILTER_PAETH 0x80
|
||||
#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
|
||||
PNG_FILTER_AVG | PNG_FILTER_PAETH)
|
||||
|
||||
extern void png_set_compression_level PNGARG((png_structp png_ptr,
|
||||
int level));
|
||||
|
||||
@ -712,12 +747,12 @@ extern void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
|
||||
/* Initialize the input/output for the png file to the default functions. */
|
||||
extern void png_init_io PNGARG((png_structp png_ptr, FILE *fp));
|
||||
|
||||
/* Replace the error message and abort, and warning functions with user
|
||||
supplied functions. If no messages are to be printed then you must
|
||||
supply replacement message functions. The replacement error_fn should
|
||||
/* Replace the (error and abort), and warning functions with user
|
||||
supplied functions. If no messages are to be printed you must still
|
||||
write and use replacement functions. The replacement error_fn should
|
||||
still do a longjmp to the last setjmp location if you are using this
|
||||
method of error handling. If error_fn or warning_fn is NULL, the
|
||||
default functions will be used. */
|
||||
default function will be used. */
|
||||
extern void png_set_error_fn PNGARG((png_structp png_ptr, png_voidp error_ptr,
|
||||
png_error_ptr error_fn, png_error_ptr warning_fn));
|
||||
|
||||
@ -748,27 +783,11 @@ extern void png_set_push_fn PNGARG((png_structp png_ptr, png_voidp push_ptr,
|
||||
extern png_voidp png_get_progressive_ptr PNGARG((png_structp png_ptr));
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
|
||||
extern png_voidp png_large_malloc PNGARG((png_structp png_ptr,
|
||||
extern png_voidp png_malloc PNGARG((png_structp png_ptr,
|
||||
png_uint_32 size));
|
||||
|
||||
/* free's a pointer allocated by png_large_malloc() */
|
||||
extern void png_large_free PNGARG((png_structp png_ptr, png_voidp ptr));
|
||||
|
||||
/* Allocate memory. */
|
||||
extern void * png_malloc PNGARG((png_structp png_ptr, png_uint_32 size));
|
||||
|
||||
/* Reallocate memory. */
|
||||
extern void * png_realloc PNGARG((png_structp png_ptr, void * ptr,
|
||||
png_uint_32 size, png_uint_32 old_size));
|
||||
|
||||
/* free's a pointer allocated by png_malloc() */
|
||||
extern void png_free PNGARG((png_structp png_ptr, void * ptr));
|
||||
|
||||
/* allocate memory for an internal libpng struct */
|
||||
extern png_voidp png_create_struct PNGARG((uInt type));
|
||||
|
||||
/* free memory from internal libpng struct */
|
||||
extern void png_destroy_struct PNGARG((voidp struct_ptr));
|
||||
extern void png_free PNGARG((png_structp png_ptr, png_voidp ptr));
|
||||
|
||||
/* Fatal error in libpng - can't continue */
|
||||
extern void png_error PNGARG((png_structp png_ptr, png_const_charp error));
|
||||
@ -786,33 +805,27 @@ extern void png_warning PNGARG((png_structp png_ptr, png_const_charp message));
|
||||
|
||||
#if defined(PNG_INTERNAL)
|
||||
|
||||
/* various modes of operation. Note that after an init, mode is set to
|
||||
zero automatically */
|
||||
#define PNG_BEFORE_IHDR 0x00
|
||||
#define PNG_HAVE_IHDR 0x01
|
||||
#define PNG_HAVE_PLTE 0x02
|
||||
#define PNG_HAVE_IDAT 0x04
|
||||
#define PNG_AT_LAST_IDAT 0x08
|
||||
#define PNG_AFTER_IDAT 0x10
|
||||
#define PNG_AFTER_IEND 0x20
|
||||
/* Various modes of operation. Note that after an init, mode is set to
|
||||
zero automatically when the structure is created. */
|
||||
#define PNG_BEFORE_IHDR 0x00
|
||||
#define PNG_HAVE_IHDR 0x01
|
||||
#define PNG_HAVE_PLTE 0x02
|
||||
#define PNG_HAVE_IDAT 0x04
|
||||
#define PNG_AFTER_IDAT 0x08
|
||||
#define PNG_HAVE_IEND 0x10
|
||||
|
||||
/* push model modes */
|
||||
#define PNG_READ_SIG_MODE 0
|
||||
#define PNG_READ_CHUNK_MODE 1
|
||||
#define PNG_READ_IDAT_MODE 2
|
||||
#define PNG_READ_PLTE_MODE 3
|
||||
#define PNG_READ_END_MODE 4
|
||||
#define PNG_SKIP_MODE 5
|
||||
#define PNG_READ_tEXt_MODE 6
|
||||
#define PNG_READ_zTXt_MODE 7
|
||||
#define PNG_READ_DONE_MODE 8
|
||||
#define PNG_ERROR_MODE 9
|
||||
#define PNG_READ_END_MODE 3
|
||||
#define PNG_SKIP_MODE 4
|
||||
#define PNG_READ_tEXt_MODE 5
|
||||
#define PNG_READ_zTXt_MODE 6
|
||||
#define PNG_READ_DONE_MODE 7
|
||||
#define PNG_ERROR_MODE 8
|
||||
|
||||
/* read modes */
|
||||
#define PNG_READ_PULL_MODE 0
|
||||
#define PNG_READ_PUSH_MODE 1
|
||||
|
||||
/* defines for the transformations the png library does on the image data */
|
||||
/* defines for the transformations the PNG library does on the image data */
|
||||
#define PNG_BGR 0x0001
|
||||
#define PNG_INTERLACE 0x0002
|
||||
#define PNG_PACK 0x0004
|
||||
@ -822,7 +835,7 @@ extern void png_warning PNGARG((png_structp png_ptr, png_const_charp message));
|
||||
#define PNG_DITHER 0x0040
|
||||
#define PNG_BACKGROUND 0x0080
|
||||
#define PNG_BACKGROUND_EXPAND 0x0100
|
||||
#define PNG_XRGB 0x0200
|
||||
#define PNG_RGB_TO_GRAY 0x0200
|
||||
#define PNG_16_TO_8 0x0400
|
||||
#define PNG_RGBA 0x0800
|
||||
#define PNG_EXPAND 0x1000
|
||||
@ -830,28 +843,37 @@ extern void png_warning PNGARG((png_structp png_ptr, png_const_charp message));
|
||||
#define PNG_GRAY_TO_RGB 0x4000
|
||||
#define PNG_FILLER 0x8000
|
||||
|
||||
/* flags for png_ptr->do_free to say if memory in png_info needs to be freed */
|
||||
#define PNG_FREE_PALETTE 0x0001
|
||||
#define PNG_FREE_HIST 0x0002
|
||||
#define PNG_FREE_TRANS 0x0004
|
||||
#define PNG_FREE_STRUCT 0x0008
|
||||
#define PNG_FREE_INFO 0x0010
|
||||
|
||||
/* flags for png_create_struct */
|
||||
#define PNG_STRUCT_PNG 0x0001
|
||||
#define PNG_STRUCT_INFO 0x0002
|
||||
|
||||
/* flags for the png_ptr->flags rather than declaring a bye for each one */
|
||||
#define PNG_FLAG_WROTE_tIME 0x0001
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0002
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0004
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0008
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0010
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0020
|
||||
#define PNG_FLAG_ZLIB_FINISHED 0x0040
|
||||
#define PNG_FLAG_ROW_INIT 0x0080
|
||||
#define PNG_FLAG_FILLER_AFTER 0x0100
|
||||
#define PNG_FLAG_HAVE_CHUNK_HEADER 0x0200
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010
|
||||
#define PNG_FLAG_ZLIB_FINISHED 0x0020
|
||||
#define PNG_FLAG_ROW_INIT 0x0040
|
||||
#define PNG_FLAG_FILLER_AFTER 0x0080
|
||||
#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
|
||||
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
|
||||
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
|
||||
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
|
||||