diff --git a/ANNOUNCE b/ANNOUNCE index edb918c6c..8e4df16a9 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -81,7 +81,14 @@ Version 1.5.1beta08 [January 22, 2011] a .dfn file and adds configure stuff to test for such a CPP. ./configure should fail if one is not available. -Version 1.5.1rc01 [January 22, 2011] +Version 1.5.1beta09 [January 22, 2011] + Corrected const_png_ in png.h to png_const_ to avoid polluting the namespace. + Added png_get_current_row_number and png_get_current_pass_number for the + benefit of the user transform callback. + Added png_process_data_pause and png_process_data_skip for the benefit of + progressive readers that need to stop data processing or want to optimize + skipping of unread data (e.g. if the reader marks a chunk to be skipped.) + Send comments/corrections/commendations to png-mng-implement at lists.sf.net: diff --git a/CHANGES b/CHANGES index cc42f412b..0ff873a8a 100644 --- a/CHANGES +++ b/CHANGES @@ -3197,7 +3197,13 @@ Version 1.5.1beta08 [January 22, 2011] a .dfn file and adds configure stuff to test for such a CPP. ./configure should fail if one is not available. -Version 1.5.1rc01 [January 22, 2011] +Version 1.5.1beta09 [January 22, 2011] + Corrected const_png_ in png.h to png_const_ to avoid polluting the namespace. + Added png_get_current_row_number and png_get_current_pass_number for the + benefit of the user transform callback. + Added png_process_data_pause and png_process_data_skip for the benefit of + progressive readers that need to stop data processing or want to optimize + skipping of unread data (e.g. if the reader marks a chunk to be skipped.) Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/libpng-manual.txt b/libpng-manual.txt index b34ffcc13..3caff8f9b 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -1515,7 +1515,20 @@ You must supply the function row_info, png_bytep data) See pngtest.c for a working example. Your function will be called -after all of the other transformations have been processed. +after all of the other transformations have been processed. Take care with +interlaced images if you do the interlace yourself - the width of the row is the +width in 'row_info', not the overall image width. + +If supported libpng provides two information routines that you can use to find +where you are in processing the image: + + png_get_current_pass_number(png_structp png_ptr); + png_get_current_row_number(png_structp png_ptr); + +Don't try using these outside a transform callback - firstly they are only +supported if user transforms are supported, secondly they may well return +unexpected results unless the row is actually being processed at the moment they +are called. You can also set up a pointer to a user structure for use by your callback function, and you can inform libpng that your transform @@ -1945,6 +1958,12 @@ png_infop info_ptr; so there. */ png_process_data(png_ptr, info_ptr, buffer, length); + + /* At this point you can call png_process_data_skip if + you want to handle data the library will skip yourself; + it simply returns the number of bytes to skip (and stops + libpng skipping that number of bytes on the next + png_process_data call). return 0; } @@ -1968,6 +1987,16 @@ png_infop info_ptr; This is where you turn on interlace handling, assuming you don't want to do it yourself. + + If you need to you can stop the processing of + your original input data at this point by calling + png_process_data_pause. This returns the number + of unprocessed bytes from the last png_process_data + call - it is up to you to ensure that the next call + sees these bytes again. If you don't want to bother + with this you can get libpng to cache the unread + bytes by setting the 'save' parameter (see png.h) but + then libpng will have to copy the data internally. */ } @@ -2017,6 +2046,9 @@ png_infop info_ptr; for interlaced images), you will have to pass the current row, and the function will combine the old row and the new row. + + You can also call png_process_data_pause in this + callback - see above. */ } @@ -2748,7 +2780,14 @@ You must supply the function row_info, png_bytep data) See pngtest.c for a working example. Your function will be called -before any of the other transformations are processed. +before any of the other transformations are processed. If supported +libpng also supplies an information routine that may be called from +your callback: + + png_get_current_row_number(png_ptr); + +This returns the current row passed to the transform. Even with interlaced +images the value returned is the row in the final output image. You can also set up a pointer to a user structure for use by your callback function. diff --git a/libpng.3 b/libpng.3 index dbbb97141..6be0357c0 100644 --- a/libpng.3 +++ b/libpng.3 @@ -108,81 +108,81 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.1beta08 \fI\fB -\fBpng_byte png_get_bit_depth (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_byte png_get_bit_depth (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_bKGD (const_png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_16p \fI*background\fP\fB);\fP +\fBpng_uint_32 png_get_bKGD (png_const_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_16p \fI*background\fP\fB);\fP \fI\fB -\fBpng_byte png_get_channels (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_byte png_get_channels (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_cHRM (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, double \fP\fI*white_x\fP\fB, double \fP\fI*white_y\fP\fB, double \fP\fI*red_x\fP\fB, double \fP\fI*red_y\fP\fB, double \fP\fI*green_x\fP\fB, double \fP\fI*green_y\fP\fB, double \fP\fI*blue_x\fP\fB, double \fI*blue_y\fP\fB);\fP +\fBpng_uint_32 png_get_cHRM (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, double \fP\fI*white_x\fP\fB, double \fP\fI*white_y\fP\fB, double \fP\fI*red_x\fP\fB, double \fP\fI*red_y\fP\fB, double \fP\fI*green_x\fP\fB, double \fP\fI*green_y\fP\fB, double \fP\fI*blue_x\fP\fB, double \fI*blue_y\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_cHRM_fixed (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*white_x\fP\fB, png_uint_32 \fP\fI*white_y\fP\fB, png_uint_32 \fP\fI*red_x\fP\fB, png_uint_32 \fP\fI*red_y\fP\fB, png_uint_32 \fP\fI*green_x\fP\fB, png_uint_32 \fP\fI*green_y\fP\fB, png_uint_32 \fP\fI*blue_x\fP\fB, png_uint_32 \fI*blue_y\fP\fB);\fP +\fBpng_uint_32 png_get_cHRM_fixed (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*white_x\fP\fB, png_uint_32 \fP\fI*white_y\fP\fB, png_uint_32 \fP\fI*red_x\fP\fB, png_uint_32 \fP\fI*red_y\fP\fB, png_uint_32 \fP\fI*green_x\fP\fB, png_uint_32 \fP\fI*green_y\fP\fB, png_uint_32 \fP\fI*blue_x\fP\fB, png_uint_32 \fI*blue_y\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_chunk_cache_max (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_chunk_cache_max (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB \fI\fB -\fBpng_alloc_size_t png_get_chunk_malloc_max (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_alloc_size_t png_get_chunk_malloc_max (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_byte png_get_color_type (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_byte png_get_color_type (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_compression_buffer_size (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_compression_buffer_size (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_byte png_get_compression_type (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_byte png_get_compression_type (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_byte png_get_copyright (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_byte png_get_copyright (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_voidp png_get_error_ptr (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_voidp png_get_error_ptr (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_byte png_get_filter_type (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_byte png_get_filter_type (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_gAMA (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, double \fI*file_gamma\fP\fB);\fP +\fBpng_uint_32 png_get_gAMA (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, double \fI*file_gamma\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_gAMA_fixed (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fI*int_file_gamma\fP\fB);\fP +\fBpng_uint_32 png_get_gAMA_fixed (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fI*int_file_gamma\fP\fB);\fP \fI\fB -\fBpng_byte png_get_header_ver (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_byte png_get_header_ver (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_byte png_get_header_version (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_byte png_get_header_version (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_hIST (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP +\fBpng_uint_32 png_get_hIST (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_iCCP (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_bytepp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP +\fBpng_uint_32 png_get_iCCP (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_bytepp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP \fI\fB @@ -190,11 +190,11 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.1beta08 \fI\fB -\fBpng_uint_32 png_get_image_height (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_image_height (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_image_width (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_image_width (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB @@ -202,7 +202,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.1beta08 \fI\fB -\fBpng_byte png_get_interlace_type (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_byte png_get_interlace_type (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB @@ -210,7 +210,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.1beta08 \fI\fB -\fBpng_uint_32 png_get_io_chunk_type (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_io_chunk_type (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB @@ -222,101 +222,101 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.1beta08 \fI\fB -\fBpng_byte png_get_libpng_ver (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_byte png_get_libpng_ver (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_voidp png_get_mem_ptr (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_voidp png_get_mem_ptr (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_oFFs (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*offset_x\fP\fB, png_uint_32 \fP\fI*offset_y\fP\fB, int \fI*unit_type\fP\fB);\fP +\fBpng_uint_32 png_get_oFFs (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*offset_x\fP\fB, png_uint_32 \fP\fI*offset_y\fP\fB, int \fI*unit_type\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_pCAL (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fI*purpose\fP\fB, png_int_32 \fP\fI*X0\fP\fB, png_int_32 \fP\fI*X1\fP\fB, int \fP\fI*type\fP\fB, int \fP\fI*nparams\fP\fB, png_charp \fP\fI*units\fP\fB, png_charpp \fI*params\fP\fB);\fP +\fBpng_uint_32 png_get_pCAL (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fI*purpose\fP\fB, png_int_32 \fP\fI*X0\fP\fB, png_int_32 \fP\fI*X1\fP\fB, int \fP\fI*type\fP\fB, int \fP\fI*nparams\fP\fB, png_charp \fP\fI*units\fP\fB, png_charpp \fI*params\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_pHYs (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*res_x\fP\fB, png_uint_32 \fP\fI*res_y\fP\fB, int \fI*unit_type\fP\fB);\fP +\fBpng_uint_32 png_get_pHYs (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*res_x\fP\fB, png_uint_32 \fP\fI*res_y\fP\fB, int \fI*unit_type\fP\fB);\fP \fI\fB -\fBfloat png_get_pixel_aspect_ratio (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBfloat png_get_pixel_aspect_ratio (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_pHYs_dpi (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*res_x\fP\fB, png_uint_32 \fP\fI*res_y\fP\fB, int \fI*unit_type\fP\fB);\fP +\fBpng_uint_32 png_get_pHYs_dpi (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*res_x\fP\fB, png_uint_32 \fP\fI*res_y\fP\fB, int \fI*unit_type\fP\fB);\fP \fI\fB -\fBpng_fixed_point png_get_pixel_aspect_ratio_fixed (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_fixed_point png_get_pixel_aspect_ratio_fixed (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_pixels_per_inch (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_pixels_per_inch (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_pixels_per_meter (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_pixels_per_meter (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_voidp png_get_progressive_ptr (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_voidp png_get_progressive_ptr (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_PLTE (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_colorp \fP\fI*palette\fP\fB, int \fI*num_palette\fP\fB);\fP +\fBpng_uint_32 png_get_PLTE (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_colorp \fP\fI*palette\fP\fB, int \fI*num_palette\fP\fB);\fP \fI\fB -\fBpng_byte png_get_rgb_to_gray_status (const_png_structp \fIpng_ptr) +\fBpng_byte png_get_rgb_to_gray_status (png_const_structp \fIpng_ptr) -\fBpng_uint_32 png_get_rowbytes (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_rowbytes (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_bytepp png_get_rows (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_bytepp png_get_rows (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_sBIT (const_png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_8p \fI*sig_bit\fP\fB);\fP +\fBpng_uint_32 png_get_sBIT (png_const_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_8p \fI*sig_bit\fP\fB);\fP \fI\fB -\fBvoid png_get_sCAL (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, int* \fP\fIunit\fP\fB, double* \fP\fIwidth\fP\fB, double* \fIheight\fP\fB);\fP +\fBvoid png_get_sCAL (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, int* \fP\fIunit\fP\fB, double* \fP\fIwidth\fP\fB, double* \fIheight\fP\fB);\fP \fI\fB -\fBvoid png_get_sCAL_fixed (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, int* \fP\fIunit\fP\fB, png_fixed_pointp \fP\fIwidth\fP\fB, png_fixed_pointp \fIheight\fP\fB);\fP +\fBvoid png_get_sCAL_fixed (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, int* \fP\fIunit\fP\fB, png_fixed_pointp \fP\fIwidth\fP\fB, png_fixed_pointp \fIheight\fP\fB);\fP \fI\fB -\fBvoid png_get_sCAL_s (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, int* \fP\fIunit\fP\fB, png_charpp \fP\fIwidth\fP\fB, png_charpp \fIheight\fP\fB);\fP +\fBvoid png_get_sCAL_s (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, int* \fP\fIunit\fP\fB, png_charpp \fP\fIwidth\fP\fB, png_charpp \fIheight\fP\fB);\fP \fI\fB -\fBpng_bytep png_get_signature (const_png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_bytep png_get_signature (png_const_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_sPLT (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fI*splt_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_sPLT (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fI*splt_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_sRGB (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, int \fI*intent\fP\fB);\fP +\fBpng_uint_32 png_get_sRGB (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, int \fI*intent\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_text (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fI*text_ptr\fP\fB, int \fI*num_text\fP\fB);\fP +\fBpng_uint_32 png_get_text (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fI*text_ptr\fP\fB, int \fI*num_text\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_tIME (const_png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_timep \fI*mod_time\fP\fB);\fP +\fBpng_uint_32 png_get_tIME (png_const_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_timep \fI*mod_time\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_tRNS (const_png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fI*trans_alpha\fP\fB, int \fP\fI*num_trans\fP\fB, png_color_16p \fI*trans_color\fP\fB);\fP +\fBpng_uint_32 png_get_tRNS (png_const_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fI*trans_alpha\fP\fB, int \fP\fI*num_trans\fP\fB, png_color_16p \fI*trans_color\fP\fB);\fP \fI\fB @@ -336,75 +336,75 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.1beta08 \fI\fB -\fBpng_uint_32 png_get_unknown_chunks (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_unknown_chunkpp \fIunknowns\fP\fB);\fP +\fBpng_uint_32 png_get_unknown_chunks (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_unknown_chunkpp \fIunknowns\fP\fB);\fP \fI\fB -\fBpng_voidp png_get_user_chunk_ptr (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_voidp png_get_user_chunk_ptr (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_user_height_max (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_user_height_max (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_voidp png_get_user_transform_ptr (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_voidp png_get_user_transform_ptr (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_user_width_max (const_png_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_user_width_max (png_const_structp \fIpng_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_valid (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIflag\fP\fB);\fP +\fBpng_uint_32 png_get_valid (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIflag\fP\fB);\fP \fI\fB -\fBfloat png_get_x_offset_inches (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBfloat png_get_x_offset_inches (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_fixed_point png_get_x_offset_inches_fixed (png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_fixed_point png_get_x_offset_inches_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_int_32 png_get_x_offset_microns (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_int_32 png_get_x_offset_microns (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_int_32 png_get_x_offset_pixels (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_int_32 png_get_x_offset_pixels (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_x_pixels_per_inch (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_x_pixels_per_inch (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_x_pixels_per_meter (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_x_pixels_per_meter (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBfloat png_get_y_offset_inches (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBfloat png_get_y_offset_inches (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_fixed_point png_get_y_offset_inches_fixed (png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_fixed_point png_get_y_offset_inches_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_int_32 png_get_y_offset_microns (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_int_32 png_get_y_offset_microns (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_int_32 png_get_y_offset_pixels (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_int_32 png_get_y_offset_pixels (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_y_pixels_per_inch (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_y_pixels_per_inch (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB -\fBpng_uint_32 png_get_y_pixels_per_meter (const_png_structp \fP\fIpng_ptr\fP\fB, const_png_infop \fIinfo_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_y_pixels_per_meter (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP \fI\fB diff --git a/png.c b/png.c index 659f7418a..c14a78290 100644 --- a/png.c +++ b/png.c @@ -547,7 +547,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime) #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ png_const_charp PNGAPI -png_get_copyright(const_png_structp png_ptr) +png_get_copyright(png_const_structp png_ptr) { PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ #ifdef PNG_STRING_COPYRIGHT @@ -578,14 +578,14 @@ png_get_copyright(const_png_structp png_ptr) * it is guaranteed that png.c uses the correct version of png.h. */ png_const_charp PNGAPI -png_get_libpng_ver(const_png_structp png_ptr) +png_get_libpng_ver(png_const_structp png_ptr) { /* Version of *.c files used when building libpng */ return png_get_header_ver(png_ptr); } png_const_charp PNGAPI -png_get_header_ver(const_png_structp png_ptr) +png_get_header_ver(png_const_structp png_ptr) { /* Version of *.h files used when building libpng */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ @@ -593,7 +593,7 @@ png_get_header_ver(const_png_structp png_ptr) } png_const_charp PNGAPI -png_get_header_version(const_png_structp png_ptr) +png_get_header_version(png_const_structp png_ptr) { /* Returns longer string containing both version and date */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ diff --git a/png.h b/png.h index 29ec464e9..849410a73 100644 --- a/png.h +++ b/png.h @@ -663,7 +663,7 @@ typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp; typedef struct png_info_def png_info; typedef png_info FAR * png_infop; -typedef PNG_CONST png_info FAR * const_png_infop; +typedef PNG_CONST png_info FAR * png_const_infop; typedef png_info FAR * FAR * png_infopp; /* Maximum positive integer used in PNG is (2^31)-1 */ @@ -791,7 +791,7 @@ typedef png_row_info FAR * FAR * png_row_infopp; * expected to return the read data in the buffer. */ typedef struct png_struct_def png_struct; -typedef PNG_CONST png_struct FAR * const_png_structp; +typedef PNG_CONST png_struct FAR * png_const_structp; typedef png_struct FAR * png_structp; typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp), ); @@ -947,7 +947,7 @@ PNG_EXPORTA(5, png_structp, png_create_write_struct, PNG_ALLOCATED); PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structp png_ptr, png_size_t size)); @@ -1074,7 +1074,7 @@ PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structp png_ptr, PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structp png_ptr, int error_action, png_fixed_point red, png_fixed_point green)); -PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (const_png_structp +PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp png_ptr)); #endif @@ -1412,7 +1412,7 @@ PNG_EXPORT(75, void, png_set_error_fn, png_error_ptr error_fn, png_error_ptr warning_fn)); /* Return the user pointer associated with the error functions */ -PNG_EXPORT(76, png_voidp, png_get_error_ptr, (const_png_structp png_ptr)); +PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structp png_ptr)); /* Replace the default data output functions with a user supplied one(s). * If buffered output is not used, then output_flush_fn can be set to NULL. @@ -1445,7 +1445,7 @@ PNG_EXPORT(81, void, png_set_write_status_fn, (png_structp png_ptr, PNG_EXPORT(82, void, png_set_mem_fn, (png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); /* Return the user pointer associated with the memory functions */ -PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (const_png_structp png_ptr)); +PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structp png_ptr)); #endif #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED @@ -1458,20 +1458,31 @@ PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structp png_ptr, png_user_transform_ptr write_user_transform_fn)); #endif -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED PNG_EXPORT(86, void, png_set_user_transform_info, (png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels)); /* Return the user pointer associated with the user transform functions */ PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); +#endif + +#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED +/* Return information about the row currently being processed. Note that these + * APIs do not fail but will return unexpected results if called outside a user + * transform callback. Also note that when transforming an interlaced image the + * row number is still the row in the final, de-interlaced, image but the row + * only contains the data of the current pass - consult png_row_info for the + * actual width of the row! + */ +PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structp)); +PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structp)); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); -PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (const_png_structp png_ptr)); +PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structp png_ptr)); #endif #ifdef PNG_PROGRESSIVE_READ_SUPPORTED @@ -1483,13 +1494,30 @@ PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structp png_ptr, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); /* Returns the user pointer associated with the push read functions */ -PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (const_png_structp png_ptr)); +PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (png_const_structp png_ptr)); /* Function to be called when data becomes available */ PNG_EXPORT(92, void, png_process_data, (png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); +/* A function which may be called *only* within png_process_data to stop the + * processing of any more data. The function returns the number of bytes + * remaining, excluding any that libpng has cached internally. A subsequent + * call to png_process_data must supply these bytes again. If the argument + * 'save' is set to true the routine will first save all the pending data and + * will always return 0. + */ +PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structp, int save)); + +/* A function which may be called *only* outside (after) a call to + * png_process_data. It returns the number of bytes of data to skip in the + * input. Normally it will return 0, but if it returns a non-zero value the + * application must skip than number of bytes of input data and pass the + * following data to the next call to png_process_data. + */ +PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structp)); + /* Function that combines rows. 'new_row' is a flag that should come from * the callback and be non-NULL if anything needs to be done; the library * stores its own version of the new data internally and ignores the passed @@ -1609,19 +1637,19 @@ PNG_EXPORT(109, void, png_set_benign_errors, */ /* Returns "flag" if chunk data is valid in info_ptr. */ PNG_EXPORT(110, png_uint_32, png_get_valid, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 flag)); /* Returns number of bytes needed to hold a transformed row. */ -PNG_EXPORT(111, png_size_t, png_get_rowbytes, (const_png_structp png_ptr, - const_png_infop info_ptr)); +PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structp png_ptr, + png_const_infop info_ptr)); #ifdef PNG_INFO_IMAGE_SUPPORTED /* Returns row_pointers, which is an array of pointers to scanlines that was * returned from png_read_png(). */ PNG_EXPORT(112, png_bytepp, png_get_rows, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); /* Set row_pointers, which is an array of pointers to scanlines for use * by png_write_png(). */ @@ -1631,70 +1659,70 @@ PNG_EXPORT(113, void, png_set_rows, (png_structp png_ptr, /* Returns number of color channels in image. */ PNG_EXPORT(114, png_byte, png_get_channels, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); #ifdef PNG_EASY_ACCESS_SUPPORTED /* Returns image width in pixels. */ -PNG_EXPORT(115, png_uint_32, png_get_image_width, (const_png_structp png_ptr, - const_png_infop info_ptr)); +PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image height in pixels. */ -PNG_EXPORT(116, png_uint_32, png_get_image_height, (const_png_structp png_ptr, - const_png_infop info_ptr)); +PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image bit_depth. */ PNG_EXPORT(117, png_byte, png_get_bit_depth, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image color_type. */ -PNG_EXPORT(118, png_byte, png_get_color_type, (const_png_structp png_ptr, - const_png_infop info_ptr)); +PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image filter_type. */ -PNG_EXPORT(119, png_byte, png_get_filter_type, (const_png_structp png_ptr, - const_png_infop info_ptr)); +PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image interlace_type. */ -PNG_EXPORT(120, png_byte, png_get_interlace_type, (const_png_structp png_ptr, - const_png_infop info_ptr)); +PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image compression_type. */ -PNG_EXPORT(121, png_byte, png_get_compression_type, (const_png_structp png_ptr, - const_png_infop info_ptr)); +PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image resolution in pixels per meter, from pHYs chunk data. */ PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns pixel aspect ratio, computed from pHYs chunk data. */ PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); #endif /* PNG_EASY_ACCESS_SUPPORTED */ /* Returns pointer to signature string read from PNG header */ PNG_EXPORT(130, png_const_bytep, png_get_signature, - (const_png_structp png_ptr, png_infop info_ptr)); + (png_const_structp png_ptr, png_infop info_ptr)); #ifdef PNG_bKGD_SUPPORTED PNG_EXPORT(131, png_uint_32, png_get_bKGD, - (const_png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_infop info_ptr, png_color_16p *background)); #endif @@ -1704,14 +1732,14 @@ PNG_EXPORT(132, void, png_set_bKGD, (png_structp png_ptr, png_infop info_ptr, #endif #ifdef PNG_cHRM_SUPPORTED -PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (const_png_structp png_ptr, - const_png_infop info_ptr, double *white_x, double *white_y, double *red_x, +PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structp png_ptr, + png_const_infop info_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)); #ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */ PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, - (const_png_structp png_ptr, - const_png_infop info_ptr, png_fixed_point *int_white_x, + (png_const_structp png_ptr, + png_const_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, @@ -1734,10 +1762,10 @@ PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_structp png_ptr, #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, double *file_gamma)); PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_fixed_point *int_file_gamma)); #endif @@ -1750,7 +1778,7 @@ PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_structp png_ptr, #ifdef PNG_hIST_SUPPORTED PNG_EXPORT(141, png_uint_32, png_get_hIST, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_16p *hist)); #endif @@ -1771,7 +1799,7 @@ PNG_EXPORT(144, void, png_set_IHDR, #ifdef PNG_oFFs_SUPPORTED PNG_EXPORT(145, png_uint_32, png_get_oFFs, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)); #endif @@ -1783,7 +1811,7 @@ PNG_EXPORT(146, void, png_set_oFFs, #ifdef PNG_pCAL_SUPPORTED PNG_EXPORT(147, png_uint_32, png_get_pCAL, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params)); @@ -1798,7 +1826,7 @@ PNG_EXPORT(148, void, png_set_pCAL, (png_structp png_ptr, #ifdef PNG_pHYs_SUPPORTED PNG_EXPORT(149, png_uint_32, png_get_pHYs, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); #endif @@ -1809,7 +1837,7 @@ PNG_EXPORT(150, void, png_set_pHYs, #endif PNG_EXPORT(151, png_uint_32, png_get_PLTE, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_colorp *palette, int *num_palette)); PNG_EXPORT(152, void, png_set_PLTE, @@ -1818,7 +1846,7 @@ PNG_EXPORT(152, void, png_set_PLTE, #ifdef PNG_sBIT_SUPPORTED PNG_EXPORT(153, png_uint_32, png_get_sBIT, - (const_png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)); #endif @@ -1828,8 +1856,8 @@ PNG_EXPORT(154, void, png_set_sBIT, #endif #ifdef PNG_sRGB_SUPPORTED -PNG_EXPORT(155, png_uint_32, png_get_sRGB, (const_png_structp png_ptr, - const_png_infop info_ptr, int *intent)); +PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structp png_ptr, + png_const_infop info_ptr, int *intent)); #endif #ifdef PNG_sRGB_SUPPORTED @@ -1841,7 +1869,7 @@ PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_structp png_ptr, #ifdef PNG_iCCP_SUPPORTED PNG_EXPORT(158, png_uint_32, png_get_iCCP, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_charpp name, int *compression_type, png_bytepp profile, png_uint_32 *proflen)); #endif @@ -1855,7 +1883,7 @@ PNG_EXPORT(159, void, png_set_iCCP, #ifdef PNG_sPLT_SUPPORTED PNG_EXPORT(160, png_uint_32, png_get_sPLT, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_sPLT_tpp entries)); #endif @@ -1868,7 +1896,7 @@ PNG_EXPORT(161, void, png_set_sPLT, #ifdef PNG_TEXT_SUPPORTED /* png_get_text also returns the number of text chunks in *num_text */ PNG_EXPORT(162, png_uint_32, png_get_text, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_textp *text_ptr, int *num_text)); #endif @@ -1887,7 +1915,7 @@ PNG_EXPORT(163, void, png_set_text, #ifdef PNG_tIME_SUPPORTED PNG_EXPORT(164, png_uint_32, png_get_tIME, - (const_png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)); + (png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time)); #endif #ifdef PNG_tIME_SUPPORTED @@ -1897,7 +1925,7 @@ PNG_EXPORT(165, void, png_set_tIME, #ifdef PNG_tRNS_SUPPORTED PNG_EXPORT(166, png_uint_32, png_get_tRNS, - (const_png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)); #endif @@ -1910,7 +1938,7 @@ PNG_EXPORT(167, void, png_set_tRNS, #ifdef PNG_sCAL_SUPPORTED PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, int *unit, double *width, double *height)); #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* NOTE: this API is currently implemented using floating point arithmetic, @@ -1919,12 +1947,12 @@ PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, * is highly recommended that png_get_sCAL_s be used instead. */ PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, - (png_structp png_ptr, const_png_infop info_ptr, int *unit, + (png_structp png_ptr, png_const_infop info_ptr, int *unit, png_fixed_point *width, png_fixed_point *height)); #endif PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, - (const_png_structp png_ptr, const_png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); PNG_FP_EXPORT(170, void, png_set_sCAL, @@ -1960,8 +1988,8 @@ PNG_EXPORT(174, void, png_set_unknown_chunks, (png_structp png_ptr, int num_unknowns)); PNG_EXPORT(175, void, png_set_unknown_chunk_location, (png_structp png_ptr, png_infop info_ptr, int chunk, int location)); -PNG_EXPORT(176, int, png_get_unknown_chunks, (const_png_structp png_ptr, - const_png_infop info_ptr, png_unknown_chunkpp entries)); +PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structp png_ptr, + png_const_infop info_ptr, png_unknown_chunkpp entries)); #endif /* Png_free_data() will turn off the "valid" flag for anything it frees. @@ -1980,13 +2008,13 @@ PNG_EXPORT(179, void, png_write_png, (png_structp png_ptr, png_infop info_ptr, #endif PNG_EXPORT(180, png_const_charp, png_get_copyright, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); PNG_EXPORT(181, png_const_charp, png_get_header_ver, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); PNG_EXPORT(182, png_const_charp, png_get_header_version, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); PNG_EXPORT(183, png_const_charp, png_get_libpng_ver, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); #ifdef PNG_MNG_FEATURES_SUPPORTED PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structp png_ptr, @@ -2013,48 +2041,48 @@ PNG_EXPORT(185, void, png_set_strip_error_numbers, PNG_EXPORT(186, void, png_set_user_limits, (png_structp png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); PNG_EXPORT(187, png_uint_32, png_get_user_width_max, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); PNG_EXPORT(188, png_uint_32, png_get_user_height_max, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); /* Added in libpng-1.4.0 */ PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structp png_ptr, png_uint_32 user_chunk_cache_max)); PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); /* Added in libpng-1.4.1 */ PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structp png_ptr, png_alloc_size_t user_chunk_cache_max)); PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); #endif #if defined(PNG_INCH_CONVERSIONS_SUPPORTED) PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_FP_EXPORT(196, float, png_get_x_offset_inches, - (const_png_structp png_ptr, const_png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, - (png_structp png_ptr, const_png_infop info_ptr)); + (png_structp png_ptr, png_const_infop info_ptr)); #endif -PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (const_png_structp png_ptr, - const_png_infop info_ptr)); +PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structp png_ptr, + png_const_infop info_ptr)); #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, - (png_structp png_ptr, const_png_infop info_ptr)); + (png_structp png_ptr, png_const_infop info_ptr)); #endif # ifdef PNG_pHYs_SUPPORTED -PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (const_png_structp png_ptr, - const_png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, +PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structp png_ptr, + png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); # endif /* PNG_pHYs_SUPPORTED */ #endif /* PNG_INCH_CONVERSIONS_SUPPORTED */ @@ -2066,7 +2094,7 @@ PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_structp png_ptr)); PNG_EXPORTA(200, png_const_bytep, png_get_io_chunk_name, (png_structp png_ptr), PNG_DEPRECATED); PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, - (const_png_structp png_ptr)); + (png_const_structp png_ptr)); /* The flags returned by png_get_io_state() are the following: */ # define PNG_IO_NONE 0x0000 /* no I/O at this moment */ @@ -2236,7 +2264,7 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); * scripts/symbols.def as well. */ #ifdef PNG_EXPORT_LAST_ORDINAL - PNG_EXPORT_LAST_ORDINAL(216); + PNG_EXPORT_LAST_ORDINAL(220); #endif #ifdef __cplusplus diff --git a/pngerror.c b/pngerror.c index 5fa576965..b4b3739c3 100644 --- a/pngerror.c +++ b/pngerror.c @@ -423,7 +423,7 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, * pointer before png_write_destroy and png_read_destroy are called. */ png_voidp PNGAPI -png_get_error_ptr(const_png_structp png_ptr) +png_get_error_ptr(png_const_structp png_ptr) { if (png_ptr == NULL) return NULL; diff --git a/pngget.c b/pngget.c index 638f6742b..2af90f9c7 100644 --- a/pngget.c +++ b/pngget.c @@ -17,7 +17,7 @@ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) png_uint_32 PNGAPI -png_get_valid(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_valid(png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 flag) { if (png_ptr != NULL && info_ptr != NULL) @@ -27,7 +27,7 @@ png_get_valid(const_png_structp png_ptr, const_png_infop info_ptr, } png_size_t PNGAPI -png_get_rowbytes(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_rowbytes(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->rowbytes); @@ -37,7 +37,7 @@ png_get_rowbytes(const_png_structp png_ptr, const_png_infop info_ptr) #ifdef PNG_INFO_IMAGE_SUPPORTED png_bytepp PNGAPI -png_get_rows(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_rows(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->row_pointers); @@ -49,7 +49,7 @@ png_get_rows(const_png_structp png_ptr, const_png_infop info_ptr) #ifdef PNG_EASY_ACCESS_SUPPORTED /* Easy access to info, added in libpng-0.99 */ png_uint_32 PNGAPI -png_get_image_width(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_image_width(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->width; @@ -58,7 +58,7 @@ png_get_image_width(const_png_structp png_ptr, const_png_infop info_ptr) } png_uint_32 PNGAPI -png_get_image_height(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_image_height(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->height; @@ -67,7 +67,7 @@ png_get_image_height(const_png_structp png_ptr, const_png_infop info_ptr) } png_byte PNGAPI -png_get_bit_depth(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_bit_depth(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->bit_depth; @@ -76,7 +76,7 @@ png_get_bit_depth(const_png_structp png_ptr, const_png_infop info_ptr) } png_byte PNGAPI -png_get_color_type(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_color_type(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->color_type; @@ -85,7 +85,7 @@ png_get_color_type(const_png_structp png_ptr, const_png_infop info_ptr) } png_byte PNGAPI -png_get_filter_type(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_filter_type(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->filter_type; @@ -94,7 +94,7 @@ png_get_filter_type(const_png_structp png_ptr, const_png_infop info_ptr) } png_byte PNGAPI -png_get_interlace_type(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_interlace_type(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->interlace_type; @@ -103,7 +103,7 @@ png_get_interlace_type(const_png_structp png_ptr, const_png_infop info_ptr) } png_byte PNGAPI -png_get_compression_type(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_compression_type(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->compression_type; @@ -112,7 +112,7 @@ png_get_compression_type(const_png_structp png_ptr, const_png_infop info_ptr) } png_uint_32 PNGAPI -png_get_x_pixels_per_meter(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_x_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) @@ -129,7 +129,7 @@ png_get_x_pixels_per_meter(const_png_structp png_ptr, const_png_infop info_ptr) } png_uint_32 PNGAPI -png_get_y_pixels_per_meter(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_y_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) @@ -146,7 +146,7 @@ png_get_y_pixels_per_meter(const_png_structp png_ptr, const_png_infop info_ptr) } png_uint_32 PNGAPI -png_get_pixels_per_meter(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) @@ -164,7 +164,7 @@ png_get_pixels_per_meter(const_png_structp png_ptr, const_png_infop info_ptr) #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI -png_get_pixel_aspect_ratio(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_pixel_aspect_ratio(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_READ_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) @@ -183,8 +183,8 @@ png_get_pixel_aspect_ratio(const_png_structp png_ptr, const_png_infop info_ptr) #ifdef PNG_FIXED_POINT_SUPPORTED png_fixed_point PNGAPI -png_get_pixel_aspect_ratio_fixed(const_png_structp png_ptr, - const_png_infop info_ptr) +png_get_pixel_aspect_ratio_fixed(png_const_structp png_ptr, + png_const_infop info_ptr) { #ifdef PNG_READ_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) @@ -210,7 +210,7 @@ png_get_pixel_aspect_ratio_fixed(const_png_structp png_ptr, #endif png_int_32 PNGAPI -png_get_x_offset_microns(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_x_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_oFFs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) @@ -226,7 +226,7 @@ png_get_x_offset_microns(const_png_structp png_ptr, const_png_infop info_ptr) } png_int_32 PNGAPI -png_get_y_offset_microns(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_y_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_oFFs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) @@ -242,7 +242,7 @@ png_get_y_offset_microns(const_png_structp png_ptr, const_png_infop info_ptr) } png_int_32 PNGAPI -png_get_x_offset_pixels(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_x_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_oFFs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) @@ -258,7 +258,7 @@ png_get_x_offset_pixels(const_png_structp png_ptr, const_png_infop info_ptr) } png_int_32 PNGAPI -png_get_y_offset_pixels(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_y_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_oFFs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) @@ -307,19 +307,19 @@ ppi_from_ppm(png_uint_32 ppm) } png_uint_32 PNGAPI -png_get_pixels_per_inch(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) { return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr)); } png_uint_32 PNGAPI -png_get_x_pixels_per_inch(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_x_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) { return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr)); } png_uint_32 PNGAPI -png_get_y_pixels_per_inch(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_y_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) { return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr)); } @@ -338,7 +338,7 @@ png_fixed_inches_from_microns(png_structp png_ptr, png_int_32 microns) png_fixed_point PNGAPI png_get_x_offset_inches_fixed(png_structp png_ptr, - const_png_infop info_ptr) + png_const_infop info_ptr) { return png_fixed_inches_from_microns(png_ptr, png_get_x_offset_microns(png_ptr, info_ptr)); @@ -348,7 +348,7 @@ png_get_x_offset_inches_fixed(png_structp png_ptr, #ifdef PNG_FIXED_POINT_SUPPORTED png_fixed_point PNGAPI png_get_y_offset_inches_fixed(png_structp png_ptr, - const_png_infop info_ptr) + png_const_infop info_ptr) { return png_fixed_inches_from_microns(png_ptr, png_get_y_offset_microns(png_ptr, info_ptr)); @@ -357,7 +357,7 @@ png_get_y_offset_inches_fixed(png_structp png_ptr, #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI -png_get_x_offset_inches(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_x_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr) { /* To avoid the overflow do the conversion directly in floating * point. @@ -368,7 +368,7 @@ png_get_x_offset_inches(const_png_structp png_ptr, const_png_infop info_ptr) #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI -png_get_y_offset_inches(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_y_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr) { /* To avoid the overflow do the conversion directly in floating * point. @@ -379,7 +379,7 @@ png_get_y_offset_inches(const_png_structp png_ptr, const_png_infop info_ptr) #ifdef PNG_pHYs_SUPPORTED png_uint_32 PNGAPI -png_get_pHYs_dpi(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_pHYs_dpi(png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) { png_uint_32 retval = 0; @@ -423,7 +423,7 @@ png_get_pHYs_dpi(const_png_structp png_ptr, const_png_infop info_ptr, #endif /* PNG_EASY_ACCESS_SUPPORTED */ png_byte PNGAPI -png_get_channels(const_png_structp png_ptr, const_png_infop info_ptr) +png_get_channels(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->channels); @@ -432,7 +432,7 @@ png_get_channels(const_png_structp png_ptr, const_png_infop info_ptr) } png_const_bytep PNGAPI -png_get_signature(const_png_structp png_ptr, png_infop info_ptr) +png_get_signature(png_const_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->signature); @@ -442,7 +442,7 @@ png_get_signature(const_png_structp png_ptr, png_infop info_ptr) #ifdef PNG_bKGD_SUPPORTED png_uint_32 PNGAPI -png_get_bKGD(const_png_structp png_ptr, png_infop info_ptr, +png_get_bKGD(png_const_structp png_ptr, png_infop info_ptr, png_color_16p *background) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) @@ -461,7 +461,7 @@ png_get_bKGD(const_png_structp png_ptr, png_infop info_ptr, #ifdef PNG_cHRM_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_cHRM(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_cHRM(png_const_structp png_ptr, png_const_infop info_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) { @@ -494,7 +494,7 @@ png_get_cHRM(const_png_structp png_ptr, const_png_infop info_ptr, # ifdef PNG_FIXED_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_cHRM_fixed(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_cHRM_fixed(png_const_structp png_ptr, png_const_infop info_ptr, png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x, png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, png_fixed_point *blue_x, png_fixed_point *blue_y) @@ -529,7 +529,7 @@ png_get_cHRM_fixed(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_gAMA_SUPPORTED png_uint_32 PNGFAPI -png_get_gAMA_fixed(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_gAMA_fixed(png_const_structp png_ptr, png_const_infop info_ptr, png_fixed_point *file_gamma) { png_debug1(1, "in %s retrieval function", "gAMA"); @@ -545,7 +545,7 @@ png_get_gAMA_fixed(const_png_structp png_ptr, const_png_infop info_ptr, } # ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_gAMA(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_gAMA(png_const_structp png_ptr, png_const_infop info_ptr, double *file_gamma) { png_fixed_point igamma; @@ -562,7 +562,7 @@ png_get_gAMA(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_sRGB_SUPPORTED png_uint_32 PNGAPI -png_get_sRGB(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_sRGB(png_const_structp png_ptr, png_const_infop info_ptr, int *file_srgb_intent) { png_debug1(1, "in %s retrieval function", "sRGB"); @@ -580,7 +580,7 @@ png_get_sRGB(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_iCCP_SUPPORTED png_uint_32 PNGAPI -png_get_iCCP(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_iCCP(png_const_structp png_ptr, png_const_infop info_ptr, png_charpp name, int *compression_type, png_bytepp profile, png_uint_32 *proflen) { @@ -605,7 +605,7 @@ png_get_iCCP(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_sPLT_SUPPORTED png_uint_32 PNGAPI -png_get_sPLT(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_sPLT(png_const_structp png_ptr, png_const_infop info_ptr, png_sPLT_tpp spalettes) { if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) @@ -620,7 +620,7 @@ png_get_sPLT(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_hIST_SUPPORTED png_uint_32 PNGAPI -png_get_hIST(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_hIST(png_const_structp png_ptr, png_const_infop info_ptr, png_uint_16p *hist) { png_debug1(1, "in %s retrieval function", "hIST"); @@ -677,7 +677,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr, #ifdef PNG_oFFs_SUPPORTED png_uint_32 PNGAPI -png_get_oFFs(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_oFFs(png_const_structp png_ptr, png_const_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) { png_debug1(1, "in %s retrieval function", "oFFs"); @@ -697,7 +697,7 @@ png_get_oFFs(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_pCAL_SUPPORTED png_uint_32 PNGAPI -png_get_pCAL(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_pCAL(png_const_structp png_ptr, png_const_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params) { @@ -725,7 +725,7 @@ png_get_pCAL(const_png_structp png_ptr, const_png_infop info_ptr, # ifdef PNG_FIXED_POINT_SUPPORTED # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED png_uint_32 PNGAPI -png_get_sCAL_fixed(png_structp png_ptr, const_png_infop info_ptr, +png_get_sCAL_fixed(png_structp png_ptr, png_const_infop info_ptr, int *unit, png_fixed_point *width, png_fixed_point *height) { if (png_ptr != NULL && info_ptr != NULL && @@ -745,7 +745,7 @@ png_get_sCAL_fixed(png_structp png_ptr, const_png_infop info_ptr, # endif /* FIXED_POINT */ # ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_sCAL(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_sCAL(png_const_structp png_ptr, png_const_infop info_ptr, int *unit, double *width, double *height) { if (png_ptr != NULL && info_ptr != NULL && @@ -761,7 +761,7 @@ png_get_sCAL(const_png_structp png_ptr, const_png_infop info_ptr, } # endif /* FLOATING POINT */ png_uint_32 PNGAPI -png_get_sCAL_s(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_sCAL_s(png_const_structp png_ptr, png_const_infop info_ptr, int *unit, png_charpp width, png_charpp height) { if (png_ptr != NULL && info_ptr != NULL && @@ -779,7 +779,7 @@ png_get_sCAL_s(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_pHYs_SUPPORTED png_uint_32 PNGAPI -png_get_pHYs(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_pHYs(png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) { png_uint_32 retval = 0; @@ -813,7 +813,7 @@ png_get_pHYs(const_png_structp png_ptr, const_png_infop info_ptr, #endif /* pHYs */ png_uint_32 PNGAPI -png_get_PLTE(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_PLTE(png_const_structp png_ptr, png_const_infop info_ptr, png_colorp *palette, int *num_palette) { png_debug1(1, "in %s retrieval function", "PLTE"); @@ -832,7 +832,7 @@ png_get_PLTE(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_sBIT_SUPPORTED png_uint_32 PNGAPI -png_get_sBIT(const_png_structp png_ptr, png_infop info_ptr, +png_get_sBIT(png_const_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) { png_debug1(1, "in %s retrieval function", "sBIT"); @@ -850,7 +850,7 @@ png_get_sBIT(const_png_structp png_ptr, png_infop info_ptr, #ifdef PNG_TEXT_SUPPORTED png_uint_32 PNGAPI -png_get_text(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_text(png_const_structp png_ptr, png_const_infop info_ptr, png_textp *text_ptr, int *num_text) { if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) @@ -877,7 +877,7 @@ png_get_text(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_tIME_SUPPORTED png_uint_32 PNGAPI -png_get_tIME(const_png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) +png_get_tIME(png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time) { png_debug1(1, "in %s retrieval function", "tIME"); @@ -894,7 +894,7 @@ png_get_tIME(const_png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) #ifdef PNG_tRNS_SUPPORTED png_uint_32 PNGAPI -png_get_tRNS(const_png_structp png_ptr, png_infop info_ptr, +png_get_tRNS(png_const_structp png_ptr, png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color) { png_uint_32 retval = 0; @@ -939,7 +939,7 @@ png_get_tRNS(const_png_structp png_ptr, png_infop info_ptr, #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED int PNGAPI -png_get_unknown_chunks(const_png_structp png_ptr, const_png_infop info_ptr, +png_get_unknown_chunks(png_const_structp png_ptr, png_const_infop info_ptr, png_unknown_chunkpp unknowns) { if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) @@ -954,7 +954,7 @@ png_get_unknown_chunks(const_png_structp png_ptr, const_png_infop info_ptr, #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED png_byte PNGAPI -png_get_rgb_to_gray_status (const_png_structp png_ptr) +png_get_rgb_to_gray_status (png_const_structp png_ptr) { return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0); } @@ -962,14 +962,14 @@ png_get_rgb_to_gray_status (const_png_structp png_ptr) #ifdef PNG_USER_CHUNKS_SUPPORTED png_voidp PNGAPI -png_get_user_chunk_ptr(const_png_structp png_ptr) +png_get_user_chunk_ptr(png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_chunk_ptr : NULL); } #endif png_size_t PNGAPI -png_get_compression_buffer_size(const_png_structp png_ptr) +png_get_compression_buffer_size(png_const_structp png_ptr) { return (png_ptr ? png_ptr->zbuf_size : 0L); } @@ -979,27 +979,27 @@ png_get_compression_buffer_size(const_png_structp png_ptr) /* These functions were added to libpng 1.2.6 and were enabled * by default in libpng-1.4.0 */ png_uint_32 PNGAPI -png_get_user_width_max (const_png_structp png_ptr) +png_get_user_width_max (png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_width_max : 0); } png_uint_32 PNGAPI -png_get_user_height_max (const_png_structp png_ptr) +png_get_user_height_max (png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_height_max : 0); } /* This function was added to libpng 1.4.0 */ png_uint_32 PNGAPI -png_get_chunk_cache_max (const_png_structp png_ptr) +png_get_chunk_cache_max (png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_chunk_cache_max : 0); } /* This function was added to libpng 1.4.1 */ png_alloc_size_t PNGAPI -png_get_chunk_malloc_max (const_png_structp png_ptr) +png_get_chunk_malloc_max (png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_chunk_malloc_max : 0); } @@ -1014,7 +1014,7 @@ png_get_io_state (png_structp png_ptr) } png_uint_32 PNGAPI -png_get_io_chunk_type (const_png_structp png_ptr) +png_get_io_chunk_type (png_const_structp png_ptr) { return ((png_ptr->chunk_name[0] << 24) + (png_ptr->chunk_name[1] << 16) + diff --git a/pngmem.c b/pngmem.c index f9fd35fe8..83e24251a 100644 --- a/pngmem.c +++ b/pngmem.c @@ -647,7 +647,7 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr * pointer before png_write_destroy and png_read_destroy are called. */ png_voidp PNGAPI -png_get_mem_ptr(const_png_structp png_ptr) +png_get_mem_ptr(png_const_structp png_ptr) { if (png_ptr == NULL) return (NULL); diff --git a/pngpread.c b/pngpread.c index 1ff8b5d12..99f456100 100644 --- a/pngpread.c +++ b/pngpread.c @@ -41,6 +41,64 @@ png_process_data(png_structp png_ptr, png_infop info_ptr, } } +png_size_t PNGAPI +png_process_data_pause(png_structp png_ptr, int save) +{ + if (png_ptr != NULL) + { + /* It's easiest for the caller if we do the save, then the caller doesn't + * have to supply the same data again: + */ + if (save) + png_push_save_buffer(png_ptr); + else + { + /* This includes any pending saved bytes: */ + png_size_t remaining = png_ptr->buffer_size; + png_ptr->buffer_size = 0; + + /* So subtract the saved buffer size, unless all the data + * is actually 'saved', in which case we just return 0 + */ + if (png_ptr->save_buffer_size < remaining) + return remaining - png_ptr->save_buffer_size; + } + } + + return 0; +} + +png_uint_32 PNGAPI +png_process_data_skip(png_structp png_ptr) +{ + png_size_t remaining = 0; + + if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE && + png_ptr->skip_length > 0) + { + /* At the end of png_process_data the buffer size must be 0 (see the loop + * above) so we can detect a broken call here: + */ + if (png_ptr->buffer_size != 0) + png_error(png_ptr, + "png_process_data_skip called inside png_process_data"); + + /* If is impossible for there to be a saved buffer at this point - + * otherwise we could not be in SKIP mode. This will also happen if + * png_process_skip is called inside png_process_data (but only very + * rarely.) + */ + if (png_ptr->save_buffer_size != 0) + png_error(png_ptr, "png_process_data_skip called with saved data"); + + remaining = png_ptr->skip_length; + png_ptr->skip_length = 0; + png_ptr->process_mode = PNG_READ_CHUNK_MODE; + } + + return remaining; +} + /* What we do with the incoming data depends on what we were previously * doing before we ran out of data... */ @@ -1786,7 +1844,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, } png_voidp PNGAPI -png_get_progressive_ptr(const_png_structp png_ptr) +png_get_progressive_ptr(png_const_structp png_ptr) { if (png_ptr == NULL) return (NULL); diff --git a/pngtrans.c b/pngtrans.c index 1662af739..4515ea668 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -672,6 +672,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row) #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED void PNGAPI png_set_user_transform_info(png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels) @@ -680,33 +681,42 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp if (png_ptr == NULL) return; -#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED png_ptr->user_transform_ptr = user_transform_ptr; png_ptr->user_transform_depth = (png_byte)user_transform_depth; png_ptr->user_transform_channels = (png_byte)user_transform_channels; -#else - if (user_transform_ptr || user_transform_depth || user_transform_channels) - png_warning(png_ptr, - "This version of libpng does not support user transform info"); -#endif } +#endif /* This function returns a pointer to the user_transform_ptr associated with * the user transform functions. The application should free any memory * associated with this pointer before png_write_destroy and png_read_destroy * are called. */ +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED png_voidp PNGAPI -png_get_user_transform_ptr(const_png_structp png_ptr) +png_get_user_transform_ptr(png_const_structp png_ptr) { if (png_ptr == NULL) return (NULL); -#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED return ((png_voidp)png_ptr->user_transform_ptr); -#else - return (NULL); +} #endif + +png_uint_32 PNGAPI +png_get_current_row_number(png_const_structp png_ptr) +{ + if (png_ptr != NULL) + return png_ptr->row_number; + return PNG_UINT_32_MAX; /* help the app not to fail silently */ +} + +png_byte PNGAPI +png_get_current_pass_number(png_const_structp png_ptr) +{ + if (png_ptr != NULL) + return png_ptr->pass; + return 8; /* invalid */ } #endif /* PNG_READ_USER_TRANSFORM_SUPPORTED || PNG_WRITE_USER_TRANSFORM_SUPPORTED */ diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index 1fe4e0c0d..9fe0d6030 100644 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -380,8 +380,10 @@ option WRITE_WEIGHTED_FILTER requires WRITE option WRITE_FLUSH requires WRITE -# Note: this can be turned off explicitly, is this correct? +# Note: these can be turned off explicitly if not required by the +# apps implementing the user transforms option USER_TRANSFORM_PTR if READ_USER_TRANSFORM WRITE_USER_TRANSFORM +option USER_TRANSFORM_INFO if READ_USER_TRANSFORM WRITE_USER_TRANSFORM # Any chunks you are not interested in, you can undef here. The # ones that allocate memory may be expecially important (hIST, diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt index b09149a46..b1d216910 100644 --- a/scripts/pnglibconf.h.prebuilt +++ b/scripts/pnglibconf.h.prebuilt @@ -155,6 +155,7 @@ #define PNG_WRITE_iTXt_SUPPORTED #define PNG_oFFs_SUPPORTED #define PNG_USER_TRANSFORM_PTR_SUPPORTED +#define PNG_USER_TRANSFORM_INFO_SUPPORTED #define PNG_hIST_SUPPORTED #define PNG_iCCP_SUPPORTED #define PNG_sRGB_SUPPORTED diff --git a/scripts/symbols.def b/scripts/symbols.def index 0868d3f09..e793017e7 100644 --- a/scripts/symbols.def +++ b/scripts/symbols.def @@ -222,3 +222,7 @@ EXPORTS png_get_sCAL_fixed @214 png_set_background_fixed @215 png_get_io_chunk_type @216 + png_get_current_row_number @217 + png_get_current_pass_number @218 + png_process_data_pause @219 + png_process_data_skip @220