libpng/png.h

1360 lines
52 KiB
C
Raw Normal View History

1995-07-20 07:43:20 +00:00
/* png.h - header file for png reference library
1995-09-26 10:22:39 +00:00
1996-06-05 20:50:50 +00:00
libpng 1.0 beta 3 - version 0.89
May 25, 1996
1995-07-20 07:43:20 +00:00
1996-01-16 07:51:56 +00:00
Note: This is a beta version. It reads and writes valid files
on the platforms I have, but it has had limited portability
testing. Furthermore, you may have to modify the
includes below to get it to work on your system, and you
may have to supply the correct compiler flags in the makefile.
Read the readme.txt for more information, and how to contact
me if you have any problems, or if you want your compiler/
platform to be supported in the next official libpng release.
1995-07-20 07:43:20 +00:00
1996-01-16 07:51:56 +00:00
See readme.txt for more information
1995-07-20 07:43:20 +00:00
1996-01-10 08:56:49 +00:00
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
1996-01-16 07:51:56 +00:00
Contributing Authors:
1996-01-10 08:56:49 +00:00
Andreas Dilger
1995-09-26 10:22:39 +00:00
Dave Martindale
1996-01-16 07:51:56 +00:00
Guy Eric Schalnat
Paul Schmidt
Tim Wegner
1996-01-10 08:56:49 +00:00
1996-01-16 07:51:56 +00:00
The contributing authors would like to thank all those who helped
with testing, bug fixes, and patience. You know who you are. This
wouldn't have been possible without all of you.
1996-01-10 08:56:49 +00:00
1996-01-26 07:38:47 +00:00
Thanks to Frank J. T. Wojcik for helping with the documentation
1995-07-20 07:43:20 +00:00
The PNG Reference Library is supplied "AS IS". The Contributing Authors
and Group 42, Inc. disclaim all warranties, expressed or implied,
including, without limitation, the warranties of merchantability and of
fitness for any purpose. The Contributing Authors and Group 42, Inc.
assume no liability for damages, direct or consequential, which may
result from the use of the PNG Reference Library.
Permission is hereby granted to use, copy, modify, and distribute this
source code, or portions hereof, for any purpose, without fee, subject
to the following restrictions:
1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must not be
1996-01-26 07:38:47 +00:00
misrepresented as being the original source.
1996-01-16 07:51:56 +00:00
3. This Copyright notice may not be removed or altered from any source or
1996-01-26 07:38:47 +00:00
altered source distribution.
1995-07-20 07:43:20 +00:00
1996-01-16 07:51:56 +00:00
The Contributing Authors and Group 42, Inc. specifically permit, without
fee, and encourage the use of this source code as a component to
supporting the PNG file format in commercial products. If you use this
source code in a product, acknowledgment is not required but would be
appreciated.
*/
1995-07-20 07:43:20 +00:00
#ifndef _PNG_H
#define _PNG_H
/* 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
at the actual function definitions and structure components. */
/* include the compression library's header */
#include "zlib.h"
1995-09-26 10:22:39 +00:00
/* include all user configurable info */
#include "pngconf.h"
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
/* 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.
1996-01-16 07:51:56 +00:00
*/
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
/* version information for png.h - this should match the version
number in png.c */
1996-06-05 20:50:50 +00:00
#define PNG_LIBPNG_VER_STRING "0.89"
/* careful here. I wanted to use 089, but that would be octal. Version
1996-01-16 07:51:56 +00:00
1.0 will be 100 here, etc. */
1996-06-05 20:50:50 +00:00
#define PNG_LIBPNG_VER 89
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
/* variables defined in png.c - only it needs to define PNG_NO_EXTERN */
#ifndef PNG_NO_EXTERN
/* version information for c files, stored in png.c. This better match
the version above. */
extern char png_libpng_ver[];
1995-07-20 07:43:20 +00:00
#endif
/* three color definitions. The order of the red, green, and blue, (and the
exact size) is not important, although the size of the fields need to
1996-06-05 20:50:50 +00:00
be png_byte or png_uint_16 (as defined below). */
1995-07-20 07:43:20 +00:00
typedef struct png_color_struct
{
1996-01-16 07:51:56 +00:00
png_byte red;
1995-07-20 07:43:20 +00:00
png_byte green;
png_byte blue;
} png_color;
1996-01-26 07:38:47 +00:00
typedef png_color FAR * png_colorp;
1995-12-19 09:22:19 +00:00
typedef png_color FAR * FAR * png_colorpp;
1995-07-20 07:43:20 +00:00
typedef struct png_color_16_struct
{
png_byte index; /* used for palette files */
png_uint_16 red; /* for use in red green blue files */
png_uint_16 green;
png_uint_16 blue;
1996-01-16 07:51:56 +00:00
png_uint_16 gray; /* for use in grayscale files */
1995-07-20 07:43:20 +00:00
} png_color_16;
1996-01-26 07:38:47 +00:00
typedef png_color_16 FAR * png_color_16p;
1995-12-19 09:22:19 +00:00
typedef png_color_16 FAR * FAR * png_color_16pp;
1995-07-20 07:43:20 +00:00
typedef struct png_color_8_struct
{
png_byte red; /* for use in red green blue files */
png_byte green;
png_byte blue;
png_byte gray; /* for use in grayscale files */
png_byte alpha; /* for alpha channel files */
} png_color_8;
1996-01-26 07:38:47 +00:00
typedef png_color_8 FAR * png_color_8p;
1995-12-19 09:22:19 +00:00
typedef png_color_8 FAR * FAR * png_color_8pp;
1995-07-20 07:43:20 +00:00
/* png_text holds the text in a png file, and whether they are compressed
or not. If compression is -1, the text is not compressed. */
typedef struct png_text_struct
{
int compression; /* compression value, -1 if uncompressed */
1996-01-16 07:51:56 +00:00
png_charp key; /* keyword */
png_charp text; /* comment */
png_uint_32 text_length; /* length of text field */
1995-07-20 07:43:20 +00:00
} png_text;
1996-01-26 07:38:47 +00:00
typedef png_text FAR * png_textp;
1995-12-19 09:22:19 +00:00
typedef png_text FAR * FAR * png_textpp;
1995-07-20 07:43:20 +00:00
/* png_time is a way to hold the time in an machine independent way.
Two conversions are provided, both from time_t and struct tm. There
is no portable way to convert to either of these structures, as far
as I know. If you know of a portable way, send it to me. */
typedef struct png_time_struct
{
png_uint_16 year; /* full year, as in, 1995 */
png_byte month; /* month of year, 1 - 12 */
png_byte day; /* day of month, 1 - 31 */
png_byte hour; /* hour of day, 0 - 23 */
png_byte minute; /* minute of hour, 0 - 59 */
1996-01-16 07:51:56 +00:00
png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
1995-07-20 07:43:20 +00:00
} png_time;
1996-01-26 07:38:47 +00:00
typedef png_time FAR * png_timep;
1995-12-19 09:22:19 +00:00
typedef png_time FAR * FAR * png_timepp;
1995-07-20 07:43:20 +00:00
/* png_info is a structure that holds the information in a png file.
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. */
typedef struct png_info_struct
{
1996-01-16 07:51:56 +00:00
/* the following are necessary for every png file */
1995-07-20 07:43:20 +00:00
png_uint_32 width; /* with of file */
png_uint_32 height; /* height of file */
1996-06-05 20:50:50 +00:00
png_uint_32 valid; /* the PNG_INFO_ defines, OR'd together */
png_uint_32 rowbytes; /* bytes needed for untransformed row */
png_colorp palette; /* palette of file */
png_uint_16 num_palette; /* number of values in palette */
png_uint_16 num_trans; /* number of trans values */
1995-07-20 07:43:20 +00:00
png_byte bit_depth; /* 1, 2, 4, 8, or 16 */
1996-01-16 07:51:56 +00:00
png_byte color_type; /* use the PNG_COLOR_TYPE_ defines */
png_byte compression_type; /* must be 0 */
1995-07-20 07:43:20 +00:00
png_byte filter_type; /* must be 0 */
png_byte interlace_type; /* 0 for non-interlaced, 1 for interlaced */
/* the following is informational only on read, and not used on
writes */
png_byte channels; /* number of channels of data per pixel */
png_byte pixel_depth; /* number of bits per pixel */
1996-06-05 20:50:50 +00:00
png_byte spare_byte; /* To align the data, and for future use */
1995-09-26 10:22:39 +00:00
1995-07-20 07:43:20 +00:00
/* the rest are optional. If you are reading, check the valid
field to see if the information in these are valid. If you
are writing, set the valid field to those chunks you want
1996-01-16 07:51:56 +00:00
written, and initialize the appropriate fields below */
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_WRITE_gAMA_SUPPORTED)
1995-07-20 07:43:20 +00:00
float gamma; /* gamma value of file, if gAMA chunk is valid */
1995-09-26 10:22:39 +00:00
#endif
1996-06-05 20:50:50 +00:00
#if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED)
int num_text; /* number of comments */
int max_text; /* size of text array */
png_textp text; /* array of comments */
#endif
#if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
png_time mod_time; /* modification time */
#endif
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_sBIT_SUPPORTED) || defined(PNG_WRITE_sBIT_SUPPORTED)
1996-01-16 07:51:56 +00:00
png_color_8 sig_bit; /* significant bits */
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_WRITE_tRNS_SUPPORTED)
1995-12-19 09:22:19 +00:00
png_bytep trans; /* tRNS values for palette image */
1996-01-16 07:51:56 +00:00
png_color_16 trans_values; /* tRNS values for non-palette image */
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_bKGD_SUPPORTED) || defined(PNG_WRITE_bKGD_SUPPORTED)
1996-01-16 07:51:56 +00:00
png_color_16 background; /* background color of image */
1995-09-26 10:22:39 +00:00
#endif
1996-06-05 20:50:50 +00:00
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
png_uint_32 x_offset; /* x offset on page */
png_uint_32 y_offset; /* y offset on page */
png_byte offset_unit_type; /* offset units type */
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
1996-01-16 07:51:56 +00:00
png_uint_32 x_pixels_per_unit; /* x resolution */
1995-07-20 07:43:20 +00:00
png_uint_32 y_pixels_per_unit; /* y resolution */
png_byte phys_unit_type; /* resolution type */
1995-09-26 10:22:39 +00:00
#endif
1996-06-05 20:50:50 +00:00
#if defined(PNG_READ_hIST_SUPPORTED) || defined(PNG_WRITE_hIST_SUPPORTED)
png_uint_16p hist; /* histogram of palette usage */
1995-09-26 10:22:39 +00:00
#endif
1996-06-05 20:50:50 +00:00
#if defined(PNG_READ_cHRM_SUPPORTED) || defined(PNG_WRITE_cHRM_SUPPORTED)
float x_white; /* cHRM chunk values */
float y_white;
float x_red;
float y_red;
float x_green;
float y_green;
float x_blue;
float y_blue;
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
} png_info;
1996-01-26 07:38:47 +00:00
typedef png_info FAR * png_infop;
1995-12-19 09:22:19 +00:00
typedef png_info FAR * FAR * png_infopp;
1995-07-20 07:43:20 +00:00
#define PNG_RESOLUTION_UNKNOWN 0
1996-06-05 20:50:50 +00:00
#define PNG_RESOLUTION_METER 1
#define PNG_RESOLUTION_LAST 2
1995-07-20 07:43:20 +00:00
1996-06-05 20:50:50 +00:00
#define PNG_OFFSET_PIXEL 0
#define PNG_OFFSET_MICROMETER 1
#define PNG_OFFSET_LAST 2
1995-07-20 07:43:20 +00:00
/* these describe the color_type field in png_info */
/* color type masks */
#define PNG_COLOR_MASK_PALETTE 1
1996-06-05 20:50:50 +00:00
#define PNG_COLOR_MASK_COLOR 2
#define PNG_COLOR_MASK_ALPHA 4
1995-07-20 07:43:20 +00:00
/* color types. Note that not all combinations are legal */
1996-06-05 20:50:50 +00:00
#define PNG_COLOR_TYPE_GRAY 0
1995-07-20 07:43:20 +00:00
#define PNG_COLOR_TYPE_PALETTE \
(PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
#define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
#define PNG_COLOR_TYPE_RGB_ALPHA \
(PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
/* These determine if a chunks information is present in a read operation, or
1996-01-16 07:51:56 +00:00
if the chunk should be written in a write operation. */
1995-07-20 07:43:20 +00:00
#define PNG_INFO_gAMA 0x0001
#define PNG_INFO_sBIT 0x0002
#define PNG_INFO_cHRM 0x0004
#define PNG_INFO_PLTE 0x0008
#define PNG_INFO_tRNS 0x0010
#define PNG_INFO_bKGD 0x0020
#define PNG_INFO_hIST 0x0040
#define PNG_INFO_pHYs 0x0080
#define PNG_INFO_oFFs 0x0100
#define PNG_INFO_tIME 0x0200
/* this is used for the transformation routines, as some of them
1996-01-16 07:51:56 +00:00
change these values for the row. It also should enable using
1995-07-20 07:43:20 +00:00
the routines for other uses. */
typedef struct png_row_info_struct
{
1996-01-16 07:51:56 +00:00
png_uint_32 width; /* width of row */
png_uint_32 rowbytes; /* number of bytes in row */
png_byte color_type; /* color type of row */
png_byte bit_depth; /* bit depth of row */
png_byte channels; /* number of channels (1, 2, 3, or 4) */
png_byte pixel_depth; /* bits per pixel (depth * channels) */
1995-07-20 07:43:20 +00:00
} png_row_info;
1996-01-26 07:38:47 +00:00
typedef png_row_info FAR * png_row_infop;
1995-12-19 09:22:19 +00:00
typedef png_row_info FAR * FAR * png_row_infopp;
1995-11-28 17:22:13 +00:00
/* These are the function types for the I/O functions, and the functions which
1996-06-05 20:50:50 +00:00
* modify the default I/O functions to user I/O functions. The png_error_ptr
1995-11-28 17:22:13 +00:00
* type should match that of user supplied warning and error functions, while
* the png_rw_ptr type should match that of the user read/write data functions.
*/
1995-12-19 09:22:19 +00:00
typedef struct png_struct_def png_struct;
typedef png_struct FAR * png_structp;
1996-06-05 20:50:50 +00:00
typedef void (*png_error_ptr) PNGARG((png_structp, png_const_charp));
1995-12-19 09:22:19 +00:00
typedef void (*png_rw_ptr) PNGARG((png_structp, png_bytep, png_uint_32));
typedef void (*png_flush_ptr) PNGARG((png_structp));
1996-01-10 08:56:49 +00:00
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1995-12-19 09:22:19 +00:00
typedef void (*png_progressive_info_ptr) PNGARG((png_structp, png_infop));
typedef void (*png_progressive_end_ptr) PNGARG((png_structp, png_infop));
typedef void (*png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
1996-01-16 07:51:56 +00:00
png_uint_32, int));
1995-12-19 09:22:19 +00:00
#endif
/* The structure that holds the information to read and write png files.
1996-01-16 07:51:56 +00:00
The only people who need to care about what is inside of this are the
people who will be modifying the library for their own special needs.
*/
1995-11-28 17:22:13 +00:00
1996-01-10 08:56:49 +00:00
struct png_struct_def
1995-07-20 07:43:20 +00:00
{
1996-01-16 07:51:56 +00:00
jmp_buf jmpbuf; /* used in png_error */
1996-06-05 20:50:50 +00:00
png_error_ptr error_fn; /* Function for printing errors and aborting */
png_error_ptr warning_fn; /* Function for printing warnings */
png_voidp error_ptr; /* user supplied struct for error functions */
png_rw_ptr write_data_fn; /* Function for writing output data */
png_rw_ptr read_data_fn; /* Function for reading input data */
png_voidp io_ptr; /* Pointer to user supplied struct for I/O functions */
1996-01-16 07:51:56 +00:00
png_byte mode; /* used to determine where we are in the png file */
1996-06-05 20:50:50 +00:00
png_uint_32 do_free; /* flags indicating if libpng should free memory */
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) */
png_bytep zbuf; /* buffer for zlib */
png_uint_32 zbuf_size; /* size of zbuf */
1995-09-26 10:22:39 +00:00
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
1996-01-16 07:51:56 +00:00
int zlib_window_bits; /* holds zlib compression window bits */
1995-09-26 10:22:39 +00:00
int zlib_mem_level; /* holds zlib compression memory level */
1996-01-16 07:51:56 +00:00
int zlib_strategy; /* holds zlib compression strategy */
1996-06-05 20:50:50 +00:00
1996-01-16 07:51:56 +00:00
png_uint_32 width; /* width of file */
png_uint_32 height; /* height of file */
png_uint_32 num_rows; /* number of rows in current pass */
png_uint_32 rowbytes; /* size of row in bytes */
png_uint_32 usr_width; /* width of row at start of write */
png_uint_32 iwidth; /* interlaced width */
1995-07-20 07:43:20 +00:00
png_uint_32 irowbytes; /* interlaced rowbytes */
png_uint_32 row_number; /* current row in pass */
1996-06-05 20:50:50 +00:00
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_row_info row_info; /* used for transformation routines */
1996-01-16 07:51:56 +00:00
png_uint_32 idat_size; /* current idat size for read */
1996-06-05 20:50:50 +00:00
png_uint_32 crc; /* current crc value */
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 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 */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_byte filler; /* filler byte to be used for 32-bit frame buffers */
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
png_byte background_gamma_type;
float background_gamma;
png_color_16 background; /* background color, gamma corrected for screen */
#if defined(PNG_READ_GAMMA_SUPPORTED)
png_color_16 background_1; /* background normalized to gamma 1.0 */
#endif
#endif
1995-12-19 09:22:19 +00:00
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
1996-06-05 20:50:50 +00:00
png_flush_ptr output_flush_fn;/* Function for flushing output */
1996-01-16 07:51:56 +00:00
png_uint_32 flush_dist; /* how many rows apart to flush, 0 for no flush */
png_uint_32 flush_rows; /* number of rows written since last flush */
1995-12-19 09:22:19 +00:00
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
1996-06-05 20:50:50 +00:00
#if defined(PNG_READ_GAMMA_SUPPORTED)
int gamma_shift; /* amount of shift for 16 bit gammas */
float gamma; /* file gamma value */
float display_gamma; /* display gamma value */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep gamma_table; /* gamma table for 8 bit depth files */
png_bytep gamma_from_1; /* converts from 1.0 to screen */
png_bytep gamma_to_1; /* converts from file to 1.0 */
png_uint_16pp gamma_16_table; /* gamma table for 16 bit depth files */
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined (PNG_READ_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in file */
#endif
#if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep trans; /* transparency values for paletted files */
png_color_16 trans_values; /* transparency values for non-paletted files */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8 shift; /* shift for significant bit tranformation */
#endif
1995-12-19 09:22:19 +00:00
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1996-06-05 20:50:50 +00:00
png_progressive_info_ptr info_fn;
png_progressive_row_ptr row_fn;
png_progressive_end_ptr end_fn;
png_bytep save_buffer_ptr;
png_bytep save_buffer;
png_bytep current_buffer_ptr;
png_bytep current_buffer;
1996-01-16 07:51:56 +00:00
png_uint_32 push_length;
png_uint_32 skip_length;
png_uint_32 save_buffer_size;
png_uint_32 save_buffer_max;
png_uint_32 buffer_size;
png_uint_32 current_buffer_size;
1996-06-05 20:50:50 +00:00
int process_mode;
int cur_palette;
png_byte push_chunk_name[4];
1995-12-19 09:22:19 +00:00
#if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
1996-01-16 07:51:56 +00:00
png_uint_32 current_text_size;
png_uint_32 current_text_left;
png_charp current_text;
png_charp current_text_ptr;
#endif
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* for the Borland special 64K segment handler */
png_bytepp offset_table_ptr;
png_bytep offset_table;
png_uint_16 offset_table_number;
png_uint_16 offset_table_count;
png_uint_16 offset_table_count_free;
#endif
1996-06-05 20:50:50 +00:00
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_DITHER_SUPPORTED)
1996-01-16 07:51:56 +00:00
png_bytep palette_lookup; /* lookup table for dithering */
png_bytep dither_index; /* index translation for palette files */
png_uint_16p hist; /* histogram */
1995-09-26 10:22:39 +00:00
#endif
1995-11-28 17:22:13 +00:00
};
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
typedef png_struct FAR * FAR * png_structpp;
1996-06-05 20:50:50 +00:00
/* 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)
1995-07-20 07:43:20 +00:00
/* Here are the function definitions most commonly used. This is not
1996-01-16 07:51:56 +00:00
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. */
1995-07-20 07:43:20 +00:00
/* check the first 1 - 8 bytes to see if it is a png file */
1995-12-19 09:22:19 +00:00
extern int png_check_sig PNGARG((png_bytep sig, int num));
1995-07-20 07:43:20 +00:00
1996-06-05 20:50:50 +00:00
/* 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));
/* 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) */
1995-12-19 09:22:19 +00:00
extern void png_read_init PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
1996-06-05 20:50:50 +00:00
/* 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));
/* initialize png structure for writing, and allocate any other memory (old) */
1995-12-19 09:22:19 +00:00
extern void png_write_init PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
1996-06-05 20:50:50 +00:00
/* allocate and initialize the info structure */
extern png_infop png_create_info_struct PNGARG((png_structp png_ptr));
/* initialize the info structure (old interface) */
1995-12-19 09:22:19 +00:00
extern void png_info_init PNGARG((png_infop info));
1995-07-20 07:43:20 +00:00
/* Writes all the png information before the image. */
1995-12-19 09:22:19 +00:00
extern void png_write_info PNGARG((png_structp png_ptr, png_infop info));
1995-07-20 07:43:20 +00:00
/* read the information before the actual image data. */
1995-12-19 09:22:19 +00:00
extern void png_read_info PNGARG((png_structp png_ptr, png_infop info));
1995-07-20 07:43:20 +00:00
1995-11-28 17:22:13 +00:00
#if defined(PNG_WRITE_tIME_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* convert from a struct tm to png_time */
1995-12-19 09:22:19 +00:00
extern void png_convert_from_struct_tm PNGARG((png_timep ptime,
1996-06-05 20:50:50 +00:00
struct tm FAR * ttime));
1995-07-20 07:43:20 +00:00
/* convert from time_t to png_time. Uses gmtime() */
1995-12-19 09:22:19 +00:00
extern void png_convert_from_time_t PNGARG((png_timep ptime, time_t ttime));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_EXPAND_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Expand the data to 24 bit RGB, or 8 bit Grayscale,
with alpha if necessary. */
1995-12-19 09:22:19 +00:00
extern void png_set_expand PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Use blue, green, red order for pixels. */
1995-12-19 09:22:19 +00:00
extern void png_set_bgr PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1996-01-10 08:56:49 +00:00
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
/* Expand the grayscale to 24 bit RGB if necessary. */
extern void png_set_gray_to_rgb PNGARG((png_structp png_ptr));
#endif
1995-09-26 10:22:39 +00:00
#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. */
1995-12-19 09:22:19 +00:00
extern void png_set_filler PNGARG((png_structp png_ptr, int filler,
1996-06-05 20:50:50 +00:00
int flags));
1995-09-26 10:22:39 +00:00
/* old ways of doing this, still supported through 1.x for backwards
compatability, but not suggested */
1995-07-20 07:43:20 +00:00
/* Add a filler byte to rgb images after the colors. */
1995-12-19 09:22:19 +00:00
extern void png_set_rgbx PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
/* Add a filler byte to rgb images before the colors. */
1995-12-19 09:22:19 +00:00
extern void png_set_xrgb PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Swap bytes in 16 bit depth files. */
1995-12-19 09:22:19 +00:00
extern void png_set_swap PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Use 1 byte per pixel in 1, 2, or 4 bit depth files. */
1995-12-19 09:22:19 +00:00
extern void png_set_packing PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Converts files to legal bit depths. */
1995-12-19 09:22:19 +00:00
extern void png_set_shift PNGARG((png_structp png_ptr,
png_color_8p true_bits));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
defined(PNG_WRITE_INTERLACING_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Have the code handle the interlacing. Returns the number of passes. */
1995-12-19 09:22:19 +00:00
extern int png_set_interlace_handling PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Invert monocrome files */
1995-12-19 09:22:19 +00:00
extern void png_set_invert_mono PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Handle alpha and tRNS by replacing with a background color. */
1996-06-05 20:50:50 +00:00
#define PNG_BACKGROUND_GAMMA_UNKNOWN 0
#define PNG_BACKGROUND_GAMMA_SCREEN 1
#define PNG_BACKGROUND_GAMMA_FILE 2
#define PNG_BACKGROUND_GAMMA_UNIQUE 3
1995-12-19 09:22:19 +00:00
extern void png_set_background PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_color_16p background_color, int background_gamma_code,
1995-09-26 10:22:39 +00:00
int need_expand, double background_gamma));
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_16_TO_8_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* strip the second byte of information from a 16 bit depth file. */
1995-12-19 09:22:19 +00:00
extern void png_set_strip_16 PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
#if defined(PNG_GRAY_TO_RGB_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* convert a grayscale file into rgb. */
1995-12-19 09:22:19 +00:00
extern void png_set_gray_to_rgb PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_DITHER_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Turn on dithering, and reduce the palette to the number of colors available. */
1995-12-19 09:22:19 +00:00
extern void png_set_dither PNGARG((png_structp png_ptr, png_colorp palette,
1996-01-16 07:51:56 +00:00
int num_palette, int maximum_colors, png_uint_16p histogram,
int full_dither));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_GAMMA_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* Handle gamma correction. */
1995-12-19 09:22:19 +00:00
extern void png_set_gamma PNGARG((png_structp png_ptr, double screen_gamma,
1995-09-26 10:22:39 +00:00
double default_file_gamma));
#endif
1995-07-20 07:43:20 +00:00
1995-11-28 17:22:13 +00:00
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
/* Set how many lines between output flushes - 0 for no flushing */
1995-12-19 09:22:19 +00:00
extern void png_set_flush PNGARG((png_structp png_ptr, int nrows));
1995-11-28 17:22:13 +00:00
/* Flush the current PNG output buffer */
1995-12-19 09:22:19 +00:00
extern void png_write_flush PNGARG((png_structp png_ptr));
1995-11-28 17:22:13 +00:00
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
1995-07-20 07:43:20 +00:00
/* optional update palette with requested transformations */
1995-12-19 09:22:19 +00:00
extern void png_start_read_image PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
/* optional call to update the users info structure */
1995-12-19 09:22:19 +00:00
extern void png_read_update_info PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_infop info_ptr));
1995-07-20 07:43:20 +00:00
/* read a one or more rows of image data.*/
1995-12-19 09:22:19 +00:00
extern void png_read_rows PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_bytepp row,
png_bytepp display_row, png_uint_32 num_rows));
1995-07-20 07:43:20 +00:00
/* read a row of data.*/
1995-12-19 09:22:19 +00:00
extern void png_read_row PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_bytep row,
png_bytep display_row));
1995-07-20 07:43:20 +00:00
/* read the whole image into memory at once. */
1995-12-19 09:22:19 +00:00
extern void png_read_image PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_bytepp image));
1995-07-20 07:43:20 +00:00
/* write a row of image data */
1995-12-19 09:22:19 +00:00
extern void png_write_row PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_bytep row));
1995-07-20 07:43:20 +00:00
/* write a few rows of image data */
1995-12-19 09:22:19 +00:00
extern void png_write_rows PNGARG((png_structp png_ptr,
png_bytepp row,
1995-07-20 07:43:20 +00:00
png_uint_32 num_rows));
/* write the image data */
1995-12-19 09:22:19 +00:00
extern void png_write_image PNGARG((png_structp png_ptr, png_bytepp image));
1995-07-20 07:43:20 +00:00
/* writes the end of the png file. */
1995-12-19 09:22:19 +00:00
extern void png_write_end PNGARG((png_structp png_ptr, png_infop info));
1995-07-20 07:43:20 +00:00
/* read the end of the png file. */
1995-12-19 09:22:19 +00:00
extern void png_read_end PNGARG((png_structp png_ptr, png_infop info));
1995-07-20 07:43:20 +00:00
1996-06-05 20:50:50 +00:00
/* free the info structure */
extern void png_destroy_info_struct PNGARG((png_structp png_ptr,
png_infopp info_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));
/* free all memory used by the read (old method) */
1995-12-19 09:22:19 +00:00
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_infop end_info));
1995-07-20 07:43:20 +00:00
1996-06-05 20:50:50 +00:00
/* 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));
1995-07-20 07:43:20 +00:00
/* free any memory used in png struct */
1995-12-19 09:22:19 +00:00
extern void png_write_destroy PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
/* 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.
1996-01-16 07:51:56 +00:00
Those users who are tight on memory, or are wanting faster
1995-09-26 10:22:39 +00:00
performance at the expense of compression can modify them.
See the compression library header file for an explination
of these functions */
1996-06-05 20:50:50 +00:00
extern void png_set_filter PNGARG((png_structp png_ptr, int method,
int filters));
1995-09-26 10:22:39 +00:00
1995-12-19 09:22:19 +00:00
extern void png_set_compression_level PNGARG((png_structp png_ptr,
1995-09-26 10:22:39 +00:00
int level));
1995-12-19 09:22:19 +00:00
extern void png_set_compression_mem_level PNGARG((png_structp png_ptr,
1995-09-26 10:22:39 +00:00
int mem_level));
1995-12-19 09:22:19 +00:00
extern void png_set_compression_strategy PNGARG((png_structp png_ptr,
1995-09-26 10:22:39 +00:00
int strategy));
1995-12-19 09:22:19 +00:00
extern void png_set_compression_window_bits PNGARG((png_structp png_ptr,
1995-09-26 10:22:39 +00:00
int window_bits));
1995-12-19 09:22:19 +00:00
extern void png_set_compression_method PNGARG((png_structp png_ptr,
1995-09-26 10:22:39 +00:00
int method));
1995-07-20 07:43:20 +00:00
1996-06-05 20:50:50 +00:00
/* These next functions are called for input/output, memory, and error
handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
and call standard C I/O routines such as fread(), fwrite(), and
fprintf(). These functions can be made to use other I/O routines
at run time for those applications that need to handle I/O in a
different manner by calling png_set_???_fn(). See libpng.txt for
1996-01-16 07:51:56 +00:00
more information */
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
/* Write the data to whatever output you are using. */
extern void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
png_uint_32 length));
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
/* Read data from whatever input you are using */
extern void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1995-07-20 07:43:20 +00:00
1996-01-10 08:56:49 +00:00
/* Initialize the input/output for the png file to the default functions. */
1995-12-19 09:22:19 +00:00
extern void png_init_io PNGARG((png_structp png_ptr, FILE *fp));
1995-07-20 07:43:20 +00:00
1995-11-28 17:22:13 +00:00
/* Replace the error message and abort, and warning functions with user
1996-01-16 07:51:56 +00:00
supplied functions. If no messages are to be printed then you must
supply replacement message 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. */
1996-06-05 20:50:50 +00:00
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));
1995-07-20 07:43:20 +00:00
1996-06-05 20:50:50 +00:00
/* Return the user pointer associated with the error functions */
extern png_voidp png_get_error_ptr PNGARG((png_structp png_ptr));
1995-11-28 17:22:13 +00:00
/* Replace the default data output functions with a user supplied one(s).
1996-01-16 07:51:56 +00:00
If buffered output is not used, then output_flush_fn can be set to NULL.
If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
output_flush_fn will be ignored (and thus can be NULL). */
1995-12-19 09:22:19 +00:00
extern void png_set_write_fn PNGARG((png_structp png_ptr, png_voidp io_ptr,
1996-01-16 07:51:56 +00:00
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
1995-11-28 17:22:13 +00:00
/* Replace the default data input function with a user supplied one. */
1996-01-16 07:51:56 +00:00
extern void png_set_read_fn PNGARG((png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn));
1995-11-28 17:22:13 +00:00
/* Return the user pointer associated with the I/O functions */
1995-12-19 09:22:19 +00:00
extern png_voidp png_get_io_ptr PNGARG((png_structp png_ptr));
1996-01-16 07:51:56 +00:00
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1995-12-19 09:22:19 +00:00
/* Replace the default push model read functions */
extern void png_set_push_fn PNGARG((png_structp png_ptr, png_voidp push_ptr,
1996-01-16 07:51:56 +00:00
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
png_progressive_end_ptr end_fn));
1995-12-19 09:22:19 +00:00
1996-01-16 07:51:56 +00:00
/* returns the user pointer associated with the push read functions */
1996-01-10 08:56:49 +00:00
extern png_voidp png_get_progressive_ptr PNGARG((png_structp png_ptr));
1996-01-16 07:51:56 +00:00
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
1995-12-19 09:22:19 +00:00
extern png_voidp png_large_malloc PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_uint_32 size));
1995-12-19 09:22:19 +00:00
/* free's a pointer allocated by png_large_malloc() */
extern void png_large_free PNGARG((png_structp png_ptr, png_voidp ptr));
/* Allocate memory. */
1996-01-16 07:51:56 +00:00
extern void * png_malloc PNGARG((png_structp png_ptr, png_uint_32 size));
1995-12-19 09:22:19 +00:00
/* Reallocate memory. */
1996-01-16 07:51:56 +00:00
extern void * png_realloc PNGARG((png_structp png_ptr, void * ptr,
1995-12-19 09:22:19 +00:00
png_uint_32 size, png_uint_32 old_size));
/* free's a pointer allocated by png_malloc() */
1996-01-16 07:51:56 +00:00
extern void png_free PNGARG((png_structp png_ptr, void * ptr));
1995-12-19 09:22:19 +00:00
1996-06-05 20:50:50 +00:00
/* allocate memory for an internal libpng struct */
extern voidp png_create_struct PNGARG((uInt type));
/* free memory from internal libpng struct */
extern void png_destroy_struct PNGARG((voidp struct_ptr));
1995-12-19 09:22:19 +00:00
/* Fatal error in libpng - can't continue */
extern void png_error PNGARG((png_structp png_ptr, png_const_charp error));
/* Non-fatal error in libpng. Can continue, but may have a problem. */
extern void png_warning PNGARG((png_structp png_ptr, png_const_charp message));
1995-07-20 07:43:20 +00:00
/* These next functions are used internally in the code. If you use
them, make sure you read and understand the png spec. More information
about them can be found in the files where the functions are.
Feel free to move any of these outside the PNG_INTERNAL define if
you just need a few of them, but if you need access to more, you should
define PNG_INTERNAL inside your code, so everyone who includes png.h
won't get yet another definition the compiler has to deal with. */
1996-06-05 20:50:50 +00:00
#if defined(PNG_INTERNAL)
1995-07-20 07:43:20 +00:00
/* various modes of operation. Note that after an init, mode is set to
zero automatically */
1996-06-05 20:50:50 +00:00
#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
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
/* push model modes */
1996-06-05 20:50:50 +00:00
#define PNG_READ_SIG_MODE 0
1995-12-19 09:22:19 +00:00
#define PNG_READ_CHUNK_MODE 1
1996-06-05 20:50:50 +00:00
#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
1995-12-19 09:22:19 +00:00
/* read modes */
#define PNG_READ_PULL_MODE 0
#define PNG_READ_PUSH_MODE 1
1995-07-20 07:43:20 +00:00
/* defines for the transformations the png library does on the image data */
1996-06-05 20:50:50 +00:00
#define PNG_BGR 0x0001
#define PNG_INTERLACE 0x0002
#define PNG_PACK 0x0004
#define PNG_SHIFT 0x0008
#define PNG_SWAP_BYTES 0x0010
#define PNG_INVERT_MONO 0x0020
#define PNG_DITHER 0x0040
#define PNG_BACKGROUND 0x0080
#define PNG_BACKGROUND_EXPAND 0x0100
#define PNG_XRGB 0x0200
#define PNG_16_TO_8 0x0400
#define PNG_RGBA 0x0800
#define PNG_EXPAND 0x1000
#define PNG_GAMMA 0x2000
#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
1995-07-20 07:43:20 +00:00
/* save typing and make code easier to understand */
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
abs((int)((c1).green) - (int)((c2).green)) + \
abs((int)((c1).blue) - (int)((c2).blue)))
/* variables defined in png.c - only it needs to define PNG_NO_EXTERN */
#ifndef PNG_NO_EXTERN
/* place to hold the signiture string for a png file. */
extern png_byte png_sig[];
1995-09-26 10:22:39 +00:00
/* version information for c files, stored in png.c. */
extern char png_libpng_ver[];
1995-07-20 07:43:20 +00:00
/* constant strings for known chunk types. If you need to add a chunk,
1996-06-05 20:50:50 +00:00
add a string holding the name here. See png.c for more details. We
can't selectively include these, since we still check for chunk in the
wrong locations with these labels. */
1995-12-19 09:22:19 +00:00
extern png_byte FARDATA png_IHDR[];
extern png_byte FARDATA png_IDAT[];
extern png_byte FARDATA png_IEND[];
extern png_byte FARDATA png_PLTE[];
extern png_byte FARDATA png_gAMA[];
extern png_byte FARDATA png_sBIT[];
extern png_byte FARDATA png_cHRM[];
extern png_byte FARDATA png_tRNS[];
extern png_byte FARDATA png_bKGD[];
extern png_byte FARDATA png_hIST[];
extern png_byte FARDATA png_tEXt[];
extern png_byte FARDATA png_zTXt[];
extern png_byte FARDATA png_pHYs[];
extern png_byte FARDATA png_oFFs[];
extern png_byte FARDATA png_tIME[];
1995-07-20 07:43:20 +00:00
/* Structures to facilitate easy interlacing. See png.c for more details */
1995-12-19 09:22:19 +00:00
extern int FARDATA png_pass_start[];
extern int FARDATA png_pass_inc[];
extern int FARDATA png_pass_ystart[];
extern int FARDATA png_pass_yinc[];
1995-07-20 07:43:20 +00:00
/* these are not currently used. If you need them, see png.c
1995-12-19 09:22:19 +00:00
extern int FARDATA png_pass_width[];
extern int FARDATA png_pass_height[];
1995-07-20 07:43:20 +00:00
*/
1995-12-19 09:22:19 +00:00
extern int FARDATA png_pass_mask[];
extern int FARDATA png_pass_dsp_mask[];
1995-07-20 07:43:20 +00:00
#endif /* PNG_NO_EXTERN */
/* Function to allocate memory for zlib. */
1995-09-26 10:22:39 +00:00
extern voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
1995-07-20 07:43:20 +00:00
/* function to free memory for zlib */
1995-09-26 10:22:39 +00:00
extern void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
1995-07-20 07:43:20 +00:00
/* reset the crc variable */
1995-12-19 09:22:19 +00:00
extern void png_reset_crc PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
/* 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. See the
code in png.c for more information. */
1995-12-19 09:22:19 +00:00
extern void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1995-12-19 09:22:19 +00:00
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
1996-01-16 07:51:56 +00:00
extern void png_flush PNGARG((png_structp png_ptr));
1995-12-19 09:22:19 +00:00
#endif
1995-07-20 07:43:20 +00:00
/* place a 32 bit number into a buffer in png byte order. We work
1996-01-16 07:51:56 +00:00
with unsigned numbers for convenience, you may have to cast
signed numbers (if you use any, most png data is unsigned). */
1995-12-19 09:22:19 +00:00
extern void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
1995-07-20 07:43:20 +00:00
/* place a 16 bit number into a buffer in png byte order */
1995-12-19 09:22:19 +00:00
extern void png_save_uint_16 PNGARG((png_bytep buf, png_uint_16 i));
1995-07-20 07:43:20 +00:00
/* write a 32 bit number */
1995-12-19 09:22:19 +00:00
extern void png_write_uint_32 PNGARG((png_structp png_ptr, png_uint_32 i));
1995-07-20 07:43:20 +00:00
/* write a 16 bit number */
1995-12-19 09:22:19 +00:00
extern void png_write_uint_16 PNGARG((png_structp png_ptr, png_uint_16 i));
1995-07-20 07:43:20 +00:00
/* Write a png chunk. */
1995-12-19 09:22:19 +00:00
extern void png_write_chunk PNGARG((png_structp png_ptr, png_bytep type,
1996-01-16 07:51:56 +00:00
png_bytep data, png_uint_32 length));
1995-07-20 07:43:20 +00:00
/* Write the start of a png chunk. */
1995-12-19 09:22:19 +00:00
extern void png_write_chunk_start PNGARG((png_structp png_ptr, png_bytep type,
1996-01-16 07:51:56 +00:00
png_uint_32 total_length));
1995-07-20 07:43:20 +00:00
/* write the data of a png chunk started with png_write_chunk_start(). */
1995-12-19 09:22:19 +00:00
extern void png_write_chunk_data PNGARG((png_structp png_ptr, png_bytep data,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1995-07-20 07:43:20 +00:00
/* finish a chunk started with png_write_chunk_start() */
1995-12-19 09:22:19 +00:00
extern void png_write_chunk_end PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
/* simple function to write the signiture */
1995-12-19 09:22:19 +00:00
extern void png_write_sig PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
/* write various chunks */
/* Write the IHDR chunk, and update the png_struct with the necessary
1996-01-16 07:51:56 +00:00
information. */
1995-12-19 09:22:19 +00:00
extern void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
1996-01-16 07:51:56 +00:00
png_uint_32 height,
int bit_depth, int color_type, int compression_type, int filter_type,
int interlace_type));
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
extern void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
1996-01-16 07:51:56 +00:00
int number));
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
extern void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
extern void png_write_IEND PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_gAMA_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_gAMA PNGARG((png_structp png_ptr, double gamma));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_sBIT_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
1996-01-16 07:51:56 +00:00
int color_type));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_cHRM_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_cHRM PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_tRNS_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
1996-01-16 07:51:56 +00:00
png_color_16p values, int number, int color_type));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_bKGD_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_bKGD PNGARG((png_structp png_ptr, png_color_16p values,
1995-07-20 07:43:20 +00:00
int color_type));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_hIST_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
1996-01-16 07:51:56 +00:00
int number));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_tEXt_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
1996-01-16 07:51:56 +00:00
png_charp text, png_uint_32 text_len));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_zTXt_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
1996-01-16 07:51:56 +00:00
png_charp text, png_uint_32 text_len, int compression));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_pHYs_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_pHYs PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_uint_32 x_pixels_per_unit,
png_uint_32 y_pixels_per_unit,
int unit_type));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_oFFs_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_oFFs PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_uint_32 x_offset,
1995-07-20 07:43:20 +00:00
png_uint_32 y_offset,
int unit_type));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_WRITE_tIME_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_write_tIME PNGARG((png_structp png_ptr, png_timep mod_time));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
/* Internal use only. Called when finished processing a row of data */
1995-12-19 09:22:19 +00:00
extern void png_write_finish_row PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
/* Internal use only. Called before first row of data */
1995-12-19 09:22:19 +00:00
extern void png_write_start_row PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
/* callbacks for png chunks */
1995-12-19 09:22:19 +00:00
extern void png_read_IHDR PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 width, png_uint_32 height, int bit_depth,
1996-01-16 07:51:56 +00:00
int color_type, int compression_type, int filter_type,
1995-07-20 07:43:20 +00:00
int interlace_type));
1995-09-26 10:22:39 +00:00
1995-12-19 09:22:19 +00:00
extern void png_read_PLTE PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_colorp palette, int num));
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_gAMA_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_gAMA PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
double gamma));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_sBIT PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_color_8p sig_bit));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_cHRM PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
double white_x, double white_y, double red_x, double red_y,
double green_x, double green_y, double blue_x, double blue_y));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_tRNS PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_bytep trans, int num_trans, png_color_16p trans_values));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_bKGD PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_color_16p background));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_hIST PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_uint_16p hist));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_pHYs PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_uint_32 res_x, png_uint_32 res_y, int unit_type));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_oFFs PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_uint_32 offset_x, png_uint_32 offset_y, int unit_type));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_tIME PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_timep mod_time));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_tEXt PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_charp key, png_charp text, png_uint_32 text_len));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_read_zTXt PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_charp key, png_charp text, png_uint_32 text_len, int compression));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_GAMMA_SUPPORTED)
1995-07-20 07:43:20 +00:00
void
1995-12-19 09:22:19 +00:00
png_build_gamma_table PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
/* combine a row of data, dealing with alpha, etc. if requested */
1995-12-19 09:22:19 +00:00
extern void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
1995-07-20 07:43:20 +00:00
int mask));
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_INTERLACING_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* expand an interlaced row */
1995-12-19 09:22:19 +00:00
extern void png_do_read_interlace PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row, int pass));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
1995-07-20 07:43:20 +00:00
/* grab pixels out of a row for an interlaced pass */
1995-12-19 09:22:19 +00:00
extern void png_do_write_interlace PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row, int pass));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
/* unfilter a row */
1996-06-05 20:50:50 +00:00
extern void png_read_filter_row PNGARG((png_structp png_ptr,
png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
/* choose the best filter to use and filter the row data */
extern void png_write_find_filter PNGARG((png_structp png_ptr,
png_row_infop row_info));
/* write out the filtered row */
extern void png_write_filtered_row PNGARG((png_structp png_ptr,
png_bytep filtered_row));
1995-07-20 07:43:20 +00:00
/* finish a row while reading, dealing with interlacing passes, etc. */
1995-12-19 09:22:19 +00:00
extern void png_read_finish_row PNGARG((png_structp png_ptr));
1995-07-20 07:43:20 +00:00
/* initialize the row buffers, etc. */
1995-12-19 09:22:19 +00:00
extern void png_read_start_row PNGARG((png_structp png_ptr));
1995-09-26 10:22:39 +00:00
/* optional call to update the users info structure */
1995-12-19 09:22:19 +00:00
extern void png_read_transform_info PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_infop info_ptr));
1995-07-20 07:43:20 +00:00
/* these are the functions that do the transformations */
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_FILLER_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_read_filler PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row, png_byte filler, png_byte filler_loc));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_write_filler PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row, png_byte filler_loc));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_PACK_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
png_color_8p sig_bits));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
1995-09-26 10:22:39 +00:00
#endif
1996-01-10 08:56:49 +00:00
extern void png_build_grayscale_palette PNGARG((int bit_depth,
1996-01-16 07:51:56 +00:00
png_colorp palette));
1996-01-10 08:56:49 +00:00
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_16_TO_8_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_DITHER_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_dither PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
1995-09-26 10:22:39 +00:00
#endif
1996-06-05 20:50:50 +00:00
#if defined(PNG_CORRECT_PALETTE_SUPPORTED)
extern void png_correct_palette PNGARG((png_structp png_ptr,
png_colorp palette, int num_palette));
#endif
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_WRITE_PACK_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_pack PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row, png_byte bit_depth));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
png_color_8p bit_depth));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background,
1996-01-16 07:51:56 +00:00
png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
png_uint_16pp gamma_16_to_1, int gamma_shift));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
1996-01-16 07:51:56 +00:00
png_bytep gamma_table, png_uint_16pp gamma_16_table,
1995-07-20 07:43:20 +00:00
int gamma_shift));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_do_expand_palette PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
1995-12-19 09:22:19 +00:00
extern void png_do_expand PNGARG((png_row_infop row_info,
1996-01-16 07:51:56 +00:00
png_bytep row, png_color_16p trans_value));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
/* unpack 16 and 32 bit values from a string */
1995-12-19 09:22:19 +00:00
extern png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
extern png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
1995-07-20 07:43:20 +00:00
/* read bytes into buf, and update png_ptr->crc */
1995-12-19 09:22:19 +00:00
extern void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
/* skip length bytes, and update png_ptr->crc */
1995-12-19 09:22:19 +00:00
extern void png_crc_skip PNGARG((png_structp png_ptr, png_uint_32 length));
1995-07-20 07:43:20 +00:00
/* the following decodes the appropriate chunks, and does error correction,
then calls the appropriate callback for the chunk if it is valid */
/* decode the IHDR chunk */
1995-12-19 09:22:19 +00:00
extern void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1995-12-19 09:22:19 +00:00
extern void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#if defined(PNG_READ_gAMA_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
1995-12-19 09:22:19 +00:00
extern void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info,
1995-07-20 07:43:20 +00:00
png_uint_32 length));
1995-09-26 10:22:39 +00:00
#endif
1995-07-20 07:43:20 +00:00
/* handle the transformations for reading and writing */
1995-12-19 09:22:19 +00:00
extern void png_do_read_transformations PNGARG((png_structp png_ptr));
extern void png_do_write_transformations PNGARG((png_structp png_ptr));
extern void png_init_read_transformations PNGARG((png_structp png_ptr));
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
extern void png_push_read_chunk PNGARG((png_structp png_ptr, png_infop info));
extern void png_push_read_sig PNGARG((png_structp png_ptr));
extern void png_push_check_crc PNGARG((png_structp png_ptr));
extern void png_push_crc_skip PNGARG((png_structp png_ptr, png_uint_32 length));
extern void png_push_skip PNGARG((png_structp png_ptr));
extern void png_push_fill_buffer PNGARG((png_structp png_ptr, png_bytep buffer,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1995-12-19 09:22:19 +00:00
extern void png_push_save_buffer PNGARG((png_structp png_ptr));
extern void png_push_restore_buffer PNGARG((png_structp png_ptr, png_bytep buffer,
1996-01-16 07:51:56 +00:00
png_uint_32 buffer_length));
1996-06-05 20:50:50 +00:00
extern void png_push_read_IDAT PNGARG((png_structp png_ptr));
1995-12-19 09:22:19 +00:00
extern void png_process_IDAT_data PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_bytep buffer, png_uint_32 buffer_length));
1995-12-19 09:22:19 +00:00
extern void png_push_process_row PNGARG((png_structp png_ptr));
extern void png_push_handle_PLTE PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1996-06-05 20:50:50 +00:00
extern void png_push_read_PLTE PNGARG((png_structp png_ptr, png_infop info));
1995-12-19 09:22:19 +00:00
extern void png_push_handle_tRNS PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1995-12-19 09:22:19 +00:00
extern void png_push_handle_hIST PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_uint_32 length));
1995-12-19 09:22:19 +00:00
extern void png_push_have_info PNGARG((png_structp png_ptr, png_infop info));
extern void png_push_have_end PNGARG((png_structp png_ptr, png_infop info));
extern void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
extern void png_push_read_end PNGARG((png_structp png_ptr, png_infop info));
extern void png_process_some_data PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_infop info));
1995-12-19 09:22:19 +00:00
extern void png_read_push_finish_row PNGARG((png_structp png_ptr));
#if defined(PNG_READ_tEXt_SUPPORTED)
1996-01-16 07:51:56 +00:00
extern void png_push_handle_tEXt PNGARG((png_structp png_ptr,
png_uint_32 length));
1996-06-05 20:50:50 +00:00
extern void png_push_read_tEXt PNGARG((png_structp png_ptr, png_infop info));
1995-12-19 09:22:19 +00:00
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
1996-01-16 07:51:56 +00:00
extern void png_push_handle_zTXt PNGARG((png_structp png_ptr,
png_uint_32 length));
1996-06-05 20:50:50 +00:00
extern void png_push_read_zTXt PNGARG((png_structp png_ptr, png_infop info));
1995-12-19 09:22:19 +00:00
#endif
1995-07-20 07:43:20 +00:00
1995-12-19 09:22:19 +00:00
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
1995-07-20 07:43:20 +00:00
#endif /* PNG_INTERNAL */
1995-12-19 09:22:19 +00:00
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
extern void png_process_data PNGARG((png_structp png_ptr, png_infop info,
1996-01-16 07:51:56 +00:00
png_bytep buffer, png_uint_32 buffer_size));
1995-12-19 09:22:19 +00:00
extern void png_set_progressive_read_fn PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_voidp progressive_ptr,
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
png_progressive_end_ptr end_fn));
1995-12-19 09:22:19 +00:00
extern void png_progressive_combine_row PNGARG((png_structp png_ptr,
1996-01-16 07:51:56 +00:00
png_bytep old_row, png_bytep new_row));
1995-12-19 09:22:19 +00:00
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
1995-07-20 07:43:20 +00:00
/* do not put anything past this line */
#endif /* _PNG_H */
1995-09-26 10:22:39 +00:00