18 #define PNG_NO_PEDANTIC_WARNINGS 20 #ifdef PNG_READ_SUPPORTED 28 #ifdef PNG_USER_MEM_SUPPORTED 43 #ifdef PNG_SETJMP_SUPPORTED 48 #ifdef PNG_SETJMP_SUPPORTED 49 #ifdef USE_FAR_KEYWORD 56 png_debug(1,
"in png_create_read_struct");
58 #ifdef PNG_USER_MEM_SUPPORTED 68 #ifdef PNG_USER_LIMITS_SUPPORTED 75 #ifdef PNG_SETJMP_SUPPORTED 76 #ifdef USE_FAR_KEYWORD 79 if (setjmp(png_ptr->jmpbuf))
84 #ifdef PNG_USER_MEM_SUPPORTED 86 (png_free_ptr)free_fn, (
png_voidp)mem_ptr);
92 #ifdef USE_FAR_KEYWORD 97 #ifdef PNG_USER_MEM_SUPPORTED 103 if (user_png_ver !=
NULL)
112 png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
113 if (user_png_ver[i] ==
'.')
115 }
while (found_dots < 2 && user_png_ver[i] != 0 &&
119 png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
122 if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
130 (user_png_ver[0] ==
'1' && user_png_ver[2] !=
png_libpng_ver[2]) ||
131 (user_png_ver[0] ==
'0' && user_png_ver[2] <
'9'))
133 #if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE) 138 "Application was compiled with png.h from libpng-%.20s",
143 "Application is running with png.c from libpng-%.20s",
147 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 151 "Incompatible libpng version in application and library");
161 png_ptr->zstream.opaque = (
voidpf)png_ptr;
171 default:
png_error(png_ptr,
"Unknown zlib error");
175 png_ptr->zstream.next_out = png_ptr->zbuf;
176 png_ptr->zstream.avail_out = (
uInt)png_ptr->zbuf_size;
180 #ifdef PNG_SETJMP_SUPPORTED 184 #ifdef USE_FAR_KEYWORD 189 if (setjmp(png_ptr->jmpbuf))
197 #if defined(PNG_1_0_X) || defined(PNG_1_2_X) 217 #if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE) 222 png_ptr->warning_fn =
NULL;
226 "Application was compiled with png.h from libpng-%.20s",
231 "Application is running with png.c from libpng-%.20s",
238 png_ptr->error_fn =
NULL;
239 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 243 "The png struct allocated by the application for reading is" 248 png_ptr->error_fn =
NULL;
249 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 253 "The info struct allocated by application for reading is" 264 #ifdef PNG_SETJMP_SUPPORTED 279 #ifdef PNG_LEGACY_SUPPORTED 280 png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
282 png_ptr->warning_fn =
NULL;
284 "Application uses deprecated png_read_init() and should be" 293 #ifdef PNG_SETJMP_SUPPORTED 308 #ifdef PNG_SETJMP_SUPPORTED 314 #ifdef PNG_SET_USER_LIMITS_SUPPORTED 326 png_ptr->zstream.opaque = (
voidpf)png_ptr;
334 default:
png_error(png_ptr,
"Unknown zlib error");
337 png_ptr->zstream.next_out = png_ptr->zbuf;
338 png_ptr->zstream.avail_out = (
uInt)png_ptr->zbuf_size;
343 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED 357 if (png_ptr ==
NULL || info_ptr ==
NULL)
361 if (png_ptr->sig_bytes < 8)
367 png_ptr->sig_bytes = 8;
371 if (num_checked < 4 &&
375 png_error(png_ptr,
"PNG file corrupted by ASCII conversion");
378 png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
383 #ifdef PNG_USE_LOCAL_ARRAYS 388 #ifdef PNG_READ_bKGD_SUPPORTED 391 #ifdef PNG_READ_cHRM_SUPPORTED 394 #ifdef PNG_READ_gAMA_SUPPORTED 397 #ifdef PNG_READ_hIST_SUPPORTED 400 #ifdef PNG_READ_iCCP_SUPPORTED 403 #ifdef PNG_READ_iTXt_SUPPORTED 406 #ifdef PNG_READ_oFFs_SUPPORTED 409 #ifdef PNG_READ_pCAL_SUPPORTED 412 #ifdef PNG_READ_pHYs_SUPPORTED 415 #ifdef PNG_READ_sBIT_SUPPORTED 418 #ifdef PNG_READ_sCAL_SUPPORTED 421 #ifdef PNG_READ_sPLT_SUPPORTED 424 #ifdef PNG_READ_sRGB_SUPPORTED 427 #ifdef PNG_READ_tEXt_SUPPORTED 430 #ifdef PNG_READ_tIME_SUPPORTED 433 #ifdef PNG_READ_tRNS_SUPPORTED 436 #ifdef PNG_READ_zTXt_SUPPORTED 448 png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
452 else if (!
png_memcmp(chunk_name, png_IEND, 4))
454 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED 462 else if (!
png_memcmp(chunk_name, png_IDAT, 4))
465 png_error(png_ptr,
"Missing IHDR before IDAT");
468 png_error(png_ptr,
"Missing PLTE before IDAT");
473 else if (!
png_memcmp(chunk_name, png_PLTE, 4))
475 else if (!
png_memcmp(chunk_name, png_IDAT, 4))
478 png_error(png_ptr,
"Missing IHDR before IDAT");
481 png_error(png_ptr,
"Missing PLTE before IDAT");
483 png_ptr->idat_size =
length;
487 #ifdef PNG_READ_bKGD_SUPPORTED 488 else if (!
png_memcmp(chunk_name, png_bKGD, 4))
491 #ifdef PNG_READ_cHRM_SUPPORTED 492 else if (!
png_memcmp(chunk_name, png_cHRM, 4))
495 #ifdef PNG_READ_gAMA_SUPPORTED 496 else if (!
png_memcmp(chunk_name, png_gAMA, 4))
499 #ifdef PNG_READ_hIST_SUPPORTED 500 else if (!
png_memcmp(chunk_name, png_hIST, 4))
503 #ifdef PNG_READ_oFFs_SUPPORTED 504 else if (!
png_memcmp(chunk_name, png_oFFs, 4))
507 #ifdef PNG_READ_pCAL_SUPPORTED 508 else if (!
png_memcmp(chunk_name, png_pCAL, 4))
511 #ifdef PNG_READ_sCAL_SUPPORTED 512 else if (!
png_memcmp(chunk_name, png_sCAL, 4))
515 #ifdef PNG_READ_pHYs_SUPPORTED 516 else if (!
png_memcmp(chunk_name, png_pHYs, 4))
519 #ifdef PNG_READ_sBIT_SUPPORTED 520 else if (!
png_memcmp(chunk_name, png_sBIT, 4))
523 #ifdef PNG_READ_sRGB_SUPPORTED 524 else if (!
png_memcmp(chunk_name, png_sRGB, 4))
527 #ifdef PNG_READ_iCCP_SUPPORTED 528 else if (!
png_memcmp(chunk_name, png_iCCP, 4))
531 #ifdef PNG_READ_sPLT_SUPPORTED 532 else if (!
png_memcmp(chunk_name, png_sPLT, 4))
535 #ifdef PNG_READ_tEXt_SUPPORTED 536 else if (!
png_memcmp(chunk_name, png_tEXt, 4))
539 #ifdef PNG_READ_tIME_SUPPORTED 540 else if (!
png_memcmp(chunk_name, png_tIME, 4))
543 #ifdef PNG_READ_tRNS_SUPPORTED 544 else if (!
png_memcmp(chunk_name, png_tRNS, 4))
547 #ifdef PNG_READ_zTXt_SUPPORTED 548 else if (!
png_memcmp(chunk_name, png_zTXt, 4))
551 #ifdef PNG_READ_iTXt_SUPPORTED 552 else if (!
png_memcmp(chunk_name, png_iTXt, 4))
553 png_handle_iTXt(png_ptr, info_ptr, length);
569 if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
573 "Ignoring extra png_read_update_info() call; row buffer not reallocated");
578 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED 591 if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
596 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED 600 #ifndef PNG_USE_GLOBAL_ARRAYS 611 png_debug2(1,
"in png_read_row (row %lu, pass %d)",
612 png_ptr->row_number, png_ptr->pass);
614 if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
616 if (png_ptr->row_number == 0 && png_ptr->pass == 0)
619 #if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED) 620 if (png_ptr->transformations & PNG_INVERT_MONO)
621 png_warning(png_ptr,
"PNG_READ_INVERT_SUPPORTED is not defined.");
623 #if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED) 624 if (png_ptr->transformations & PNG_FILLER)
625 png_warning(png_ptr,
"PNG_READ_FILLER_SUPPORTED is not defined.");
627 #if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \ 628 !defined(PNG_READ_PACKSWAP_SUPPORTED) 629 if (png_ptr->transformations & PNG_PACKSWAP)
630 png_warning(png_ptr,
"PNG_READ_PACKSWAP_SUPPORTED is not defined.");
632 #if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED) 633 if (png_ptr->transformations & PNG_PACK)
634 png_warning(png_ptr,
"PNG_READ_PACK_SUPPORTED is not defined.");
636 #if defined(PNG_WRITE_SHIFT_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) 637 if (png_ptr->transformations & PNG_SHIFT)
638 png_warning(png_ptr,
"PNG_READ_SHIFT_SUPPORTED is not defined.");
640 #if defined(PNG_WRITE_BGR_SUPPORTED) && !defined(PNG_READ_BGR_SUPPORTED) 641 if (png_ptr->transformations & PNG_BGR)
642 png_warning(png_ptr,
"PNG_READ_BGR_SUPPORTED is not defined.");
644 #if defined(PNG_WRITE_SWAP_SUPPORTED) && !defined(PNG_READ_SWAP_SUPPORTED) 645 if (png_ptr->transformations & PNG_SWAP_BYTES)
646 png_warning(png_ptr,
"PNG_READ_SWAP_SUPPORTED is not defined.");
650 #ifdef PNG_READ_INTERLACING_SUPPORTED 652 if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
654 switch (png_ptr->pass)
657 if (png_ptr->row_number & 0x07)
661 png_pass_dsp_mask[png_ptr->pass]);
667 if ((png_ptr->row_number & 0x07) || png_ptr->width < 5)
671 png_pass_dsp_mask[png_ptr->pass]);
677 if ((png_ptr->row_number & 0x07) != 4)
679 if (dsp_row !=
NULL && (png_ptr->row_number & 4))
681 png_pass_dsp_mask[png_ptr->pass]);
687 if ((png_ptr->row_number & 3) || png_ptr->width < 3)
691 png_pass_dsp_mask[png_ptr->pass]);
697 if ((png_ptr->row_number & 3) != 2)
699 if (dsp_row !=
NULL && (png_ptr->row_number & 2))
701 png_pass_dsp_mask[png_ptr->pass]);
707 if ((png_ptr->row_number & 1) || png_ptr->width < 2)
711 png_pass_dsp_mask[png_ptr->pass]);
717 if (!(png_ptr->row_number & 1))
728 png_error(png_ptr,
"Invalid attempt to read row data");
730 png_ptr->zstream.next_out = png_ptr->row_buf;
731 png_ptr->zstream.avail_out =
732 (
uInt)(PNG_ROWBYTES(png_ptr->pixel_depth,
733 png_ptr->iwidth) + 1);
736 if (!(png_ptr->zstream.avail_in))
738 while (!png_ptr->idat_size)
743 if (
png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
744 png_error(png_ptr,
"Not enough image data");
746 png_ptr->zstream.avail_in = (
uInt)png_ptr->zbuf_size;
747 png_ptr->zstream.next_in = png_ptr->zbuf;
748 if (png_ptr->zbuf_size > png_ptr->idat_size)
749 png_ptr->zstream.avail_in = (
uInt)png_ptr->idat_size;
752 png_ptr->idat_size -= png_ptr->zstream.avail_in;
757 if (png_ptr->zstream.avail_out || png_ptr->zstream.avail_in ||
759 png_error(png_ptr,
"Extra compressed data");
761 png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
765 png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
766 "Decompression error");
768 }
while (png_ptr->zstream.avail_out);
770 png_ptr->row_info.color_type = png_ptr->color_type;
771 png_ptr->row_info.width = png_ptr->iwidth;
772 png_ptr->row_info.channels = png_ptr->channels;
773 png_ptr->row_info.bit_depth = png_ptr->bit_depth;
774 png_ptr->row_info.pixel_depth = png_ptr->pixel_depth;
775 png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
776 png_ptr->row_info.width);
778 if (png_ptr->row_buf[0])
780 png_ptr->row_buf + 1, png_ptr->prev_row + 1,
781 (
int)(png_ptr->row_buf[0]));
784 png_ptr->rowbytes + 1);
786 #ifdef PNG_MNG_FEATURES_SUPPORTED 796 if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
799 #ifdef PNG_READ_INTERLACING_SUPPORTED 801 if (png_ptr->interlaced &&
802 (png_ptr->transformations & PNG_INTERLACE))
804 if (png_ptr->pass < 6)
813 png_pass_dsp_mask[png_ptr->pass]);
816 png_pass_mask[png_ptr->pass]);
828 if (png_ptr->read_row_fn !=
NULL)
829 (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
833 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED 897 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED 922 #ifdef PNG_READ_INTERLACING_SUPPORTED 925 if (png_ptr->interlaced)
927 "Cannot read interlaced image -- interlace handler disabled.");
932 image_height=png_ptr->height;
935 for (j = 0; j < pass; j++)
947 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED 963 #ifdef PNG_USE_LOCAL_ARRAYS 968 #ifdef PNG_READ_bKGD_SUPPORTED 971 #ifdef PNG_READ_cHRM_SUPPORTED 974 #ifdef PNG_READ_gAMA_SUPPORTED 977 #ifdef PNG_READ_hIST_SUPPORTED 980 #ifdef PNG_READ_iCCP_SUPPORTED 983 #ifdef PNG_READ_iTXt_SUPPORTED 986 #ifdef PNG_READ_oFFs_SUPPORTED 989 #ifdef PNG_READ_pCAL_SUPPORTED 992 #ifdef PNG_READ_pHYs_SUPPORTED 995 #ifdef PNG_READ_sBIT_SUPPORTED 998 #ifdef PNG_READ_sCAL_SUPPORTED 1001 #ifdef PNG_READ_sPLT_SUPPORTED 1004 #ifdef PNG_READ_sRGB_SUPPORTED 1007 #ifdef PNG_READ_tEXt_SUPPORTED 1010 #ifdef PNG_READ_tIME_SUPPORTED 1013 #ifdef PNG_READ_tRNS_SUPPORTED 1016 #ifdef PNG_READ_zTXt_SUPPORTED 1025 else if (!
png_memcmp(chunk_name, png_IEND, 4))
1027 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED 1032 if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
1033 png_error(png_ptr,
"Too many IDAT's found");
1040 else if (!
png_memcmp(chunk_name, png_IDAT, 4))
1045 if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
1046 png_error(png_ptr,
"Too many IDAT's found");
1049 else if (!
png_memcmp(chunk_name, png_PLTE, 4))
1051 #ifdef PNG_READ_bKGD_SUPPORTED 1052 else if (!
png_memcmp(chunk_name, png_bKGD, 4))
1055 #ifdef PNG_READ_cHRM_SUPPORTED 1056 else if (!
png_memcmp(chunk_name, png_cHRM, 4))
1059 #ifdef PNG_READ_gAMA_SUPPORTED 1060 else if (!
png_memcmp(chunk_name, png_gAMA, 4))
1063 #ifdef PNG_READ_hIST_SUPPORTED 1064 else if (!
png_memcmp(chunk_name, png_hIST, 4))
1067 #ifdef PNG_READ_oFFs_SUPPORTED 1068 else if (!
png_memcmp(chunk_name, png_oFFs, 4))
1071 #ifdef PNG_READ_pCAL_SUPPORTED 1072 else if (!
png_memcmp(chunk_name, png_pCAL, 4))
1075 #ifdef PNG_READ_sCAL_SUPPORTED 1076 else if (!
png_memcmp(chunk_name, png_sCAL, 4))
1079 #ifdef PNG_READ_pHYs_SUPPORTED 1080 else if (!
png_memcmp(chunk_name, png_pHYs, 4))
1083 #ifdef PNG_READ_sBIT_SUPPORTED 1084 else if (!
png_memcmp(chunk_name, png_sBIT, 4))
1087 #ifdef PNG_READ_sRGB_SUPPORTED 1088 else if (!
png_memcmp(chunk_name, png_sRGB, 4))
1091 #ifdef PNG_READ_iCCP_SUPPORTED 1092 else if (!
png_memcmp(chunk_name, png_iCCP, 4))
1095 #ifdef PNG_READ_sPLT_SUPPORTED 1096 else if (!
png_memcmp(chunk_name, png_sPLT, 4))
1099 #ifdef PNG_READ_tEXt_SUPPORTED 1100 else if (!
png_memcmp(chunk_name, png_tEXt, 4))
1103 #ifdef PNG_READ_tIME_SUPPORTED 1104 else if (!
png_memcmp(chunk_name, png_tIME, 4))
1107 #ifdef PNG_READ_tRNS_SUPPORTED 1108 else if (!
png_memcmp(chunk_name, png_tRNS, 4))
1111 #ifdef PNG_READ_zTXt_SUPPORTED 1112 else if (!
png_memcmp(chunk_name, png_zTXt, 4))
1115 #ifdef PNG_READ_iTXt_SUPPORTED 1116 else if (!
png_memcmp(chunk_name, png_iTXt, 4))
1117 png_handle_iTXt(png_ptr, info_ptr, length);
1132 #ifdef PNG_USER_MEM_SUPPORTED 1137 png_debug(1,
"in png_destroy_read_struct");
1139 if (png_ptr_ptr !=
NULL)
1140 png_ptr = *png_ptr_ptr;
1141 if (png_ptr ==
NULL)
1144 #ifdef PNG_USER_MEM_SUPPORTED 1145 free_fn = png_ptr->free_fn;
1146 mem_ptr = png_ptr->mem_ptr;
1149 if (info_ptr_ptr !=
NULL)
1152 if (end_info_ptr_ptr !=
NULL)
1157 if (info_ptr !=
NULL)
1159 #ifdef PNG_TEXT_SUPPORTED 1163 #ifdef PNG_USER_MEM_SUPPORTED 1169 *info_ptr_ptr =
NULL;
1172 if (end_info_ptr !=
NULL)
1174 #ifdef PNG_READ_TEXT_SUPPORTED 1177 #ifdef PNG_USER_MEM_SUPPORTED 1183 *end_info_ptr_ptr =
NULL;
1186 if (png_ptr !=
NULL)
1188 #ifdef PNG_USER_MEM_SUPPORTED 1194 *png_ptr_ptr =
NULL;
1203 #ifdef PNG_SETJMP_SUPPORTED 1209 #ifdef PNG_USER_MEM_SUPPORTED 1215 if (info_ptr !=
NULL)
1218 if (end_info_ptr !=
NULL)
1222 png_free(png_ptr, png_ptr->big_row_buf);
1223 png_free(png_ptr, png_ptr->prev_row);
1224 png_free(png_ptr, png_ptr->chunkdata);
1225 #ifdef PNG_READ_DITHER_SUPPORTED 1226 png_free(png_ptr, png_ptr->palette_lookup);
1227 png_free(png_ptr, png_ptr->dither_index);
1229 #ifdef PNG_READ_GAMMA_SUPPORTED 1230 png_free(png_ptr, png_ptr->gamma_table);
1232 #ifdef PNG_READ_BACKGROUND_SUPPORTED 1233 png_free(png_ptr, png_ptr->gamma_from_1);
1234 png_free(png_ptr, png_ptr->gamma_to_1);
1236 #ifdef PNG_FREE_ME_SUPPORTED 1241 if (png_ptr->flags & PNG_FLAG_FREE_PLTE)
1243 png_ptr->flags &= ~PNG_FLAG_FREE_PLTE;
1245 #if defined(PNG_tRNS_SUPPORTED) || \ 1246 defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) 1247 #ifdef PNG_FREE_ME_SUPPORTED 1252 if (png_ptr->flags & PNG_FLAG_FREE_TRNS)
1254 png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
1257 #ifdef PNG_READ_hIST_SUPPORTED 1258 #ifdef PNG_FREE_ME_SUPPORTED 1263 if (png_ptr->flags & PNG_FLAG_FREE_HIST)
1265 png_ptr->flags &= ~PNG_FLAG_FREE_HIST;
1268 #ifdef PNG_READ_GAMMA_SUPPORTED 1269 if (png_ptr->gamma_16_table !=
NULL)
1272 int istop = (1 << (8 - png_ptr->gamma_shift));
1273 for (i = 0; i < istop; i++)
1275 png_free(png_ptr, png_ptr->gamma_16_table[i]);
1277 png_free(png_ptr, png_ptr->gamma_16_table);
1279 #ifdef PNG_READ_BACKGROUND_SUPPORTED 1280 if (png_ptr->gamma_16_from_1 !=
NULL)
1283 int istop = (1 << (8 - png_ptr->gamma_shift));
1284 for (i = 0; i < istop; i++)
1286 png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
1288 png_free(png_ptr, png_ptr->gamma_16_from_1);
1290 if (png_ptr->gamma_16_to_1 !=
NULL)
1293 int istop = (1 << (8 - png_ptr->gamma_shift));
1294 for (i = 0; i < istop; i++)
1296 png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
1298 png_free(png_ptr, png_ptr->gamma_16_to_1);
1302 #ifdef PNG_TIME_RFC1123_SUPPORTED 1303 png_free(png_ptr, png_ptr->time_buffer);
1307 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED 1308 png_free(png_ptr, png_ptr->save_buffer);
1314 #ifdef PNG_SETJMP_SUPPORTED 1318 error_fn = png_ptr->error_fn;
1319 warning_fn = png_ptr->warning_fn;
1320 error_ptr = png_ptr->error_ptr;
1321 #ifdef PNG_USER_MEM_SUPPORTED 1322 free_fn = png_ptr->free_fn;
1330 #ifdef PNG_USER_MEM_SUPPORTED 1334 #ifdef PNG_SETJMP_SUPPORTED 1343 if (png_ptr ==
NULL)
1349 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED 1350 #ifdef PNG_INFO_IMAGE_SUPPORTED 1358 if (png_ptr ==
NULL)
1360 #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED 1372 png_error(png_ptr,
"Image is too high to process with png_read_png()");
1376 #ifdef PNG_READ_16_TO_8_SUPPORTED 1383 #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED 1391 #if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED) 1399 #ifdef PNG_READ_PACKSWAP_SUPPORTED 1407 #ifdef PNG_READ_EXPAND_SUPPORTED 1414 if ((png_ptr->bit_depth < 8) ||
1423 #ifdef PNG_READ_INVERT_SUPPORTED 1430 #ifdef PNG_READ_SHIFT_SUPPORTED 1439 #ifdef PNG_READ_BGR_SUPPORTED 1446 #ifdef PNG_READ_SWAP_ALPHA_SUPPORTED 1453 #ifdef PNG_READ_SWAP_SUPPORTED 1461 #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED 1464 if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
1469 #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED 1486 #ifdef PNG_FREE_ME_SUPPORTED 1489 if (info_ptr->row_pointers ==
NULL)
1493 png_memset(info_ptr->row_pointers, 0, info_ptr->height
1496 #ifdef PNG_FREE_ME_SUPPORTED 1500 for (row = 0; row < (
int)info_ptr->height; row++)
void png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
GLenum GLuint GLenum GLsizei length
void PNGAPI png_set_packing(png_structp png_ptr)
PNG_CONST char png_libpng_ver[18]
#define PNG_USER_WIDTH_MAX
#define PNG_TRANSFORM_SWAP_ENDIAN
png_voidp png_error_ptr png_error_ptr png_voidp png_malloc_ptr malloc_fn
void png_zfree(voidpf png_ptr, voidpf ptr)
void PNGAPI png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num)
#define PNG_TRANSFORM_STRIP_16
png_voidp png_create_struct(int type)
void png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void PNGAPI png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
#define PNG_TRANSFORM_INVERT_MONO
png_voidp png_malloc_ptr png_free_ptr free_fn
void PNGAPI png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)
#define png_malloc_ptr_NULL
void PNGAPI png_set_invert_alpha(png_structp png_ptr)
#define PNG_TRANSFORM_PACKSWAP
GLenum GLsizei GLenum GLenum const GLvoid * image
#define PNG_COLOR_TYPE_PALETTE
void png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#define PNG_UNUSED(param)
void png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void PNGAPI png_read_rows(png_structp png_ptr, png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)
#define PNG_LIBPNG_VER_STRING
png_size_t png_size_t num_to_check
#define PNG_USER_CHUNK_CACHE_MAX
#define PNG_TRANSFORM_BGR
void png_do_read_transformations(png_structp png_ptr)
int PNGAPI png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
PNG_CONST char FAR * png_const_charp
void PNGAPI png_set_strip_16(png_structp png_ptr)
void png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
png_infopp png_infopp end_info_ptr_ptr
#define PNG_USER_HEIGHT_MAX
void png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr)
void png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_voidp png_error_ptr png_error_ptr warning_fn
png_struct FAR *FAR * png_structpp
void png_read_finish_row(png_structp png_ptr)
voidpf png_zalloc(voidpf png_ptr, uInt items, uInt size)
void png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
GLenum GLenum GLvoid * row
void PNGAPI png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
void PNGAPI png_set_bgr(png_structp png_ptr)
png_byte FAR *FAR * png_bytepp
void png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_bytepp png_bytepp display_row
void png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#define inflateInit(strm)
void png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
png_struct FAR * png_structp
void png_read_start_row(png_structp png_ptr)
#define png_error(s1, s2)
void PNGAPI png_read_end(png_structp png_ptr, png_infop info_ptr)
png_read_status_ptr read_row_fn
void png_info_destroy(png_structp png_ptr, png_infop info_ptr)
int JSAMPARRAY int int num_rows
void PNGAPI png_set_packswap(png_structp png_ptr)
void png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void png_destroy_struct(png_voidp struct_ptr)
void PNGAPI png_set_swap(png_structp png_ptr)
png_voidp png_error_ptr error_fn
void png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void png_do_read_interlace(png_structp png_ptr)
#define PNG_TRANSFORM_GRAY_TO_RGB
void PNGAPI png_warning(png_structp png_ptr, png_const_charp warning_message)
void png_combine_row(png_structp png_ptr, png_bytep row, int mask)
int ZEXPORT inflate(z_streamp strm, int flush)
PNG_CONST int FARDATA png_pass_dsp_mask[]
void png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
int PNGAPI png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
#define PNG_TRANSFORM_PACKING
#define PNG_TRANSFORM_INVERT_ALPHA
void PNGAPI png_set_strip_alpha(png_structp png_ptr)
int png_crc_finish(png_structp png_ptr, png_uint_32 skip)
void PNGAPI png_read_info(png_structp png_ptr, png_infop info_ptr)
void PNGAPI png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn)
void PNGAPI png_set_invert_mono(png_structp png_ptr)
void PNGAPI png_start_read_image(png_structp png_ptr)
void PNGAPI png_read_init(png_structp png_ptr)
#define PNG_FLAG_MNG_FILTER_64
void png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if(!abbox) return FT_THROW(Invalid_Argument)
void png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_structp PNGAPI png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)
GLenum const GLfloat * params
png_voidp png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
PNG_CONST int FARDATA png_pass_mask[]
void png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)
#define png_free_ptr_NULL
png_structp PNGAPI png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn)
png_voidp png_error_ptr png_error_ptr warn_fn
png_voidp PNGAPI png_memcpy_check(png_structp png_ptr, png_voidp s1, png_voidp s2, png_uint_32 length)
void PNGAPI png_set_expand(png_structp png_ptr)
void png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
int PNGAPI png_set_interlace_handling(png_structp png_ptr)
void png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void PNGAPI png_read_png(png_structp png_ptr, png_infop info_ptr, int transforms, voidp params)
void PNGAPI png_set_shift(png_structp png_ptr, png_color_8p true_bits)
#define PNG_TRANSFORM_SWAP_ALPHA
void png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, png_voidp mem_ptr)
void PNGAPI png_read_image(png_structp png_ptr, png_bytepp image)
void png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#define PNG_TRANSFORM_EXPAND
#define PNG_INTRAPIXEL_DIFFERENCING
void png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#define PNG_TRANSFORM_STRIP_ALPHA
unsigned long png_uint_32
void PNGAPI png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size)
void png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_voidp png_error_ptr png_error_ptr png_voidp mem_ptr
png_info FAR *FAR * png_infopp
void PNGAPI png_free(png_structp png_ptr, png_voidp ptr)
#define png_debug2(l, m, p1, p2)
png_uint_32 PNGAPI png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
void PNGAPI png_set_swap_alpha(png_structp png_ptr)
void PNGAPI png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)
#define PNG_TRANSFORM_SHIFT
void PNGAPI png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, png_size_t png_struct_size)
void png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void PNGAPI png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)
void PNGAPI png_read_update_info(png_structp png_ptr, png_infop info_ptr)
int ZEXPORT inflateEnd(z_streamp strm)
png_voidp PNGAPI png_malloc(png_structp png_ptr, png_uint_32 size)
void PNGAPI png_set_gray_to_rgb(png_structp png_ptr)
png_uint_32 png_read_chunk_header(png_structp png_ptr)