Imported from libpng-0.99e.tar

This commit is contained in:
Glenn Randers-Pehrson
1998-02-28 07:00:24 -06:00
parent a357b99113
commit cbe52d8720
28 changed files with 843 additions and 694 deletions

446
libpng.3
View File

@@ -1,25 +1,10 @@
.TH PNG 5 "February 8, 1998"
.TH LIBPNG 3 "February 28, 1998"
.SH NAME
libpng \- Portable Network Graphics (PNG) format
libpng \- Portable Network Graphics (PNG) Reference Library
.SH SYNOPSIS
#include <png.h>
void png_build_gamma_table (png_structp png_ptr);
void png_build_grayscale_palette (int bit_depth, png_colorp
palette);
void png_calculate_crc (png_structp png_ptr, png_bytep ptr,
png_size_t length);
void png_check_chunk_name (png_structp png_ptr, png_bytep
chunk_name);
png_size_t png_check_keyword (png_structp png_ptr, png_charp
key, png_charpp new_key);
int png_check_sig (png_bytep sig, int num);
void png_chunk_error (png_structp png_ptr, png_const_charp
@@ -28,9 +13,6 @@ error);
void png_chunk_warning (png_structp png_ptr, png_const_charp
message);
void png_combine_row (png_structp png_ptr, png_bytep row, int
mask);
void png_convert_from_struct_tm (png_timep ptime, struct tm FAR
* ttime);
@@ -39,24 +21,12 @@ void png_convert_from_time_t (png_timep ptime, time_t ttime);
png_charp png_convert_to_rfc1123 (png_structp png_ptr,
png_timep ptime);
void png_correct_palette (png_structp png_ptr, png_colorp
palette, int num_palette);
int png_crc_error (png_structp png_ptr);
int png_crc_finish (png_structp png_ptr, png_uint_32 skip);
void png_crc_read (png_structp png_ptr, png_bytep buf,
png_size_t length);
png_infop png_create_info_struct (png_structp png_ptr);
png_structp png_create_read_struct (png_const_charp
user_png_ver, voidp error_ptr, png_error_ptr error_fn,
png_error_ptr warn_fn);
png_voidp png_create_struct (int type);
png_structp png_create_write_struct (png_const_charp
user_png_ver, voidp error_ptr, png_error_ptr error_fn,
png_error_ptr warn_fn);
@@ -72,93 +42,11 @@ info_ptr_ptr);
void png_destroy_read_struct (png_structpp png_ptr_ptr,
png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr);
void png_destroy_struct (png_voidp struct_ptr);
void png_destroy_write_struct (png_structpp png_ptr_ptr,
png_infopp info_ptr_ptr);
void png_do_background (png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background,
png_color_16p background_1, png_bytep gamma_table, png_bytep
gamma_from_1, png_bytep gamma_to_1, png_uint_16pp gamma_16,
png_uint_16pp gamma_16_from_1, png_uint_16pp gamma_16_to_1, int
gamma_shift);
void png_do_bgr (png_row_infop row_info, png_bytep row);
void png_do_chop (png_row_infop row_info, png_bytep row);
void png_do_dither (png_row_infop row_info, png_bytep row,
png_bytep palette_lookup, png_bytep dither_lookup);
void png_do_expand (png_row_infop row_info, png_bytep row,
png_color_16p trans_value);
void png_do_expand_palette (png_row_infop row_info, png_bytep
row, png_colorp palette, png_bytep trans, int num_trans);
void png_do_gamma (png_row_infop row_info, png_bytep row,
png_bytep gamma_table, png_uint_16pp gamma_16_table, int
gamma_shift);
void png_do_gray_to_rgb (png_row_infop row_info, png_bytep
row);
void png_do_invert (png_row_infop row_info, png_bytep row);
void png_do_pack (png_row_infop row_info, png_bytep row,
png_uint_32 bit_depth);
void png_do_packswap (png_row_infop row_info, png_bytep row);
void png_do_read_filler (png_row_infop row_info, png_bytep row,
png_uint_32 filler, png_uint_32 flags);
void png_do_read_interlace (png_row_infop row_info, png_bytep
row, int pass, png_uint_32 transformations);
void png_do_read_invert_alpha (png_row_infop row_info,
png_bytep row);
void png_do_read_swap_alpha (png_row_infop row_info, png_bytep
row);
void png_do_read_transformations (png_structp png_ptr);
void png_do_rgb_to_gray (png_row_infop row_info, png_bytep
row);
void png_do_shift (png_row_infop row_info, png_bytep row,
png_color_8p bit_depth);
void png_do_strip_filler (png_row_infop row_info, png_bytep
row, png_uint_32 flags);
void png_do_swap (png_row_infop row_info, png_bytep row);
void png_do_unpack (png_row_infop row_info, png_bytep row);
void png_do_unshift (png_row_infop row_info, png_bytep row,
png_color_8p sig_bits);
void png_do_write_interlace (png_row_infop row_info, png_bytep
row, int pass);
void png_do_write_invert_alpha (png_row_infop row_info,
png_bytep row);
void png_do_write_swap_alpha (png_row_infop row_info, png_bytep
row);
void png_do_write_transformations (png_structp png_ptr);
void png_error (png_structp png_ptr, png_const_charp error);
void *png_far_to_near (png_structp png_ptr,png_voidp ptr,
int check);
void png_flush (png_structp png_ptr);
void png_free (png_structp png_ptr, png_voidp ptr);
png_byte png_get_bit_depth (png_structp png_ptr, png_infop
@@ -198,8 +86,6 @@ png_infop info_ptr);
png_uint_32 png_get_image_width (png_structp png_ptr, png_infop
info_ptr);
png_int_32 png_get_int_32 (png_bytep buf);
png_byte png_get_interlace_type (png_structp png_ptr, png_infop
info_ptr);
@@ -255,10 +141,6 @@ png_uint_32 png_get_tRNS (png_structp png_ptr, png_infop
info_ptr, png_bytep *trans, int *num_trans, png_color_16p
*trans_values);
png_uint_16 png_get_uint_16 (png_bytep buf);
png_uint_32 png_get_uint_32 (png_bytep buf);
png_uint_32 png_get_valid (png_structp png_ptr, png_infop
info_ptr, png_uint_32 flag);
@@ -268,72 +150,22 @@ png_infop info_ptr);
png_uint_32 png_get_x_offset_pixels (png_structp png_ptr,
png_infop info_ptr);
png_uint_32 png_get_x_pixels_per_meter (png_structp png_ptr,
png_infop info_ptr);
png_uint_32 png_get_y_offset_microns (png_structp png_ptr,
png_infop info_ptr);
png_uint_32 png_get_y_offset_pixels (png_structp png_ptr,
png_infop info_ptr);
void png_handle_bKGD (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_cHRM (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_gAMA (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_hIST (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_IEND (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_IHDR (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_oFFs (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_pCAL (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_pHYs (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_PLTE (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_sBIT (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_sRGB (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_tEXt (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_tIME (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_tRNS (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_handle_unknown (png_structp png_ptr, png_infop
info_ptr, png_uint_32 length);
void png_handle_zTXt (png_structp png_ptr, png_infop info_ptr,
png_uint_32 length);
void png_info_destroy (png_structp png_ptr, png_infop
info_ptr);
png_uint_32 png_get_y_pixels_per_meter (png_structp png_ptr,
png_infop info_ptr);
void png_info_init (png_infop info_ptr);
void png_init_io (png_structp png_ptr, FILE *fp);
void png_init_read_transformations (png_structp png_ptr);
png_voidp png_malloc (png_structp png_ptr, png_uint_32 size);
voidp png_memcpy (png_voidp s1, png_voidp s2, png_size_t size);
@@ -349,109 +181,27 @@ s1, int value, png_uint_32 size);
void png_process_data (png_structp png_ptr, png_infop info_ptr,
png_bytep buffer, png_size_t buffer_size);
void png_process_IDAT_data (png_structp png_ptr, png_bytep
buffer, png_size_t buffer_length);
void png_process_some_data (png_structp png_ptr, png_infop
info_ptr);
void png_progressive_combine_row (png_structp png_ptr,
png_bytep old_row, png_bytep new_row);
void png_push_check_crc (png_structp png_ptr);
void png_push_crc_finish (png_structp png_ptr);
void png_push_crc_skip (png_structp png_ptr, png_uint_32
length);
void png_push_fill_buffer (png_structp png_ptr, png_bytep
buffer, png_size_t length);
void png_push_handle_tEXt (png_structp png_ptr, png_infop
info_ptr, png_uint_32 length);
void png_push_handle_unknown (png_structp png_ptr, png_infop
info_ptr, png_uint_32 length);
void png_push_handle_zTXt (png_structp png_ptr, png_infop
info_ptr, png_uint_32 length);
void png_push_have_end (png_structp png_ptr, png_infop
info_ptr);
void png_push_have_info (png_structp png_ptr, png_infop
info_ptr);
void png_push_have_row (png_structp png_ptr, png_bytep row);
void png_push_process_row (png_structp png_ptr);
void png_push_read_chunk (png_structp png_ptr, png_infop
info_ptr);
void png_push_read_end (png_structp png_ptr, png_infop
info_ptr);
void png_push_read_IDAT (png_structp png_ptr);
void png_push_read_sig (png_structp png_ptr, png_infop
info_ptr);
void png_push_read_tEXt (png_structp png_ptr, png_infop
info_ptr);
void png_push_read_zTXt (png_structp png_ptr, png_infop
info_ptr);
void png_push_restore_buffer (png_structp png_ptr, png_bytep
buffer, png_size_t buffer_length);
void png_push_save_buffer (png_structp png_ptr);
void png_read_data (png_structp png_ptr, png_bytep data,
png_size_t length);
void png_read_destroy (png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr);
void png_read_end (png_structp png_ptr, png_infop info_ptr);
void png_read_filter_row (png_structp png_ptr, png_row_infop
row_info, png_bytep row, png_bytep prev_row, int filter);
void png_read_finish_row (png_structp png_ptr);
void png_read_image (png_structp png_ptr, png_bytepp image);
void png_read_info (png_structp png_ptr, png_infop info_ptr);
void png_read_init (png_structp png_ptr);
void png_read_push_finish_row (png_structp png_ptr);
void png_read_row (png_structp png_ptr, png_bytep row,
png_bytep display_row);
void png_read_rows (png_structp png_ptr, png_bytepp row,
png_bytepp display_row, png_uint_32 num_rows);
void png_read_start_row (png_structp png_ptr);
void png_read_transform_info (png_structp png_ptr, png_infop
info_ptr);
void png_read_update_info (png_structp png_ptr, png_infop
info_ptr);
void png_reset_crc (png_structp png_ptr);
void png_save_int_32 (png_bytep buf, png_int_32 i);
void png_save_uint_16 (png_bytep buf, unsigned int i);
void png_save_uint_32 (png_bytep buf, png_uint_32 i);
void png_set_background (png_structp png_ptr, png_color_16p
background_color, int background_gamma_code, int need_expand,
double background_gamma);
@@ -595,9 +345,6 @@ void png_start_read_image (png_structp png_ptr);
void png_warning (png_structp png_ptr, png_const_charp
message);
void png_write_bKGD (png_structp png_ptr, png_color_16p values,
int color_type);
void png_write_chunk (png_structp png_ptr, png_bytep
chunk_name, png_bytep data, png_size_t length);
@@ -609,92 +356,23 @@ void png_write_chunk_end (png_structp png_ptr);
void png_write_chunk_start (png_structp png_ptr, png_bytep
chunk_name, png_uint_32 length);
void png_write_cHRM (png_structp png_ptr, double white_x,
double white_y, double red_x, double red_y, double green_x,
double green_y, double blue_x, double blue_y);
void png_write_data (png_structp png_ptr, png_bytep data,
png_size_t length);
void png_write_destroy (png_structp png_ptr);
void png_write_destroy_info (png_infop info_ptr);
void png_write_end (png_structp png_ptr, png_infop info_ptr);
void png_write_filtered_row (png_structp png_ptr, png_bytep
filtered_row);
void png_write_find_filter (png_structp png_ptr, png_row_infop
row_info);
void png_write_finish_row (png_structp png_ptr);
void png_write_flush (png_structp png_ptr);
void png_write_gAMA (png_structp png_ptr, double file_gamma);
void png_write_hIST (png_structp png_ptr, png_uint_16p hist,
int num_hist);
void png_write_image (png_structp png_ptr, png_bytepp image);
void png_write_info (png_structp png_ptr, png_infop info_ptr);
void png_write_init (png_structp png_ptr);
void png_write_IDAT (png_structp png_ptr, png_bytep data,
png_size_t length);
void png_write_IEND (png_structp png_ptr);
void png_write_IHDR (png_structp png_ptr, png_uint_32 width,
png_uint_32 height, int bit_depth, int color_type, int
compression_type, int filter_type, int interlace_type);
void png_write_oFFs (png_structp png_ptr, png_uint_32 x_offset,
png_uint_32 y_offset, int unit_type);
void png_write_pCAL (png_structp png_ptr, png_charp purpose,
png_int_32 X0, png_int_32 X1, int type, int nparams, png_charp
units, png_charpp params);
void png_write_pHYs (png_structp png_ptr, png_uint_32
x_pixels_per_unit, png_uint_32 y_pixels_per_unit, int
unit_type);
void png_write_PLTE (png_structp png_ptr, png_colorp palette,
png_uint_32 num_pal);
void png_write_row (png_structp png_ptr, png_bytep row);
void png_write_rows (png_structp png_ptr, png_bytepp row,
png_uint_32 num_rows);
void png_write_sBIT (png_structp png_ptr, png_color_8p sbit,
int color_type);
void png_write_sig (png_structp png_ptr);
void png_write_sRGB (png_structp png_ptr, int intent);
void png_write_start_row (png_structp png_ptr);
void png_write_tEXt (png_structp png_ptr, png_charp key,
png_charp text, png_size_t text_len);
void png_write_tIME (png_structp png_ptr, png_timep mod_time);
void png_write_tRNS (png_structp png_ptr, png_bytep trans,
png_color_16p values, int number, int color_type);
void png_write_zTXt (png_structp png_ptr, png_charp key,
png_charp text, png_size_t text_len, int compression);
voidpf png_zalloc (voidpf png_ptr, uInt items, uInt size);
void png_zfree (voidpf png_ptr, voidpf ptr);
.SH DESCRIPTION
The
.I libpng
@@ -706,11 +384,11 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng version 0.99d
libpng version 0.99e
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson
February 8, 1998
February 28, 1998
based on:
@@ -780,9 +458,7 @@ same instance of a structure.
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 libpng function call. It is not actually
used in many of the functions; do not be alarmed about compiler
warnings that say something to the effect that "png_ptr is not used."
variable passed to every libpng function call.
The png_info structure is designed to provide information about the
PNG file. At one time, the fields of png_info were intended to be
@@ -964,8 +640,8 @@ Functions are used to get the information from the info_ptr:
for PNG 1.0)
compression_type - (must be PNG_COMPRESSION_TYPE_BASE
for PNG 1.0)
interlace_type - (PNG_INTERLACE_TYPE_NONE or
PNG_INTERLACE_TYPE_ADAM7)
interlace_type - (PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7)
Any or all of interlace_type, compression_type, of
filter_type can be
NULL if you are not interested in their values.
@@ -982,7 +658,7 @@ Functions are used to get the information from the info_ptr:
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 an
whole signature were read (i.e. if an
application had already read in 4
bytes of signature before starting
libpng, the remaining 4 bytes would
@@ -1084,12 +760,16 @@ into the info_ptr is returned for any complex types.
x direction
res_y - pixels/unit physical resolution in
x direction
unit_type - PNG_RESOLUTION_UNKOWN,
unit_type - PNG_RESOLUTION_UNKNOWN,
PNG_RESOLUTION_METER
The data from the pHYs chunk can be retrieved in several convenient
forms:
res_x = png_get_x_pixels_per_meter(png_ptr,
info_ptr)
res_y = png_get_y_pixels_per_meter(png_ptr,
info_ptr)
res_x_and_y = png_get_pixels_per_meter(png_ptr,
info_ptr)
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
@@ -1132,7 +812,7 @@ ways to transform the data will be described in the order that they
should occur. This is important, as some of these change the color
type and/or bit depth of the data, and some others only work on
certain color types and bit depths. Even though each transformation
checks to see if it has data that it can do somthing with, you should
checks to see if it has data that it can do something 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.
@@ -1204,7 +884,7 @@ values of the pixels:
PNG files have possible bit depths of 1, 2, 4, 8, and 16. All pixels
stored in a PNG image have been "scaled" or "shifted" up to the next
higher possible bit depth (eg from 5 bits/sample in the range [0,31] to
higher possible bit depth (e.g. from 5 bits/sample in the range [0,31] to
8 bits/sample in the range [0, 255]). However, it is also possible to
convert the PNG pixel data back to the original bit depth of the image.
This call reduces the pixels back down to the original bit depth:
@@ -1278,8 +958,8 @@ the overall gamma correction required to produce pleasing results,
which depends on the lighting conditions in the surrounding environment.
Screen_gamma is display_gamma/viewing_gamma, where viewing_gamma is
the amount of additional gamma correction needed to compensate for
a dim (viewing_gamma=1.125) or dark (viewing_gamma=1.25) environment.
In a brightly lit room, no compensation other than the display_gamma
a dark (viewing_gamma=1.25) environment.
In a dim or brightly lit room, no compensation other than the display_gamma
is needed (viewing_gamma=1.0).
if (/* We have a user-defined screen
@@ -1297,10 +977,8 @@ is needed (viewing_gamma=1.0).
/* If we don't have another value */
else
{
screen_gamma = 2.5; /* A good guess for a
PC monitor in a bright office */
screen_gamma = 2.2; /* A good guess for a
PC monitor in a dim room */
PC monitor in a bright office or a dim room */
screen_gamma = 2.0; /* A good guess for a
PC monitor in a dark room */
screen_gamma = 1.7 or 1.0; /* A good
@@ -1363,8 +1041,8 @@ zero):
png_set_invert_mono(png_ptr);
PNG files store 16 bit pixels in network byte order (big-endian,
ie. most significant bits first). This code chages the storage to the
other way (little-endian, ie. least significant bits first, eg. the
ie. most significant bits first). This code changes the storage to the
other way (little-endian, i.e. least significant bits first, the
way PCs store them):
if (bit_depth == 16)
@@ -1420,7 +1098,7 @@ You can point to void or char or whatever you use for pixels.
If you don't want to read in the whole image at once, you can
use png_read_rows() instead. If there is no interlacing (check
interlace_type == PNG_INTERLACE_TYPE_NONE), this is simple:
interlace_type == PNG_INTERLACE_NONE), this is simple:
png_read_rows(png_ptr, row_pointers, NULL,
number_of_rows);
@@ -1435,7 +1113,7 @@ row_pointers:
If the file is interlaced (info_ptr->interlace_type != 0), things get
somewhat harder. The only current (PNG Specification version 1.0)
interlacing type for PNG is (interlace_type == PNG_INTERLACE_TYPE_ADAM7)
interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7)
is a somewhat complicated 2D interlace scheme, known as Adam7, that
breaks down an image into seven smaller images of varying size, based
on an 8x8 grid.
@@ -1474,7 +1152,7 @@ numbered scanlines. Phew!
If you want libpng to expand the images, call this before calling
png_start_read_image() or png_read_update_info():
if (interlace_type == PNG_INTERLACE_TYPE_ADAM7)
if (interlace_type == PNG_INTERLACE_ADAM7)
number_of_passes
= png_set_interlace_handling(png_ptr);
@@ -1692,7 +1370,7 @@ png_infop info_ptr;
IV. Writing
.SH IV. Writing
Much of this is very similar to reading. However, everything of
importance is repeated here, so you won't have to constantly look
@@ -1764,7 +1442,8 @@ have no special needs in this area, let the library do what it wants by
not calling this function at all, as it has been tuned to deliver a good
speed/compression ratio. The second parameter to png_set_filter() is
the filter method, for which the only valid value is '0' (as of the
06/96 PNG specification. The third parameter is a flag that indicates
October 1996 PNG specification, version 1.0). The third parameter is a
flag that indicates
which filter type(s) are to be tested for each scanline. See the
Compression Library for details on the specific filter types.
@@ -1835,8 +1514,8 @@ Some of the more important parts of the png_info are:
PNG_COLOR_MASK_COLOR
PNG_COLOR_MASK_ALPHA
interlace_type - PNG_INTERLACE_TYPE_NONE or
PNG_INTERLACE_TYPE_ADAM7
interlace_type - PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7
compression_type - (must be
PNG_COMPRESSION_TYPE_DEFAULT)
filter_type - (must be PNG_FILTER_TYPE_DEFAULT)
@@ -1933,7 +1612,7 @@ Some of the more important parts of the png_info are:
in x direction
res_y - pixels/unit physical resolution
in y direction
unit_type - PNG_RESOLUTION_UNKOWN,
unit_type - PNG_RESOLUTION_UNKNOWN,
PNG_RESOLUTION_METER
In PNG files, the alpha channel in an image is the level of opacity.
@@ -1974,7 +1653,7 @@ The keywords that are given in the PNG Specification are:
Description Description of image (possibly long)
Copyright Copyright notice
Creation Time Time of original image creation
(usually RFC 1123 format, see below)
(usually RFC 1123 format, see below)
Software Software used to create the image
Disclaimer Legal disclaimer
Warning Warning of nature of content
@@ -1984,7 +1663,7 @@ The keywords that are given in the PNG Specification are:
The keyword-text pairs work like this. Keywords should be short
simple descriptions of what the comment is about. Some typical
keywords are found in the PNG specification, as is some recomendations
keywords are found in the PNG specification, as is some recommendations
on keywords. You can repeat keywords in a file. You can even write
some text before the image and some after. For example, you may want
to put a description of the image before the image, but leave the
@@ -2008,7 +1687,7 @@ time_t routine uses gmtime(). You don't have to use either of
these, but if you wish to fill in the png_time structure directly,
you should provide the time in universal time (GMT) if possible
instead of your local time. Note that the year number is the full
year (ie 1996, rather than 96 - PNG is year 2000 compliant!), and
year (e.g. 1998, rather than 98 - PNG is year 2000 compliant!), and
that months start with 1.
If you want to store the time of the original image creation, you should
@@ -2018,7 +1697,7 @@ depending on whether you mean the PNG file, the time the image was
created in a non-PNG format, a still photo from which the image was
scanned, or possibly the subject matter itself. In order to facilitate
machine-readable dates, it is recommended that the "Creation Time"
tEXt chunk use RFC 1123 format dates (eg 22 May 1997 18:07:10 GMT"),
tEXt chunk use RFC 1123 format dates (e.g. 22 May 1997 18:07:10 GMT"),
although this isn't a requirement. Unlike the tIME chunk, the
"Creation Time" tEXt chunk is not expected to be automatically changed
by the software. To facilitate the use of RFC 1123 dates, a function
@@ -2036,7 +1715,7 @@ ways to transform the data will be described in the order that they
should occur. This is important, as some of these change the color
type and/or bit depth of the data, and some others only work on
certain color types and bit depths. Even though each transformation
checks to see if it has data that it can do somthing with, you should
checks to see if it has data that it can do something 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.
@@ -2079,7 +1758,7 @@ file so that decoders can get the original data if desired.
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
If the data is stored in the row buffer in a bit depth other than
one supported by PNG (ie 3 bit data in the range 0-7 for a 4-bit PNG),
one supported by PNG (e.g. 3 bit data in the range 0-7 for a 4-bit PNG),
this will scale the values to appear to be the correct bit depth as
is required by PNG.
@@ -2087,8 +1766,8 @@ is required by PNG.
PNG files store 16 bit pixels in network byte order (big-endian,
ie. most significant bits first). This code would be used if they are
supplied the other way (little-endian, ie. least significant bits
first, eg. the way PCs store them):
supplied the other way (little-endian, i.e. least significant bits
first, the way PCs store them):
if (bit_depth > 8)
png_set_swap(png_ptr);
@@ -2125,9 +1804,9 @@ Note that the distance between rows is from the last time png_write_flush()
was called, or the first row of the image if it has never been called.
So if you write 50 lines, and then png_set_flush 25, it will flush the
output on the next scanline, and every 25 lines thereafter, unless
png_write_flush()ls is called before 25 more lines have been written.
png_write_flush() is called before 25 more lines have been written.
If nrows is too small (less than about 10 lines for a 640 pixel wide
RGB image) the image compression may decrease noticably (although this
RGB image) the image compression may decrease noticeably (although this
may be acceptable for real-time applications). Infrequent flushing will
only degrade the compression performance by a few percent over images
that do not use flushing.
@@ -2165,9 +1844,9 @@ row_pointers:
png_write_row(png_ptr, &row_pointer);
When the file is interlaced, things can get a good deal more
complicated. The only currently (as of 6/96 -- PNG Specification
version 1.0) defined interlacing scheme for PNG files is a
compilcated interlace scheme, known as Adam7, that breaks down an
complicated. The only currently (as of February 1998 -- PNG Specification
version 1.0, dated October 1996) defined interlacing scheme for PNG files
is the "Adam7" interlace scheme, that breaks down an
image into seven smaller images of varying size. libpng will build
these images for you, or you can do them yourself. If you want to
build them yourself, see the PNG specification for details of which
@@ -2212,7 +1891,7 @@ palette, or histogram, before the call to png_destroy_write_struct();
For a more compact example of writing a PNG image, see the file example.c.
V. Modifying/Customizing libpng:
.SH V. Modifying/Customizing libpng:
There are two issues here. The first is changing how libpng does
standard things like memory allocation, input/output, and error handling.
@@ -2220,9 +1899,9 @@ The second deals with more complicated things like adding new chunks,
adding new transformations, and generally changing how libpng works.
All of the memory allocation, input/output, and error handling in libpng
goes through callbacks which are user setable. The default routines are
goes through callbacks which are user settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c respectively. To change
these functions, call the approprate png_set_???_fn() function.
these functions, call the appropriate png_set_???_fn() function.
Memory allocation is done through the functions png_large_malloc(),
png_malloc(), png_realloc(), png_large_free(), and png_free(). These
@@ -2320,11 +1999,11 @@ can be found in the comments inside the code itself.
Configuring for 16 bit platforms:
You may need to change the png_large_malloc() and png_large_free()
routines in pngmem.c, as these are requred to allocate 64K, although
routines in pngmem.c, as these are required to allocate 64K, although
there is already support for many of the common DOS compilers. Also,
you will want to look into zconf.h to tell zlib (and thus libpng) that
it cannot allocate more then 64K at a time. Even if you can, the memory
won't be accessable. So limit zlib and libpng to 64K by defining MAXSEG_64K.
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
Configuring for DOS:
@@ -2349,7 +2028,7 @@ You will need to write new error and warning functions that use the GUI
interface, as described previously, and set them to be the error and
warning functions at the time that png_create_???_struct() is called,
in order to have them available during the structure initialization.
They can be changed later via png_set_error_fn(). On some compliers,
They can be changed later via png_set_error_fn(). On some compilers,
you may also have to change the memory allocators (png_malloc, etc.).
Configuring for compiler xxx:
@@ -2451,7 +2130,7 @@ to be considered when selecting row filters. This means that filters
with higher costs are less likely to be chosen over filters with lower
costs, unless their "sum of absolute differences" is that much smaller.
The costs do not necessarily reflect the exact computational speeds of
the various filters, since this would unduely influence the final image
the various filters, since this would unduly influence the final image
size.
Note that the numbers above were invented purely for this example and
@@ -2550,7 +2229,7 @@ the first widely used release:
0.99 0.99 2.0.99
0.99a 0.99 2.0.99
0.99b 0.99 2.0.99
0.99d 0.99 2.0.99
0.99e 0.99 2.0.99
1.0 1.00 2.1.0
Henceforth the source version will match the shared-library minor
@@ -2558,11 +2237,14 @@ and patch numbers; the shared-library major version number will be
used for changes in backward compatibility, as it is intended.
.SH "SEE ALSO"
libpngpf(3), png(5)
.LP
.IR libpng :
.IP
ftp://ftp.uu.net/graphics/png
http://www.cdrom.com/pub/png
.LP
.IR zlib :
.IP
(generally) at the same location as
@@ -2573,8 +2255,8 @@ ftp://ftp.uu.net/pub/archiving/zip/zlib
.br
http://www.cdrom.com/pub/infozip/zlib
PNG specification:
RFC 2083
.LP
.IR PNG specification: RFC 2083
.IP
(generally) at the same location as
.I libpng
@@ -2586,6 +2268,7 @@ or (as a W3C Recommendation) at
.br
http://www.w3.org/TR/REC-png.html
.LP
In the case of any inconsistency between the PNG specification
and this library, the specification takes precedence.
@@ -2595,7 +2278,8 @@ This man page: Glenn Randers-Pehrson
Contributing Authors: John Bowler, Kevin Bracey, Sam Bushell, Andreas Dilger,
Magnus Holmgren, Tom Lane, Dave Martindale, Glenn Randers-Pehrson,
Greg Roelofs, Guy Eric Schalnat, Paul Schmidt, Tom Tanner, Tim Wegner.
Greg Roelofs, Guy Eric Schalnat, Paul Schmidt, Tom Tanner, Willem van
Schaik, Tim Wegner.
<png-implement@dworkin.wustl.edu>
The contributing authors would like to thank all those who helped
@@ -2604,7 +2288,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 0.99d (February 8, 1998):
Libpng version 0.99e (February 28, 1998):
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).