[devel] Updated manual synopses, fixed several typos,
put paramter descriptions in proper order, applied libpng indentation style in code snippets.
This commit is contained in:
parent
b86b4928d6
commit
7bc25013f0
@ -1,6 +1,6 @@
|
|||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.5.1rc01 - January 21, 2011
|
libpng version 1.5.1beta07 - January 22, 2011
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.5.1rc01 - January 21, 2011
|
libpng versions 0.97, January 1998, through 1.5.1beta07 - January 22, 2011
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@ -311,8 +311,10 @@ Customizing libpng.
|
|||||||
{
|
{
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(header, 1, number, fp);
|
fread(header, 1, number, fp);
|
||||||
is_png = !png_sig_cmp(header, 0, number);
|
is_png = !png_sig_cmp(header, 0, number);
|
||||||
|
|
||||||
if (!is_png)
|
if (!is_png)
|
||||||
{
|
{
|
||||||
return (NOT_PNG);
|
return (NOT_PNG);
|
||||||
@ -333,10 +335,12 @@ create the structure, so your application should check for that.
|
|||||||
png_structp png_ptr = png_create_read_struct
|
png_structp png_ptr = png_create_read_struct
|
||||||
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
|
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
|
||||||
user_error_fn, user_warning_fn);
|
user_error_fn, user_warning_fn);
|
||||||
|
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
|
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr,
|
png_destroy_read_struct(&png_ptr,
|
||||||
@ -345,6 +349,7 @@ create the structure, so your application should check for that.
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_infop end_info = png_create_info_struct(png_ptr);
|
png_infop end_info = png_create_info_struct(png_ptr);
|
||||||
|
|
||||||
if (!end_info)
|
if (!end_info)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||||
@ -353,7 +358,7 @@ create the structure, so your application should check for that.
|
|||||||
}
|
}
|
||||||
|
|
||||||
If you want to use your own memory allocation routines,
|
If you want to use your own memory allocation routines,
|
||||||
define PNG_USER_MEM_SUPPORTED and use
|
use a libpng that was built with PNG_USER_MEM_SUPPORTED defined, and use
|
||||||
png_create_read_struct_2() instead of png_create_read_struct():
|
png_create_read_struct_2() instead of png_create_read_struct():
|
||||||
|
|
||||||
png_structp png_ptr = png_create_read_struct_2
|
png_structp png_ptr = png_create_read_struct_2
|
||||||
@ -523,14 +528,17 @@ chunk types. To change this, you can call:
|
|||||||
1: ignore; do not keep
|
1: ignore; do not keep
|
||||||
2: keep only if safe-to-copy
|
2: keep only if safe-to-copy
|
||||||
3: keep even if unsafe-to-copy
|
3: keep even if unsafe-to-copy
|
||||||
|
|
||||||
You can use these definitions:
|
You can use these definitions:
|
||||||
PNG_HANDLE_CHUNK_AS_DEFAULT 0
|
PNG_HANDLE_CHUNK_AS_DEFAULT 0
|
||||||
PNG_HANDLE_CHUNK_NEVER 1
|
PNG_HANDLE_CHUNK_NEVER 1
|
||||||
PNG_HANDLE_CHUNK_IF_SAFE 2
|
PNG_HANDLE_CHUNK_IF_SAFE 2
|
||||||
PNG_HANDLE_CHUNK_ALWAYS 3
|
PNG_HANDLE_CHUNK_ALWAYS 3
|
||||||
|
|
||||||
chunk_list - list of chunks affected (a byte string,
|
chunk_list - list of chunks affected (a byte string,
|
||||||
five bytes per chunk, NULL or '\0' if
|
five bytes per chunk, NULL or '\0' if
|
||||||
num_chunks is 0)
|
num_chunks is 0)
|
||||||
|
|
||||||
num_chunks - number of chunks affected; if 0, all
|
num_chunks - number of chunks affected; if 0, all
|
||||||
unknown chunks are affected. If nonzero,
|
unknown chunks are affected. If nonzero,
|
||||||
only the chunks in the list are affected
|
only the chunks in the list are affected
|
||||||
@ -566,8 +574,10 @@ callback function:
|
|||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
/* ignore all unknown chunks: */
|
/* ignore all unknown chunks: */
|
||||||
png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0);
|
png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0);
|
||||||
|
|
||||||
/* except for vpAg: */
|
/* except for vpAg: */
|
||||||
png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1);
|
png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1);
|
||||||
|
|
||||||
/* also ignore unused known chunks: */
|
/* also ignore unused known chunks: */
|
||||||
png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks,
|
png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks,
|
||||||
(int)sizeof(unused_chunks)/5);
|
(int)sizeof(unused_chunks)/5);
|
||||||
@ -681,16 +691,21 @@ row_pointers prior to calling png_read_png() with
|
|||||||
if (height > PNG_UINT_32_MAX/png_sizeof(png_byte))
|
if (height > PNG_UINT_32_MAX/png_sizeof(png_byte))
|
||||||
png_error (png_ptr,
|
png_error (png_ptr,
|
||||||
"Image is too tall to process in memory");
|
"Image is too tall to process in memory");
|
||||||
|
|
||||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||||
png_error (png_ptr,
|
png_error (png_ptr,
|
||||||
"Image is too wide to process in memory");
|
"Image is too wide to process in memory");
|
||||||
|
|
||||||
row_pointers = png_malloc(png_ptr,
|
row_pointers = png_malloc(png_ptr,
|
||||||
height*png_sizeof(png_bytep));
|
height*png_sizeof(png_bytep));
|
||||||
|
|
||||||
for (int i=0; i<height, i++)
|
for (int i=0; i<height, i++)
|
||||||
row_pointers[i]=NULL; /* security precaution */
|
row_pointers[i]=NULL; /* security precaution */
|
||||||
|
|
||||||
for (int i=0; i<height, i++)
|
for (int i=0; i<height, i++)
|
||||||
row_pointers[i]=png_malloc(png_ptr,
|
row_pointers[i]=png_malloc(png_ptr,
|
||||||
width*pixel_size);
|
width*pixel_size);
|
||||||
|
|
||||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||||
|
|
||||||
Alternatively you could allocate your image in one big block and define
|
Alternatively you could allocate your image in one big block and define
|
||||||
@ -700,7 +715,7 @@ If you use png_set_rows(), the application is responsible for freeing
|
|||||||
row_pointers (and row_pointers[i], if they were separately allocated).
|
row_pointers (and row_pointers[i], if they were separately allocated).
|
||||||
|
|
||||||
If you don't allocate row_pointers ahead of time, png_read_png() will
|
If you don't allocate row_pointers ahead of time, png_read_png() will
|
||||||
do it, and it'll be free'ed when you call png_destroy_*().
|
do it, and it'll be free'ed by libpng when you call png_destroy_*().
|
||||||
|
|
||||||
The low-level read interface
|
The low-level read interface
|
||||||
|
|
||||||
@ -724,13 +739,16 @@ in until png_read_end() has read the chunk data following the image.
|
|||||||
|
|
||||||
width - holds the width of the image
|
width - holds the width of the image
|
||||||
in pixels (up to 2^31).
|
in pixels (up to 2^31).
|
||||||
|
|
||||||
height - holds the height of the image
|
height - holds the height of the image
|
||||||
in pixels (up to 2^31).
|
in pixels (up to 2^31).
|
||||||
|
|
||||||
bit_depth - holds the bit depth of one of the
|
bit_depth - holds the bit depth of one of the
|
||||||
image channels. (valid values are
|
image channels. (valid values are
|
||||||
1, 2, 4, 8, 16 and depend also on
|
1, 2, 4, 8, 16 and depend also on
|
||||||
the color_type. See also
|
the color_type. See also
|
||||||
significant bits (sBIT) below).
|
significant bits (sBIT) below).
|
||||||
|
|
||||||
color_type - describes which color/alpha channels
|
color_type - describes which color/alpha channels
|
||||||
are present.
|
are present.
|
||||||
PNG_COLOR_TYPE_GRAY
|
PNG_COLOR_TYPE_GRAY
|
||||||
@ -773,28 +791,38 @@ in until png_read_end() has read the chunk data following the image.
|
|||||||
|
|
||||||
width = png_get_image_width(png_ptr,
|
width = png_get_image_width(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
|
|
||||||
height = png_get_image_height(png_ptr,
|
height = png_get_image_height(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
|
|
||||||
bit_depth = png_get_bit_depth(png_ptr,
|
bit_depth = png_get_bit_depth(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
|
|
||||||
color_type = png_get_color_type(png_ptr,
|
color_type = png_get_color_type(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
|
|
||||||
interlace_type = png_get_interlace_type(png_ptr,
|
interlace_type = png_get_interlace_type(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
|
|
||||||
compression_type = png_get_compression_type(png_ptr,
|
compression_type = png_get_compression_type(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
|
|
||||||
filter_method = png_get_filter_type(png_ptr,
|
filter_method = png_get_filter_type(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
|
|
||||||
channels = png_get_channels(png_ptr, info_ptr);
|
channels = png_get_channels(png_ptr, info_ptr);
|
||||||
|
|
||||||
channels - number of channels of info for the
|
channels - number of channels of info for the
|
||||||
color type (valid values are 1 (GRAY,
|
color type (valid values are 1 (GRAY,
|
||||||
PALETTE), 2 (GRAY_ALPHA), 3 (RGB),
|
PALETTE), 2 (GRAY_ALPHA), 3 (RGB),
|
||||||
4 (RGB_ALPHA or RGB + filler byte))
|
4 (RGB_ALPHA or RGB + filler byte))
|
||||||
|
|
||||||
rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||||
|
|
||||||
rowbytes - number of bytes needed to hold a row
|
rowbytes - number of bytes needed to hold a row
|
||||||
|
|
||||||
signature = png_get_signature(png_ptr, info_ptr);
|
signature = png_get_signature(png_ptr, info_ptr);
|
||||||
|
|
||||||
signature - holds the signature read from the
|
signature - holds the signature read from the
|
||||||
file (if any). The data is kept in
|
file (if any). The data is kept in
|
||||||
the same offset it would be if the
|
the same offset it would be if the
|
||||||
@ -814,15 +842,19 @@ pointer into the info_ptr is returned for any complex types.
|
|||||||
|
|
||||||
png_get_PLTE(png_ptr, info_ptr, &palette,
|
png_get_PLTE(png_ptr, info_ptr, &palette,
|
||||||
&num_palette);
|
&num_palette);
|
||||||
|
|
||||||
palette - the palette for the file
|
palette - the palette for the file
|
||||||
(array of png_color)
|
(array of png_color)
|
||||||
|
|
||||||
num_palette - number of entries in the palette
|
num_palette - number of entries in the palette
|
||||||
|
|
||||||
png_get_gAMA(png_ptr, info_ptr, &gamma);
|
png_get_gAMA(png_ptr, info_ptr, &gamma);
|
||||||
|
|
||||||
gamma - the gamma the file is written
|
gamma - the gamma the file is written
|
||||||
at (PNG_INFO_gAMA)
|
at (PNG_INFO_gAMA)
|
||||||
|
|
||||||
png_get_sRGB(png_ptr, info_ptr, &srgb_intent);
|
png_get_sRGB(png_ptr, info_ptr, &srgb_intent);
|
||||||
|
|
||||||
srgb_intent - the rendering intent (PNG_INFO_sRGB)
|
srgb_intent - the rendering intent (PNG_INFO_sRGB)
|
||||||
The presence of the sRGB chunk
|
The presence of the sRGB chunk
|
||||||
means that the pixel data is in the
|
means that the pixel data is in the
|
||||||
@ -832,16 +864,21 @@ pointer into the info_ptr is returned for any complex types.
|
|||||||
|
|
||||||
png_get_iCCP(png_ptr, info_ptr, &name,
|
png_get_iCCP(png_ptr, info_ptr, &name,
|
||||||
&compression_type, &profile, &proflen);
|
&compression_type, &profile, &proflen);
|
||||||
|
|
||||||
name - The profile name.
|
name - The profile name.
|
||||||
|
|
||||||
compression_type - The compression type; always
|
compression_type - The compression type; always
|
||||||
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
||||||
You may give NULL to this argument to
|
You may give NULL to this argument to
|
||||||
ignore it.
|
ignore it.
|
||||||
|
|
||||||
profile - International Color Consortium color
|
profile - International Color Consortium color
|
||||||
profile data. May contain NULs.
|
profile data. May contain NULs.
|
||||||
|
|
||||||
proflen - length of profile data in bytes.
|
proflen - length of profile data in bytes.
|
||||||
|
|
||||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||||
|
|
||||||
sig_bit - the number of significant bits for
|
sig_bit - the number of significant bits for
|
||||||
(PNG_INFO_sBIT) each of the gray,
|
(PNG_INFO_sBIT) each of the gray,
|
||||||
red, green, and blue channels,
|
red, green, and blue channels,
|
||||||
@ -850,50 +887,66 @@ pointer into the info_ptr is returned for any complex types.
|
|||||||
|
|
||||||
png_get_tRNS(png_ptr, info_ptr, &trans_alpha,
|
png_get_tRNS(png_ptr, info_ptr, &trans_alpha,
|
||||||
&num_trans, &trans_color);
|
&num_trans, &trans_color);
|
||||||
|
|
||||||
trans_alpha - array of alpha (transparency)
|
trans_alpha - array of alpha (transparency)
|
||||||
entries for palette (PNG_INFO_tRNS)
|
entries for palette (PNG_INFO_tRNS)
|
||||||
|
|
||||||
num_trans - number of transparent entries
|
num_trans - number of transparent entries
|
||||||
(PNG_INFO_tRNS)
|
(PNG_INFO_tRNS)
|
||||||
|
|
||||||
trans_color - graylevel or color sample values of
|
trans_color - graylevel or color sample values of
|
||||||
the single transparent color for
|
the single transparent color for
|
||||||
non-paletted images (PNG_INFO_tRNS)
|
non-paletted images (PNG_INFO_tRNS)
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr, &hist);
|
png_get_hIST(png_ptr, info_ptr, &hist);
|
||||||
(PNG_INFO_hIST)
|
(PNG_INFO_hIST)
|
||||||
|
|
||||||
hist - histogram of palette (array of
|
hist - histogram of palette (array of
|
||||||
png_uint_16)
|
png_uint_16)
|
||||||
|
|
||||||
png_get_tIME(png_ptr, info_ptr, &mod_time);
|
png_get_tIME(png_ptr, info_ptr, &mod_time);
|
||||||
|
|
||||||
mod_time - time image was last modified
|
mod_time - time image was last modified
|
||||||
(PNG_VALID_tIME)
|
(PNG_VALID_tIME)
|
||||||
|
|
||||||
png_get_bKGD(png_ptr, info_ptr, &background);
|
png_get_bKGD(png_ptr, info_ptr, &background);
|
||||||
|
|
||||||
background - background color (PNG_VALID_bKGD)
|
background - background color (PNG_VALID_bKGD)
|
||||||
valid 16-bit red, green and blue
|
valid 16-bit red, green and blue
|
||||||
values, regardless of color_type
|
values, regardless of color_type
|
||||||
|
|
||||||
num_comments = png_get_text(png_ptr, info_ptr,
|
num_comments = png_get_text(png_ptr, info_ptr,
|
||||||
&text_ptr, &num_text);
|
&text_ptr, &num_text);
|
||||||
|
|
||||||
num_comments - number of comments
|
num_comments - number of comments
|
||||||
|
|
||||||
text_ptr - array of png_text holding image
|
text_ptr - array of png_text holding image
|
||||||
comments
|
comments
|
||||||
|
|
||||||
text_ptr[i].compression - type of compression used
|
text_ptr[i].compression - type of compression used
|
||||||
on "text" PNG_TEXT_COMPRESSION_NONE
|
on "text" PNG_TEXT_COMPRESSION_NONE
|
||||||
PNG_TEXT_COMPRESSION_zTXt
|
PNG_TEXT_COMPRESSION_zTXt
|
||||||
PNG_ITXT_COMPRESSION_NONE
|
PNG_ITXT_COMPRESSION_NONE
|
||||||
PNG_ITXT_COMPRESSION_zTXt
|
PNG_ITXT_COMPRESSION_zTXt
|
||||||
|
|
||||||
text_ptr[i].key - keyword for comment. Must contain
|
text_ptr[i].key - keyword for comment. Must contain
|
||||||
1-79 characters.
|
1-79 characters.
|
||||||
|
|
||||||
text_ptr[i].text - text comments for current
|
text_ptr[i].text - text comments for current
|
||||||
keyword. Can be empty.
|
keyword. Can be empty.
|
||||||
|
|
||||||
text_ptr[i].text_length - length of text string,
|
text_ptr[i].text_length - length of text string,
|
||||||
after decompression, 0 for iTXt
|
after decompression, 0 for iTXt
|
||||||
|
|
||||||
text_ptr[i].itxt_length - length of itxt string,
|
text_ptr[i].itxt_length - length of itxt string,
|
||||||
after decompression, 0 for tEXt/zTXt
|
after decompression, 0 for tEXt/zTXt
|
||||||
|
|
||||||
text_ptr[i].lang - language of comment (empty
|
text_ptr[i].lang - language of comment (empty
|
||||||
string for unknown).
|
string for unknown).
|
||||||
|
|
||||||
text_ptr[i].lang_key - keyword in UTF-8
|
text_ptr[i].lang_key - keyword in UTF-8
|
||||||
(empty string for unknown).
|
(empty string for unknown).
|
||||||
|
|
||||||
Note that the itxt_length, lang, and lang_key
|
Note that the itxt_length, lang, and lang_key
|
||||||
members of the text_ptr structure only exist
|
members of the text_ptr structure only exist
|
||||||
when the library is built with iTXt chunk support.
|
when the library is built with iTXt chunk support.
|
||||||
@ -901,6 +954,7 @@ pointer into the info_ptr is returned for any complex types.
|
|||||||
num_text - number of comments (same as
|
num_text - number of comments (same as
|
||||||
num_comments; you can put NULL here
|
num_comments; you can put NULL here
|
||||||
to avoid the duplication)
|
to avoid the duplication)
|
||||||
|
|
||||||
Note while png_set_text() will accept text, language,
|
Note while png_set_text() will accept text, language,
|
||||||
and translated keywords that can be NULL pointers, the
|
and translated keywords that can be NULL pointers, the
|
||||||
structure returned by png_get_text will always contain
|
structure returned by png_get_text will always contain
|
||||||
@ -909,49 +963,68 @@ pointer into the info_ptr is returned for any complex types.
|
|||||||
|
|
||||||
num_spalettes = png_get_sPLT(png_ptr, info_ptr,
|
num_spalettes = png_get_sPLT(png_ptr, info_ptr,
|
||||||
&palette_ptr);
|
&palette_ptr);
|
||||||
|
|
||||||
|
num_spalettes - number of sPLT chunks read.
|
||||||
|
|
||||||
palette_ptr - array of palette structures holding
|
palette_ptr - array of palette structures holding
|
||||||
contents of one or more sPLT chunks
|
contents of one or more sPLT chunks
|
||||||
read.
|
read.
|
||||||
num_spalettes - number of sPLT chunks read.
|
|
||||||
|
|
||||||
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
|
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
|
||||||
&unit_type);
|
&unit_type);
|
||||||
|
|
||||||
offset_x - positive offset from the left edge
|
offset_x - positive offset from the left edge
|
||||||
of the screen
|
of the screen
|
||||||
|
|
||||||
offset_y - positive offset from the top edge
|
offset_y - positive offset from the top edge
|
||||||
of the screen
|
of the screen
|
||||||
|
|
||||||
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
|
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
|
||||||
|
|
||||||
png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y,
|
png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y,
|
||||||
&unit_type);
|
&unit_type);
|
||||||
|
|
||||||
res_x - pixels/unit physical resolution in
|
res_x - pixels/unit physical resolution in
|
||||||
x direction
|
x direction
|
||||||
|
|
||||||
res_y - pixels/unit physical resolution in
|
res_y - pixels/unit physical resolution in
|
||||||
x direction
|
x direction
|
||||||
|
|
||||||
unit_type - PNG_RESOLUTION_UNKNOWN,
|
unit_type - PNG_RESOLUTION_UNKNOWN,
|
||||||
PNG_RESOLUTION_METER
|
PNG_RESOLUTION_METER
|
||||||
|
|
||||||
png_get_sCAL(png_ptr, info_ptr, &unit, &width,
|
png_get_sCAL(png_ptr, info_ptr, &unit, &width,
|
||||||
&height)
|
&height)
|
||||||
|
|
||||||
unit - physical scale units (an integer)
|
unit - physical scale units (an integer)
|
||||||
|
|
||||||
width - width of a pixel in physical scale units
|
width - width of a pixel in physical scale units
|
||||||
|
|
||||||
height - height of a pixel in physical scale units
|
height - height of a pixel in physical scale units
|
||||||
(width and height are doubles)
|
(width and height are doubles)
|
||||||
|
|
||||||
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width,
|
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width,
|
||||||
&height)
|
&height)
|
||||||
|
|
||||||
unit - physical scale units (an integer)
|
unit - physical scale units (an integer)
|
||||||
|
|
||||||
width - width of a pixel in physical scale units
|
width - width of a pixel in physical scale units
|
||||||
|
|
||||||
height - height of a pixel in physical scale units
|
height - height of a pixel in physical scale units
|
||||||
(width and height are strings like "2.54")
|
(width and height are strings like "2.54")
|
||||||
|
|
||||||
num_unknown_chunks = png_get_unknown_chunks(png_ptr,
|
num_unknown_chunks = png_get_unknown_chunks(png_ptr,
|
||||||
info_ptr, &unknowns)
|
info_ptr, &unknowns)
|
||||||
|
|
||||||
unknowns - array of png_unknown_chunk
|
unknowns - array of png_unknown_chunk
|
||||||
structures holding unknown chunks
|
structures holding unknown chunks
|
||||||
|
|
||||||
unknowns[i].name - name of unknown chunk
|
unknowns[i].name - name of unknown chunk
|
||||||
|
|
||||||
unknowns[i].data - data of unknown chunk
|
unknowns[i].data - data of unknown chunk
|
||||||
|
|
||||||
unknowns[i].size - size of unknown chunk's data
|
unknowns[i].size - size of unknown chunk's data
|
||||||
|
|
||||||
unknowns[i].location - position of chunk in file
|
unknowns[i].location - position of chunk in file
|
||||||
|
|
||||||
The value of "i" corresponds to the order in which the
|
The value of "i" corresponds to the order in which the
|
||||||
@ -963,34 +1036,55 @@ forms:
|
|||||||
|
|
||||||
res_x = png_get_x_pixels_per_meter(png_ptr,
|
res_x = png_get_x_pixels_per_meter(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
|
|
||||||
res_y = png_get_y_pixels_per_meter(png_ptr,
|
res_y = png_get_y_pixels_per_meter(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
|
|
||||||
res_x_and_y = png_get_pixels_per_meter(png_ptr,
|
res_x_and_y = png_get_pixels_per_meter(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
|
|
||||||
res_x = png_get_x_pixels_per_inch(png_ptr,
|
res_x = png_get_x_pixels_per_inch(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
|
|
||||||
res_y = png_get_y_pixels_per_inch(png_ptr,
|
res_y = png_get_y_pixels_per_inch(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
|
|
||||||
res_x_and_y = png_get_pixels_per_inch(png_ptr,
|
res_x_and_y = png_get_pixels_per_inch(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
|
|
||||||
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
|
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
|
|
||||||
(Each of these returns 0 [signifying "unknown"] if
|
Each of these returns 0 [signifying "unknown"] if
|
||||||
the data is not present or if res_x is 0;
|
the data is not present or if res_x is 0;
|
||||||
res_x_and_y is 0 if res_x != res_y)
|
res_x_and_y is 0 if res_x != res_y
|
||||||
|
|
||||||
|
Note that because of the way the resolutions are
|
||||||
|
stored internally, the inch conversions won't
|
||||||
|
come out to exactly even number. For example,
|
||||||
|
72 dpi is stored as 0.28346 pixels/meter, and
|
||||||
|
when this is retrieved it is 71.9988 dpi, so
|
||||||
|
be sure to round the returned value appropriately
|
||||||
|
if you want to display a reasonable-looking result.
|
||||||
|
|
||||||
The data from the oFFs chunk can be retrieved in several convenient
|
The data from the oFFs chunk can be retrieved in several convenient
|
||||||
forms:
|
forms:
|
||||||
|
|
||||||
x_offset = png_get_x_offset_microns(png_ptr, info_ptr);
|
x_offset = png_get_x_offset_microns(png_ptr, info_ptr);
|
||||||
|
|
||||||
y_offset = png_get_y_offset_microns(png_ptr, info_ptr);
|
y_offset = png_get_y_offset_microns(png_ptr, info_ptr);
|
||||||
|
|
||||||
x_offset = png_get_x_offset_inches(png_ptr, info_ptr);
|
x_offset = png_get_x_offset_inches(png_ptr, info_ptr);
|
||||||
|
|
||||||
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
|
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
|
||||||
|
|
||||||
(Each of these returns 0 [signifying "unknown" if both
|
Each of these returns 0 [signifying "unknown" if both
|
||||||
x and y are 0] if the data is not present or if the
|
x and y are 0] if the data is not present or if the
|
||||||
chunk is present but the unit is the pixel)
|
chunk is present but the unit is the pixel. The
|
||||||
|
remark about inexact inch conversions applies here
|
||||||
|
as well, because a value in inches can't always be
|
||||||
|
converted to microns and back without some loss
|
||||||
|
of precision.
|
||||||
|
|
||||||
For more information, see the png_info definition in png.h and the
|
For more information, see the png_info definition in png.h and the
|
||||||
PNG specification for chunk contents. Be careful with trusting
|
PNG specification for chunk contents. Be careful with trusting
|
||||||
@ -1077,7 +1171,7 @@ things.
|
|||||||
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
||||||
added. It expands the sample depth without changing tRNS to alpha.
|
added. It expands the sample depth without changing tRNS to alpha.
|
||||||
|
|
||||||
As of libpng version 1.5.1rc01, not all possible expansions are supported.
|
As of libpng version 1.5.1beta07, not all possible expansions are supported.
|
||||||
|
|
||||||
In the following table, the 01 means grayscale with depth<8, 31 means
|
In the following table, the 01 means grayscale with depth<8, 31 means
|
||||||
indexed with depth<8, other numerals represent the color type, "T" means
|
indexed with depth<8, other numerals represent the color type, "T" means
|
||||||
@ -1209,15 +1303,18 @@ with alpha.
|
|||||||
int red_weight, int green_weight);
|
int red_weight, int green_weight);
|
||||||
|
|
||||||
error_action = 1: silently do the conversion
|
error_action = 1: silently do the conversion
|
||||||
|
|
||||||
error_action = 2: issue a warning if the original
|
error_action = 2: issue a warning if the original
|
||||||
image has any pixel where
|
image has any pixel where
|
||||||
red != green or red != blue
|
red != green or red != blue
|
||||||
|
|
||||||
error_action = 3: issue an error and abort the
|
error_action = 3: issue an error and abort the
|
||||||
conversion if the original
|
conversion if the original
|
||||||
image has any pixel where
|
image has any pixel where
|
||||||
red != green or red != blue
|
red != green or red != blue
|
||||||
|
|
||||||
red_weight: weight of red component times 100000
|
red_weight: weight of red component times 100000
|
||||||
|
|
||||||
green_weight: weight of green component times 100000
|
green_weight: weight of green component times 100000
|
||||||
If either weight is negative, default
|
If either weight is negative, default
|
||||||
weights (21268, 71514) are used.
|
weights (21268, 71514) are used.
|
||||||
@ -1305,6 +1402,7 @@ a slightly smaller exponent is better.
|
|||||||
{
|
{
|
||||||
screen_gamma = user_defined_screen_gamma;
|
screen_gamma = user_defined_screen_gamma;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One way that applications can share the same
|
/* One way that applications can share the same
|
||||||
screen gamma value */
|
screen gamma value */
|
||||||
else if ((gamma_str = getenv("SCREEN_GAMMA"))
|
else if ((gamma_str = getenv("SCREEN_GAMMA"))
|
||||||
@ -1312,13 +1410,16 @@ a slightly smaller exponent is better.
|
|||||||
{
|
{
|
||||||
screen_gamma = (double)atof(gamma_str);
|
screen_gamma = (double)atof(gamma_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we don't have another value */
|
/* If we don't have another value */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen_gamma = 2.2; /* A good guess for a
|
screen_gamma = 2.2; /* A good guess for a
|
||||||
PC monitor in a bright office or a dim room */
|
PC monitor in a bright office or a dim room */
|
||||||
|
|
||||||
screen_gamma = 2.0; /* A good guess for a
|
screen_gamma = 2.0; /* A good guess for a
|
||||||
PC monitor in a dark room */
|
PC monitor in a dark room */
|
||||||
|
|
||||||
screen_gamma = 1.7 or 1.0; /* A good
|
screen_gamma = 1.7 or 1.0; /* A good
|
||||||
guess for Mac systems */
|
guess for Mac systems */
|
||||||
}
|
}
|
||||||
@ -1335,6 +1436,7 @@ recommended that PNG viewers support gamma correction.
|
|||||||
|
|
||||||
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
||||||
png_set_gamma(png_ptr, screen_gamma, gamma);
|
png_set_gamma(png_ptr, screen_gamma, gamma);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
|
|
||||||
@ -1342,7 +1444,7 @@ If you need to reduce an RGB file to a paletted file, or if a paletted
|
|||||||
file has more entries then will fit on your screen, png_set_quantize()
|
file has more entries then will fit on your screen, png_set_quantize()
|
||||||
will do that. Note that this is a simple match quantization that merely
|
will do that. Note that this is a simple match quantization that merely
|
||||||
finds the closest color available. This should work fairly well with
|
finds the closest color available. This should work fairly well with
|
||||||
optimized palettes, and fairly badly with linear color cubes. If you
|
optimized palettes, but fairly badly with linear color cubes. If you
|
||||||
pass a palette that is larger then maximum_colors, the file will
|
pass a palette that is larger then maximum_colors, the file will
|
||||||
reduce the number of colors in the palette so it will fit into
|
reduce the number of colors in the palette so it will fit into
|
||||||
maximum_colors. If there is a histogram, it will use it to make
|
maximum_colors. If there is a histogram, it will use it to make
|
||||||
@ -1361,6 +1463,7 @@ histogram, it may not do as good a job.
|
|||||||
png_set_quantize(png_ptr, palette, num_palette,
|
png_set_quantize(png_ptr, palette, num_palette,
|
||||||
max_screen_colors, histogram, 1);
|
max_screen_colors, histogram, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_color std_color_cube[MAX_SCREEN_COLORS] =
|
png_color std_color_cube[MAX_SCREEN_COLORS] =
|
||||||
@ -1454,13 +1557,13 @@ are allocating one large chunk, you will need to build an
|
|||||||
array of pointers to each row, as it will be needed for some
|
array of pointers to each row, as it will be needed for some
|
||||||
of the functions below.
|
of the functions below.
|
||||||
|
|
||||||
Remember: Before you call png_read_update_info the png_get_
|
Remember: Before you call png_read_update_info(), the png_get_
|
||||||
functions return the values corresponding to the original PNG image.
|
functions return the values corresponding to the original PNG image.
|
||||||
After you call png_read_update_info the values refer to the image
|
After you call png_read_update_info the values refer to the image
|
||||||
that libpng will output. Consequently you must call all the png_set_
|
that libpng will output. Consequently you must call all the png_set_
|
||||||
functions before you call png_read_update_info. This is particularly
|
functions before you call png_read_update_info(). This is particularly
|
||||||
important for png_set_interlace_handling - if you are going to call
|
important for png_set_interlace_handling() - if you are going to call
|
||||||
png_read_update_info you must call png_set_interlace_handling before
|
png_read_update_info() you must call png_set_interlace_handling() before
|
||||||
it unless you want to receive interlaced output.
|
it unless you want to receive interlaced output.
|
||||||
|
|
||||||
Reading image data
|
Reading image data
|
||||||
@ -1610,12 +1713,14 @@ These allow you to write the obvious loop:
|
|||||||
|
|
||||||
while (output_x < output_image_width)
|
while (output_x < output_image_width)
|
||||||
{
|
{
|
||||||
image[output_y][output_x] = subimage[pass][input_y][input_x++];
|
image[output_y][output_x] =
|
||||||
|
subimage[pass][input_y][input_x++];
|
||||||
|
|
||||||
output_x += xStep;
|
output_x += xStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
++input_y;
|
++input_y;
|
||||||
ouput_y += yStep;
|
output_y += yStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
Notice that the steps between successive output rows and columns are
|
Notice that the steps between successive output rows and columns are
|
||||||
@ -1667,6 +1772,7 @@ It is also possible to individually free the info_ptr members that
|
|||||||
point to libpng-allocated storage with the following function:
|
point to libpng-allocated storage with the following function:
|
||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||||
|
|
||||||
mask - identifies data to be freed, a mask
|
mask - identifies data to be freed, a mask
|
||||||
containing the bitwise OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
@ -1676,6 +1782,7 @@ point to libpng-allocated storage with the following function:
|
|||||||
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
||||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||||
or simply PNG_FREE_ALL
|
or simply PNG_FREE_ALL
|
||||||
|
|
||||||
seq - sequence number of item to be freed
|
seq - sequence number of item to be freed
|
||||||
(-1 for all items)
|
(-1 for all items)
|
||||||
|
|
||||||
@ -1693,13 +1800,15 @@ or so that it will free data that was allocated by the user with png_malloc()
|
|||||||
or png_zalloc() and passed in via a png_set_*() function, with
|
or png_zalloc() and passed in via a png_set_*() function, with
|
||||||
|
|
||||||
png_data_freer(png_ptr, info_ptr, freer, mask)
|
png_data_freer(png_ptr, info_ptr, freer, mask)
|
||||||
mask - which data elements are affected
|
|
||||||
same choices as in png_free_data()
|
|
||||||
freer - one of
|
freer - one of
|
||||||
PNG_DESTROY_WILL_FREE_DATA
|
PNG_DESTROY_WILL_FREE_DATA
|
||||||
PNG_SET_WILL_FREE_DATA
|
PNG_SET_WILL_FREE_DATA
|
||||||
PNG_USER_WILL_FREE_DATA
|
PNG_USER_WILL_FREE_DATA
|
||||||
|
|
||||||
|
mask - which data elements are affected
|
||||||
|
same choices as in png_free_data()
|
||||||
|
|
||||||
This function only affects data that has already been allocated.
|
This function only affects data that has already been allocated.
|
||||||
You can call this function after reading the PNG data but before calling
|
You can call this function after reading the PNG data but before calling
|
||||||
any png_set_*() functions, to control whether the user or the png_set_*()
|
any png_set_*() functions, to control whether the user or the png_set_*()
|
||||||
@ -1728,6 +1837,7 @@ it frees. If you need to turn the flag off for a chunk that was freed by
|
|||||||
your application instead of by libpng, you can use
|
your application instead of by libpng, you can use
|
||||||
|
|
||||||
png_set_invalid(png_ptr, info_ptr, mask);
|
png_set_invalid(png_ptr, info_ptr, mask);
|
||||||
|
|
||||||
mask - identifies the chunks to be made invalid,
|
mask - identifies the chunks to be made invalid,
|
||||||
containing the bitwise OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
@ -1767,13 +1877,16 @@ png_infop info_ptr;
|
|||||||
png_ptr = png_create_read_struct
|
png_ptr = png_create_read_struct
|
||||||
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
|
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
|
||||||
user_error_fn, user_warning_fn);
|
user_error_fn, user_warning_fn);
|
||||||
|
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
|
|
||||||
info_ptr = png_create_info_struct(png_ptr);
|
info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(&png_ptr, (png_infopp)NULL,
|
png_destroy_read_struct(&png_ptr,
|
||||||
(png_infopp)NULL);
|
(png_infopp)NULL, (png_infopp)NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1938,10 +2051,9 @@ using the standard I/O functions, you will need to replace them with
|
|||||||
custom writing functions. See the discussion under Customizing libpng.
|
custom writing functions. See the discussion under Customizing libpng.
|
||||||
|
|
||||||
FILE *fp = fopen(file_name, "wb");
|
FILE *fp = fopen(file_name, "wb");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
|
||||||
|
|
||||||
Next, png_struct and png_info need to be allocated and initialized.
|
Next, png_struct and png_info need to be allocated and initialized.
|
||||||
As these can be both relatively large, you may not want to store these
|
As these can be both relatively large, you may not want to store these
|
||||||
@ -1954,6 +2066,7 @@ both "png_ptr"; you can call them anything you like, such as
|
|||||||
png_structp png_ptr = png_create_write_struct
|
png_structp png_ptr = png_create_write_struct
|
||||||
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
|
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
|
||||||
user_error_fn, user_warning_fn);
|
user_error_fn, user_warning_fn);
|
||||||
|
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
|
|
||||||
@ -2057,7 +2170,8 @@ filter types.
|
|||||||
/* turn on or off filtering, and/or choose
|
/* turn on or off filtering, and/or choose
|
||||||
specific filters. You can use either a single
|
specific filters. You can use either a single
|
||||||
PNG_FILTER_VALUE_NAME or the bitwise OR of one
|
PNG_FILTER_VALUE_NAME or the bitwise OR of one
|
||||||
or more PNG_FILTER_NAME masks. */
|
or more PNG_FILTER_NAME masks.
|
||||||
|
*/
|
||||||
png_set_filter(png_ptr, 0,
|
png_set_filter(png_ptr, 0,
|
||||||
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
||||||
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
|
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
|
||||||
@ -2113,16 +2227,20 @@ Some of the more important parts of the png_info are:
|
|||||||
png_set_IHDR(png_ptr, info_ptr, width, height,
|
png_set_IHDR(png_ptr, info_ptr, width, height,
|
||||||
bit_depth, color_type, interlace_type,
|
bit_depth, color_type, interlace_type,
|
||||||
compression_type, filter_method)
|
compression_type, filter_method)
|
||||||
|
|
||||||
width - holds the width of the image
|
width - holds the width of the image
|
||||||
in pixels (up to 2^31).
|
in pixels (up to 2^31).
|
||||||
|
|
||||||
height - holds the height of the image
|
height - holds the height of the image
|
||||||
in pixels (up to 2^31).
|
in pixels (up to 2^31).
|
||||||
|
|
||||||
bit_depth - holds the bit depth of one of the
|
bit_depth - holds the bit depth of one of the
|
||||||
image channels.
|
image channels.
|
||||||
(valid values are 1, 2, 4, 8, 16
|
(valid values are 1, 2, 4, 8, 16
|
||||||
and depend also on the
|
and depend also on the
|
||||||
color_type. See also significant
|
color_type. See also significant
|
||||||
bits (sBIT) below).
|
bits (sBIT) below).
|
||||||
|
|
||||||
color_type - describes which color/alpha
|
color_type - describes which color/alpha
|
||||||
channels are present.
|
channels are present.
|
||||||
PNG_COLOR_TYPE_GRAY
|
PNG_COLOR_TYPE_GRAY
|
||||||
@ -2142,8 +2260,10 @@ Some of the more important parts of the png_info are:
|
|||||||
|
|
||||||
interlace_type - PNG_INTERLACE_NONE or
|
interlace_type - PNG_INTERLACE_NONE or
|
||||||
PNG_INTERLACE_ADAM7
|
PNG_INTERLACE_ADAM7
|
||||||
|
|
||||||
compression_type - (must be
|
compression_type - (must be
|
||||||
PNG_COMPRESSION_TYPE_DEFAULT)
|
PNG_COMPRESSION_TYPE_DEFAULT)
|
||||||
|
|
||||||
filter_method - (must be PNG_FILTER_TYPE_DEFAULT
|
filter_method - (must be PNG_FILTER_TYPE_DEFAULT
|
||||||
or, if you are writing a PNG to
|
or, if you are writing a PNG to
|
||||||
be embedded in a MNG datastream,
|
be embedded in a MNG datastream,
|
||||||
@ -2161,15 +2281,18 @@ width, height, bit_depth, and color_type must be the same in each call.
|
|||||||
|
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette,
|
png_set_PLTE(png_ptr, info_ptr, palette,
|
||||||
num_palette);
|
num_palette);
|
||||||
|
|
||||||
palette - the palette for the file
|
palette - the palette for the file
|
||||||
(array of png_color)
|
(array of png_color)
|
||||||
num_palette - number of entries in the palette
|
num_palette - number of entries in the palette
|
||||||
|
|
||||||
png_set_gAMA(png_ptr, info_ptr, gamma);
|
png_set_gAMA(png_ptr, info_ptr, gamma);
|
||||||
|
|
||||||
gamma - the gamma the image was created
|
gamma - the gamma the image was created
|
||||||
at (PNG_INFO_gAMA)
|
at (PNG_INFO_gAMA)
|
||||||
|
|
||||||
png_set_sRGB(png_ptr, info_ptr, srgb_intent);
|
png_set_sRGB(png_ptr, info_ptr, srgb_intent);
|
||||||
|
|
||||||
srgb_intent - the rendering intent
|
srgb_intent - the rendering intent
|
||||||
(PNG_INFO_sRGB) The presence of
|
(PNG_INFO_sRGB) The presence of
|
||||||
the sRGB chunk means that the pixel
|
the sRGB chunk means that the pixel
|
||||||
@ -2189,6 +2312,7 @@ width, height, bit_depth, and color_type must be the same in each call.
|
|||||||
|
|
||||||
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr,
|
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr,
|
||||||
srgb_intent);
|
srgb_intent);
|
||||||
|
|
||||||
srgb_intent - the rendering intent
|
srgb_intent - the rendering intent
|
||||||
(PNG_INFO_sRGB) The presence of the
|
(PNG_INFO_sRGB) The presence of the
|
||||||
sRGB chunk means that the pixel
|
sRGB chunk means that the pixel
|
||||||
@ -2200,16 +2324,21 @@ width, height, bit_depth, and color_type must be the same in each call.
|
|||||||
|
|
||||||
png_set_iCCP(png_ptr, info_ptr, name, compression_type,
|
png_set_iCCP(png_ptr, info_ptr, name, compression_type,
|
||||||
profile, proflen);
|
profile, proflen);
|
||||||
|
|
||||||
name - The profile name.
|
name - The profile name.
|
||||||
|
|
||||||
compression_type - The compression type; always
|
compression_type - The compression type; always
|
||||||
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
||||||
You may give NULL to this argument to
|
You may give NULL to this argument to
|
||||||
ignore it.
|
ignore it.
|
||||||
|
|
||||||
profile - International Color Consortium color
|
profile - International Color Consortium color
|
||||||
profile data. May contain NULs.
|
profile data. May contain NULs.
|
||||||
|
|
||||||
proflen - length of profile data in bytes.
|
proflen - length of profile data in bytes.
|
||||||
|
|
||||||
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
||||||
|
|
||||||
sig_bit - the number of significant bits for
|
sig_bit - the number of significant bits for
|
||||||
(PNG_INFO_sBIT) each of the gray, red,
|
(PNG_INFO_sBIT) each of the gray, red,
|
||||||
green, and blue channels, whichever are
|
green, and blue channels, whichever are
|
||||||
@ -2218,30 +2347,38 @@ width, height, bit_depth, and color_type must be the same in each call.
|
|||||||
|
|
||||||
png_set_tRNS(png_ptr, info_ptr, trans_alpha,
|
png_set_tRNS(png_ptr, info_ptr, trans_alpha,
|
||||||
num_trans, trans_color);
|
num_trans, trans_color);
|
||||||
|
|
||||||
trans_alpha - array of alpha (transparency)
|
trans_alpha - array of alpha (transparency)
|
||||||
entries for palette (PNG_INFO_tRNS)
|
entries for palette (PNG_INFO_tRNS)
|
||||||
|
|
||||||
trans_color - graylevel or color sample values
|
trans_color - graylevel or color sample values
|
||||||
(in order red, green, blue) of the
|
(in order red, green, blue) of the
|
||||||
single transparent color for
|
single transparent color for
|
||||||
non-paletted images (PNG_INFO_tRNS)
|
non-paletted images (PNG_INFO_tRNS)
|
||||||
|
|
||||||
num_trans - number of transparent entries
|
num_trans - number of transparent entries
|
||||||
(PNG_INFO_tRNS)
|
(PNG_INFO_tRNS)
|
||||||
|
|
||||||
png_set_hIST(png_ptr, info_ptr, hist);
|
png_set_hIST(png_ptr, info_ptr, hist);
|
||||||
(PNG_INFO_hIST)
|
(PNG_INFO_hIST)
|
||||||
|
|
||||||
hist - histogram of palette (array of
|
hist - histogram of palette (array of
|
||||||
png_uint_16)
|
png_uint_16)
|
||||||
|
|
||||||
png_set_tIME(png_ptr, info_ptr, mod_time);
|
png_set_tIME(png_ptr, info_ptr, mod_time);
|
||||||
|
|
||||||
mod_time - time image was last modified
|
mod_time - time image was last modified
|
||||||
(PNG_VALID_tIME)
|
(PNG_VALID_tIME)
|
||||||
|
|
||||||
png_set_bKGD(png_ptr, info_ptr, background);
|
png_set_bKGD(png_ptr, info_ptr, background);
|
||||||
|
|
||||||
background - background color (PNG_VALID_bKGD)
|
background - background color (PNG_VALID_bKGD)
|
||||||
|
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, num_text);
|
png_set_text(png_ptr, info_ptr, text_ptr, num_text);
|
||||||
|
|
||||||
text_ptr - array of png_text holding image
|
text_ptr - array of png_text holding image
|
||||||
comments
|
comments
|
||||||
|
|
||||||
text_ptr[i].compression - type of compression used
|
text_ptr[i].compression - type of compression used
|
||||||
on "text" PNG_TEXT_COMPRESSION_NONE
|
on "text" PNG_TEXT_COMPRESSION_NONE
|
||||||
PNG_TEXT_COMPRESSION_zTXt
|
PNG_TEXT_COMPRESSION_zTXt
|
||||||
@ -2267,6 +2404,7 @@ width, height, bit_depth, and color_type must be the same in each call.
|
|||||||
|
|
||||||
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
|
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
|
||||||
num_spalettes);
|
num_spalettes);
|
||||||
|
|
||||||
palette_ptr - array of png_sPLT_struct structures
|
palette_ptr - array of png_sPLT_struct structures
|
||||||
to be added to the list of palettes
|
to be added to the list of palettes
|
||||||
in the info structure.
|
in the info structure.
|
||||||
@ -2275,35 +2413,48 @@ width, height, bit_depth, and color_type must be the same in each call.
|
|||||||
|
|
||||||
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
|
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
|
||||||
unit_type);
|
unit_type);
|
||||||
|
|
||||||
offset_x - positive offset from the left
|
offset_x - positive offset from the left
|
||||||
edge of the screen
|
edge of the screen
|
||||||
|
|
||||||
offset_y - positive offset from the top
|
offset_y - positive offset from the top
|
||||||
edge of the screen
|
edge of the screen
|
||||||
|
|
||||||
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
|
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
|
||||||
|
|
||||||
png_set_pHYs(png_ptr, info_ptr, res_x, res_y,
|
png_set_pHYs(png_ptr, info_ptr, res_x, res_y,
|
||||||
unit_type);
|
unit_type);
|
||||||
|
|
||||||
res_x - pixels/unit physical resolution
|
res_x - pixels/unit physical resolution
|
||||||
in x direction
|
in x direction
|
||||||
|
|
||||||
res_y - pixels/unit physical resolution
|
res_y - pixels/unit physical resolution
|
||||||
in y direction
|
in y direction
|
||||||
|
|
||||||
unit_type - PNG_RESOLUTION_UNKNOWN,
|
unit_type - PNG_RESOLUTION_UNKNOWN,
|
||||||
PNG_RESOLUTION_METER
|
PNG_RESOLUTION_METER
|
||||||
|
|
||||||
png_set_sCAL(png_ptr, info_ptr, unit, width, height)
|
png_set_sCAL(png_ptr, info_ptr, unit, width, height)
|
||||||
|
|
||||||
unit - physical scale units (an integer)
|
unit - physical scale units (an integer)
|
||||||
|
|
||||||
width - width of a pixel in physical scale units
|
width - width of a pixel in physical scale units
|
||||||
|
|
||||||
height - height of a pixel in physical scale units
|
height - height of a pixel in physical scale units
|
||||||
(width and height are doubles)
|
(width and height are doubles)
|
||||||
|
|
||||||
png_set_sCAL_s(png_ptr, info_ptr, unit, width, height)
|
png_set_sCAL_s(png_ptr, info_ptr, unit, width, height)
|
||||||
|
|
||||||
unit - physical scale units (an integer)
|
unit - physical scale units (an integer)
|
||||||
|
|
||||||
width - width of a pixel in physical scale units
|
width - width of a pixel in physical scale units
|
||||||
|
|
||||||
height - height of a pixel in physical scale units
|
height - height of a pixel in physical scale units
|
||||||
(width and height are strings like "2.54")
|
(width and height are strings like "2.54")
|
||||||
|
|
||||||
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns,
|
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns,
|
||||||
num_unknowns)
|
num_unknowns)
|
||||||
|
|
||||||
unknowns - array of png_unknown_chunk
|
unknowns - array of png_unknown_chunk
|
||||||
structures holding unknown chunks
|
structures holding unknown chunks
|
||||||
unknowns[i].name - name of unknown chunk
|
unknowns[i].name - name of unknown chunk
|
||||||
@ -2342,21 +2493,30 @@ Until text gets around 1000 bytes, it is not worth compressing it.
|
|||||||
After the text has been written out to the file, the compression type
|
After the text has been written out to the file, the compression type
|
||||||
is set to PNG_TEXT_COMPRESSION_NONE_WR or PNG_TEXT_COMPRESSION_zTXt_WR,
|
is set to PNG_TEXT_COMPRESSION_NONE_WR or PNG_TEXT_COMPRESSION_zTXt_WR,
|
||||||
so that it isn't written out again at the end (in case you are calling
|
so that it isn't written out again at the end (in case you are calling
|
||||||
png_write_end() with the same struct.
|
png_write_end() with the same struct).
|
||||||
|
|
||||||
The keywords that are given in the PNG Specification are:
|
The keywords that are given in the PNG Specification are:
|
||||||
|
|
||||||
Title Short (one line) title or
|
Title Short (one line) title or
|
||||||
caption for image
|
caption for image
|
||||||
|
|
||||||
Author Name of image's creator
|
Author Name of image's creator
|
||||||
|
|
||||||
Description Description of image (possibly long)
|
Description Description of image (possibly long)
|
||||||
|
|
||||||
Copyright Copyright notice
|
Copyright Copyright notice
|
||||||
|
|
||||||
Creation Time Time of original image creation
|
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
|
Software Software used to create the image
|
||||||
|
|
||||||
Disclaimer Legal disclaimer
|
Disclaimer Legal disclaimer
|
||||||
|
|
||||||
Warning Warning of nature of content
|
Warning Warning of nature of content
|
||||||
|
|
||||||
Source Device used to create the image
|
Source Device used to create the image
|
||||||
|
|
||||||
Comment Miscellaneous comment; conversion
|
Comment Miscellaneous comment; conversion
|
||||||
from other image format
|
from other image format
|
||||||
|
|
||||||
@ -2530,10 +2690,12 @@ file so that decoders can recover the original data if desired.
|
|||||||
sig_bit.green = true_bit_depth;
|
sig_bit.green = true_bit_depth;
|
||||||
sig_bit.blue = true_bit_depth;
|
sig_bit.blue = true_bit_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sig_bit.gray = true_bit_depth;
|
sig_bit.gray = true_bit_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color_type & PNG_COLOR_MASK_ALPHA)
|
if (color_type & PNG_COLOR_MASK_ALPHA)
|
||||||
{
|
{
|
||||||
sig_bit.alpha = true_bit_depth;
|
sig_bit.alpha = true_bit_depth;
|
||||||
@ -2719,6 +2881,7 @@ It is also possible to individually free the info_ptr members that
|
|||||||
point to libpng-allocated storage with the following function:
|
point to libpng-allocated storage with the following function:
|
||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||||
|
|
||||||
mask - identifies data to be freed, a mask
|
mask - identifies data to be freed, a mask
|
||||||
containing the bitwise OR of one or
|
containing the bitwise OR of one or
|
||||||
more of
|
more of
|
||||||
@ -2728,6 +2891,7 @@ point to libpng-allocated storage with the following function:
|
|||||||
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
||||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||||
or simply PNG_FREE_ALL
|
or simply PNG_FREE_ALL
|
||||||
|
|
||||||
seq - sequence number of item to be freed
|
seq - sequence number of item to be freed
|
||||||
(-1 for all items)
|
(-1 for all items)
|
||||||
|
|
||||||
@ -2749,19 +2913,22 @@ or so that it will free data that was allocated by the user with png_malloc()
|
|||||||
or png_zalloc() and passed in via a png_set_*() function, with
|
or png_zalloc() and passed in via a png_set_*() function, with
|
||||||
|
|
||||||
png_data_freer(png_ptr, info_ptr, freer, mask)
|
png_data_freer(png_ptr, info_ptr, freer, mask)
|
||||||
mask - which data elements are affected
|
|
||||||
same choices as in png_free_data()
|
|
||||||
freer - one of
|
freer - one of
|
||||||
PNG_DESTROY_WILL_FREE_DATA
|
PNG_DESTROY_WILL_FREE_DATA
|
||||||
PNG_SET_WILL_FREE_DATA
|
PNG_SET_WILL_FREE_DATA
|
||||||
PNG_USER_WILL_FREE_DATA
|
PNG_USER_WILL_FREE_DATA
|
||||||
|
|
||||||
|
mask - which data elements are affected
|
||||||
|
same choices as in png_free_data()
|
||||||
|
|
||||||
For example, to transfer responsibility for some data from a read structure
|
For example, to transfer responsibility for some data from a read structure
|
||||||
to a write structure, you could use
|
to a write structure, you could use
|
||||||
|
|
||||||
png_data_freer(read_ptr, read_info_ptr,
|
png_data_freer(read_ptr, read_info_ptr,
|
||||||
PNG_USER_WILL_FREE_DATA,
|
PNG_USER_WILL_FREE_DATA,
|
||||||
PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
|
PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
|
||||||
|
|
||||||
png_data_freer(write_ptr, write_info_ptr,
|
png_data_freer(write_ptr, write_info_ptr,
|
||||||
PNG_DESTROY_WILL_FREE_DATA,
|
PNG_DESTROY_WILL_FREE_DATA,
|
||||||
PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
|
PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST)
|
||||||
@ -2827,6 +2994,7 @@ Your replacement memory functions must have prototypes as follows:
|
|||||||
|
|
||||||
png_voidp malloc_fn(png_structp png_ptr,
|
png_voidp malloc_fn(png_structp png_ptr,
|
||||||
png_alloc_size_t size);
|
png_alloc_size_t size);
|
||||||
|
|
||||||
void free_fn(png_structp png_ptr, png_voidp ptr);
|
void free_fn(png_structp png_ptr, png_voidp ptr);
|
||||||
|
|
||||||
Your malloc_fn() must return NULL in case of failure. The png_malloc()
|
Your malloc_fn() must return NULL in case of failure. The png_malloc()
|
||||||
@ -2859,8 +3027,10 @@ The replacement I/O functions must have prototypes as follows:
|
|||||||
|
|
||||||
void user_read_data(png_structp png_ptr,
|
void user_read_data(png_structp png_ptr,
|
||||||
png_bytep data, png_size_t length);
|
png_bytep data, png_size_t length);
|
||||||
|
|
||||||
void user_write_data(png_structp png_ptr,
|
void user_write_data(png_structp png_ptr,
|
||||||
png_bytep data, png_size_t length);
|
png_bytep data, png_size_t length);
|
||||||
|
|
||||||
void user_flush_data(png_structp png_ptr);
|
void user_flush_data(png_structp png_ptr);
|
||||||
|
|
||||||
The user_read_data() function is responsible for detecting and
|
The user_read_data() function is responsible for detecting and
|
||||||
@ -2905,6 +3075,7 @@ parameters as follows:
|
|||||||
|
|
||||||
void user_error_fn(png_structp png_ptr,
|
void user_error_fn(png_structp png_ptr,
|
||||||
png_const_charp error_msg);
|
png_const_charp error_msg);
|
||||||
|
|
||||||
void user_warning_fn(png_structp png_ptr,
|
void user_warning_fn(png_structp png_ptr,
|
||||||
png_const_charp warning_msg);
|
png_const_charp warning_msg);
|
||||||
|
|
||||||
@ -3015,8 +3186,10 @@ zlib.h for more information on what these mean.
|
|||||||
|
|
||||||
png_set_compression_strategy(png_ptr,
|
png_set_compression_strategy(png_ptr,
|
||||||
strategy);
|
strategy);
|
||||||
|
|
||||||
png_set_compression_window_bits(png_ptr,
|
png_set_compression_window_bits(png_ptr,
|
||||||
window_bits);
|
window_bits);
|
||||||
|
|
||||||
png_set_compression_method(png_ptr, method);
|
png_set_compression_method(png_ptr, method);
|
||||||
png_set_compression_buffer_size(png_ptr, size);
|
png_set_compression_buffer_size(png_ptr, size);
|
||||||
|
|
||||||
@ -3106,6 +3279,8 @@ before recompiling libpng and save yourself code and data space, or
|
|||||||
you can turn off individual capabilities with defines that begin with
|
you can turn off individual capabilities with defines that begin with
|
||||||
PNG_NO_.
|
PNG_NO_.
|
||||||
|
|
||||||
|
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
|
||||||
|
|
||||||
You can also turn all of the transforms and ancillary chunk capabilities
|
You can also turn all of the transforms and ancillary chunk capabilities
|
||||||
off en masse with compiler directives that define
|
off en masse with compiler directives that define
|
||||||
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
|
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
|
||||||
@ -3158,7 +3333,7 @@ according to printf-style formatting directives. For example,
|
|||||||
|
|
||||||
is expanded to
|
is expanded to
|
||||||
|
|
||||||
if(PNG_DEBUG > 2)
|
if (PNG_DEBUG > 2)
|
||||||
fprintf(PNG_DEBUG_FILE, "foo=%d\n", foo);
|
fprintf(PNG_DEBUG_FILE, "foo=%d\n", foo);
|
||||||
|
|
||||||
When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
|
When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
|
||||||
@ -3180,11 +3355,13 @@ Libpng can support some of these extensions. To enable them, use the
|
|||||||
png_permit_mng_features() function:
|
png_permit_mng_features() function:
|
||||||
|
|
||||||
feature_set = png_permit_mng_features(png_ptr, mask)
|
feature_set = png_permit_mng_features(png_ptr, mask)
|
||||||
|
|
||||||
mask is a png_uint_32 containing the bitwise OR of the
|
mask is a png_uint_32 containing the bitwise OR of the
|
||||||
features you want to enable. These include
|
features you want to enable. These include
|
||||||
PNG_FLAG_MNG_EMPTY_PLTE
|
PNG_FLAG_MNG_EMPTY_PLTE
|
||||||
PNG_FLAG_MNG_FILTER_64
|
PNG_FLAG_MNG_FILTER_64
|
||||||
PNG_ALL_MNG_FEATURES
|
PNG_ALL_MNG_FEATURES
|
||||||
|
|
||||||
feature_set is a png_uint_32 that is the bitwise AND of
|
feature_set is a png_uint_32 that is the bitwise AND of
|
||||||
your mask with the set of MNG features that is
|
your mask with the set of MNG features that is
|
||||||
supported by the version of libpng that you are using.
|
supported by the version of libpng that you are using.
|
||||||
@ -3209,7 +3386,7 @@ still alive and well, but they have moved on to other things.
|
|||||||
The old libpng functions png_read_init(), png_write_init(),
|
The old libpng functions png_read_init(), png_write_init(),
|
||||||
png_info_init(), png_read_destroy(), and png_write_destroy() have been
|
png_info_init(), png_read_destroy(), and png_write_destroy() have been
|
||||||
moved to PNG_INTERNAL in version 0.95 to discourage their use. These
|
moved to PNG_INTERNAL in version 0.95 to discourage their use. These
|
||||||
functions will be removed from libpng version 2.0.0.
|
functions will be removed from libpng version 1.4.0.
|
||||||
|
|
||||||
The preferred method of creating and initializing the libpng structures is
|
The preferred method of creating and initializing the libpng structures is
|
||||||
via the png_create_read_struct(), png_create_write_struct(), and
|
via the png_create_read_struct(), png_create_write_struct(), and
|
||||||
@ -3445,7 +3622,8 @@ PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support
|
|||||||
was reenabled, but the function was renamed png_set_quantize() to
|
was reenabled, but the function was renamed png_set_quantize() to
|
||||||
reflect more accurately what it actually does. At the same time,
|
reflect more accurately what it actually does. At the same time,
|
||||||
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
|
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
|
||||||
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
|
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS, and PNG_READ_DITHER_SUPPORTED
|
||||||
|
was renamed to PNG_READ_QUANTIZE_SUPPORTED.
|
||||||
|
|
||||||
We removed the trailing '.' from the warning and error messages.
|
We removed the trailing '.' from the warning and error messages.
|
||||||
|
|
||||||
@ -3472,7 +3650,7 @@ png_memcmp(), png_sprintf, and png_memcpy() macros into a private
|
|||||||
header file (pngpriv.h) that is not accessible to applications.
|
header file (pngpriv.h) that is not accessible to applications.
|
||||||
|
|
||||||
In png_get_iCCP, the type of "profile" was changed from png_charpp
|
In png_get_iCCP, the type of "profile" was changed from png_charpp
|
||||||
to png_bytepp, and in png_set_iCCP, from png_charp to png_const_bytepp.
|
to png_bytepp, and in png_set_iCCP, from png_charp to png_const_bytep.
|
||||||
|
|
||||||
There are changes of form in png.h, including new and changed macros to
|
There are changes of form in png.h, including new and changed macros to
|
||||||
declare
|
declare
|
||||||
@ -3587,8 +3765,8 @@ changed. A single set of operating system independent macro definitions
|
|||||||
is used and operating system specific directives are defined in
|
is used and operating system specific directives are defined in
|
||||||
pnglibconf.h
|
pnglibconf.h
|
||||||
|
|
||||||
As part of this the mechanism used to chose procedure call standards on those
|
As part of this the mechanism used to choose procedure call standards on
|
||||||
systems that allow a choice has been changed. At present this only
|
those systems that allow a choice has been changed. At present this only
|
||||||
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
|
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
|
||||||
running on Intel processors. As before PNGAPI is defined where required
|
running on Intel processors. As before PNGAPI is defined where required
|
||||||
to control the exported API functions; however, two new macros, PNGCBAPI
|
to control the exported API functions; however, two new macros, PNGCBAPI
|
||||||
@ -3606,7 +3784,7 @@ necessary to set PNG_API_RULE to 1 should advise the mailing list
|
|||||||
therefore set PNG_API_RULE to 2 should also contact the mailing list.
|
therefore set PNG_API_RULE to 2 should also contact the mailing list.
|
||||||
|
|
||||||
A new test program, pngvalid, is provided in addition to pngtest.
|
A new test program, pngvalid, is provided in addition to pngtest.
|
||||||
pngvalid validates the arithmetic accuracy of the gamma correction
|
pngvalid validates the arithmetic accuracy of the gamma correction
|
||||||
calculations and includes a number of validations of the file format.
|
calculations and includes a number of validations of the file format.
|
||||||
A subset of the full range of tests is run when "make check" is done
|
A subset of the full range of tests is run when "make check" is done
|
||||||
(in the 'configure' build.) pngvalid also allows total allocated memory
|
(in the 'configure' build.) pngvalid also allows total allocated memory
|
||||||
@ -3689,8 +3867,8 @@ unmodified, default, libpng API and thus would probably fail to link.
|
|||||||
|
|
||||||
These mechanisms still work in the configure build and in any makefile
|
These mechanisms still work in the configure build and in any makefile
|
||||||
build that builds pnglibconf.h although the feature selection macros
|
build that builds pnglibconf.h although the feature selection macros
|
||||||
have changed somewhat as described above. In 1.5.0, however, pngusr.h
|
have changed somewhat as described above. In 1.5.0, however, pngusr.h is
|
||||||
is processed once when the exported header file pnglibconf.h is built.
|
processed only once, when the exported header file pnglibconf.h is built.
|
||||||
pngconf.h no longer includes pngusr.h, therefore it is ignored after the
|
pngconf.h no longer includes pngusr.h, therefore it is ignored after the
|
||||||
build of pnglibconf.h and it is never included in an application build.
|
build of pnglibconf.h and it is never included in an application build.
|
||||||
|
|
||||||
@ -3745,6 +3923,11 @@ the libpng bug tracker at
|
|||||||
|
|
||||||
http://libpng.sourceforge.net
|
http://libpng.sourceforge.net
|
||||||
|
|
||||||
|
We also accept patches built from the tar or zip distributions, and
|
||||||
|
simple verbal discriptions of bug fixes, reported either to the
|
||||||
|
SourceForge bug tracker or to the png-mng-implement at lists.sf.net
|
||||||
|
mailing list.
|
||||||
|
|
||||||
XIII. Coding style
|
XIII. Coding style
|
||||||
|
|
||||||
Our coding style is similar to the "Allman" style, with curly
|
Our coding style is similar to the "Allman" style, with curly
|
||||||
@ -3855,13 +4038,13 @@ Other rules can be inferred by inspecting the libpng source.
|
|||||||
|
|
||||||
XIV. Y2K Compliance in libpng
|
XIV. Y2K Compliance in libpng
|
||||||
|
|
||||||
January 21, 2011
|
January 22, 2011
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.5.1rc01 are Y2K compliant. It is my belief that earlier
|
upward through 1.5.1beta07 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||||
|
Loading…
Reference in New Issue
Block a user