13 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) 18 if (png_ptr != NULL && info_ptr != NULL)
19 return(info_ptr->valid & flag);
27 if (png_ptr != NULL && info_ptr != NULL)
28 return(info_ptr->rowbytes);
33 #if defined(PNG_INFO_IMAGE_SUPPORTED) 37 if (png_ptr != NULL && info_ptr != NULL)
38 return(info_ptr->row_pointers);
44 #ifdef PNG_EASY_ACCESS_SUPPORTED 49 if (png_ptr != NULL && info_ptr != NULL)
51 return info_ptr->width;
59 if (png_ptr != NULL && info_ptr != NULL)
61 return info_ptr->height;
69 if (png_ptr != NULL && info_ptr != NULL)
71 return info_ptr->bit_depth;
79 if (png_ptr != NULL && info_ptr != NULL)
81 return info_ptr->color_type;
89 if (png_ptr != NULL && info_ptr != NULL)
91 return info_ptr->filter_type;
99 if (png_ptr != NULL && info_ptr != NULL)
101 return info_ptr->interlace_type;
109 if (png_ptr != NULL && info_ptr != NULL)
111 return info_ptr->compression_type;
119 if (png_ptr != NULL && info_ptr != NULL)
120 #if defined(PNG_pHYs_SUPPORTED) 123 png_debug1(1,
"in %s retrieval function\n",
"png_get_x_pixels_per_meter");
126 else return (info_ptr->x_pixels_per_unit);
137 if (png_ptr != NULL && info_ptr != NULL)
138 #if defined(PNG_pHYs_SUPPORTED) 141 png_debug1(1,
"in %s retrieval function\n",
"png_get_y_pixels_per_meter");
144 else return (info_ptr->y_pixels_per_unit);
155 if (png_ptr != NULL && info_ptr != NULL)
156 #if defined(PNG_pHYs_SUPPORTED) 159 png_debug1(1,
"in %s retrieval function\n",
"png_get_pixels_per_meter");
161 info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
163 else return (info_ptr->x_pixels_per_unit);
171 #ifdef PNG_FLOATING_POINT_SUPPORTED 175 if (png_ptr != NULL && info_ptr != NULL)
176 #if defined(PNG_pHYs_SUPPORTED) 179 png_debug1(1,
"in %s retrieval function\n",
"png_get_aspect_ratio");
180 if (info_ptr->x_pixels_per_unit == 0)
183 return ((
float)((
float)info_ptr->y_pixels_per_unit
184 /(
float)info_ptr->x_pixels_per_unit));
196 if (png_ptr != NULL && info_ptr != NULL)
197 #if defined(PNG_oFFs_SUPPORTED) 200 png_debug1(1,
"in %s retrieval function\n",
"png_get_x_offset_microns");
203 else return (info_ptr->x_offset);
214 if (png_ptr != NULL && info_ptr != NULL)
215 #if defined(PNG_oFFs_SUPPORTED) 218 png_debug1(1,
"in %s retrieval function\n",
"png_get_y_offset_microns");
221 else return (info_ptr->y_offset);
232 if (png_ptr != NULL && info_ptr != NULL)
233 #if defined(PNG_oFFs_SUPPORTED) 236 png_debug1(1,
"in %s retrieval function\n",
"png_get_x_offset_microns");
239 else return (info_ptr->x_offset);
250 if (png_ptr != NULL && info_ptr != NULL)
251 #if defined(PNG_oFFs_SUPPORTED) 254 png_debug1(1,
"in %s retrieval function\n",
"png_get_y_offset_microns");
257 else return (info_ptr->y_offset);
265 #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) 301 #if defined(PNG_pHYs_SUPPORTED) 310 png_debug1(1,
"in %s retrieval function\n",
"pHYs");
321 if (unit_type != NULL)
344 if (png_ptr != NULL && info_ptr != NULL)
345 return(info_ptr->channels);
353 if (png_ptr != NULL && info_ptr != NULL)
354 return(info_ptr->signature);
359 #if defined(PNG_bKGD_SUPPORTED) 364 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_bKGD)
365 && background != NULL)
367 png_debug1(1,
"in %s retrieval function\n",
"bKGD");
368 *background = &(info_ptr->background);
375 #if defined(PNG_cHRM_SUPPORTED) 376 #ifdef PNG_FLOATING_POINT_SUPPORTED 382 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_cHRM))
384 png_debug1(1,
"in %s retrieval function\n",
"cHRM");
386 *white_x = (double)info_ptr->x_white;
388 *white_y = (double)info_ptr->y_white;
390 *red_x = (double)info_ptr->x_red;
392 *red_y = (double)info_ptr->y_red;
394 *green_x = (double)info_ptr->x_green;
396 *green_y = (double)info_ptr->y_green;
398 *blue_x = (double)info_ptr->x_blue;
400 *blue_y = (double)info_ptr->y_blue;
406 #ifdef PNG_FIXED_POINT_SUPPORTED 413 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_cHRM))
415 png_debug1(1,
"in %s retrieval function\n",
"cHRM");
417 *white_x = info_ptr->int_x_white;
419 *white_y = info_ptr->int_y_white;
421 *red_x = info_ptr->int_x_red;
423 *red_y = info_ptr->int_y_red;
425 *green_x = info_ptr->int_x_green;
427 *green_y = info_ptr->int_y_green;
429 *blue_x = info_ptr->int_x_blue;
431 *blue_y = info_ptr->int_y_blue;
439 #if defined(PNG_gAMA_SUPPORTED) 440 #ifdef PNG_FLOATING_POINT_SUPPORTED 444 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_gAMA)
445 && file_gamma != NULL)
447 png_debug1(1,
"in %s retrieval function\n",
"gAMA");
448 *file_gamma = (double)info_ptr->gamma;
454 #ifdef PNG_FIXED_POINT_SUPPORTED 459 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_gAMA)
460 && int_file_gamma != NULL)
462 png_debug1(1,
"in %s retrieval function\n",
"gAMA");
463 *int_file_gamma = info_ptr->int_gamma;
471 #if defined(PNG_sRGB_SUPPORTED) 475 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_sRGB)
476 && file_srgb_intent != NULL)
478 png_debug1(1,
"in %s retrieval function\n",
"sRGB");
479 *file_srgb_intent = (
int)info_ptr->srgb_intent;
486 #if defined(PNG_iCCP_SUPPORTED) 492 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_iCCP)
493 && name != NULL && profile != NULL && proflen != NULL)
495 png_debug1(1,
"in %s retrieval function\n",
"iCCP");
496 *name = info_ptr->iccp_name;
497 *profile = info_ptr->iccp_profile;
500 *proflen = (
int)info_ptr->iccp_proflen;
501 *compression_type = (
int)info_ptr->iccp_compression;
508 #if defined(PNG_sPLT_SUPPORTED) 513 if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
515 *spalettes = info_ptr->splt_palettes;
522 #if defined(PNG_hIST_SUPPORTED) 526 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_hIST)
529 png_debug1(1,
"in %s retrieval function\n",
"hIST");
530 *hist = info_ptr->hist;
544 if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
545 bit_depth != NULL && color_type != NULL)
547 png_debug1(1,
"in %s retrieval function\n",
"IHDR");
548 *width = info_ptr->width;
549 *height = info_ptr->height;
550 *bit_depth = info_ptr->bit_depth;
551 if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
553 *color_type = info_ptr->color_type;
554 if (info_ptr->color_type > 6)
555 png_error(png_ptr,
"Invalid color type");
556 if (compression_type != NULL)
557 *compression_type = info_ptr->compression_type;
558 if (filter_type != NULL)
559 *filter_type = info_ptr->filter_type;
560 if (interlace_type != NULL)
561 *interlace_type = info_ptr->interlace_type;
565 png_error(png_ptr,
"Invalid image width");
567 png_error(png_ptr,
"Invalid image height");
576 "Width too large for libpng to process image data.");
583 #if defined(PNG_oFFs_SUPPORTED) 588 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_oFFs)
589 && offset_x != NULL && offset_y != NULL && unit_type != NULL)
591 png_debug1(1,
"in %s retrieval function\n",
"oFFs");
592 *offset_x = info_ptr->x_offset;
593 *offset_y = info_ptr->y_offset;
594 *unit_type = (
int)info_ptr->offset_unit_type;
601 #if defined(PNG_pCAL_SUPPORTED) 607 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_pCAL)
608 && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
609 nparams != NULL && units != NULL && params != NULL)
611 png_debug1(1,
"in %s retrieval function\n",
"pCAL");
612 *purpose = info_ptr->pcal_purpose;
613 *X0 = info_ptr->pcal_X0;
614 *X1 = info_ptr->pcal_X1;
615 *type = (
int)info_ptr->pcal_type;
616 *nparams = (
int)info_ptr->pcal_nparams;
617 *units = info_ptr->pcal_units;
618 *params = info_ptr->pcal_params;
625 #if defined(PNG_sCAL_SUPPORTED) 626 #ifdef PNG_FLOATING_POINT_SUPPORTED 631 if (png_ptr != NULL && info_ptr != NULL &&
634 *unit = info_ptr->scal_unit;
635 *width = info_ptr->scal_pixel_width;
636 *height = info_ptr->scal_pixel_height;
642 #ifdef PNG_FIXED_POINT_SUPPORTED 647 if (png_ptr != NULL &&
info_ptr != NULL &&
661 #if defined(PNG_pHYs_SUPPORTED) 668 if (png_ptr != NULL && info_ptr != NULL &&
671 png_debug1(1,
"in %s retrieval function\n",
"pHYs");
674 *res_x = info_ptr->x_pixels_per_unit;
679 *res_y = info_ptr->y_pixels_per_unit;
682 if (unit_type != NULL)
684 *unit_type = (
int)info_ptr->phys_unit_type;
696 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_PLTE)
699 png_debug1(1,
"in %s retrieval function\n",
"PLTE");
700 *palette = info_ptr->palette;
701 *num_palette = info_ptr->num_palette;
702 png_debug1(3,
"num_palette = %d\n", *num_palette);
708 #if defined(PNG_sBIT_SUPPORTED) 712 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_sBIT)
715 png_debug1(1,
"in %s retrieval function\n",
"sBIT");
716 *sig_bit = &(info_ptr->sig_bit);
723 #if defined(PNG_TEXT_SUPPORTED) 728 if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
731 (png_ptr->chunk_name[0] ==
'\0' ?
"text" 733 if (text_ptr != NULL)
734 *text_ptr = info_ptr->text;
735 if (num_text != NULL)
736 *num_text = info_ptr->num_text;
739 if (num_text != NULL)
745 #if defined(PNG_tIME_SUPPORTED) 749 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_tIME)
752 png_debug1(1,
"in %s retrieval function\n",
"tIME");
753 *mod_time = &(info_ptr->mod_time);
760 #if defined(PNG_tRNS_SUPPORTED) 766 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid &
PNG_INFO_tRNS))
768 png_debug1(1,
"in %s retrieval function\n",
"tRNS");
773 *trans = info_ptr->trans;
776 if (trans_values != NULL)
777 *trans_values = &(info_ptr->trans_values);
781 if (trans_values != NULL)
783 *trans_values = &(info_ptr->trans_values);
789 if (num_trans != NULL)
791 *num_trans = info_ptr->num_trans;
799 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 804 if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
806 *unknowns = info_ptr->unknown_chunks;
807 return ((
png_uint_32)info_ptr->unknown_chunks_num);
813 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) 817 return (
png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
821 #if defined(PNG_USER_CHUNKS_SUPPORTED) 825 return (png_ptr? png_ptr->user_chunk_ptr : NULL);
829 #ifdef PNG_WRITE_SUPPORTED 833 return (
png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
837 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED 844 return (png_ptr? 0L: 0L);
852 flag_select=flag_select;
862 flag_select=flag_select;
872 return (png_ptr? 0: 0);
880 return (png_ptr? 0L: 0L);
885 #ifdef PNG_SET_USER_LIMITS_SUPPORTED 890 return (png_ptr? png_ptr->user_width_max : 0);
895 return (png_ptr? png_ptr->user_height_max : 0);
png_int_32 PNGAPI png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
png_infop png_charpp int png_charpp profile
png_uint_32 PNGAPI png_get_image_width(png_structp png_ptr, png_infop info_ptr)
png_infop png_charpp int png_charpp png_uint_32 * proflen
png_infop png_uint_32 * res_x
png_infop png_charp png_int_32 png_int_32 int int png_charp * units
png_uint_32 PNGAPI png_get_tRNS(png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values)
png_uint_32 PNGAPI png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
png_uint_32 PNGAPI png_get_oFFs(png_structp png_ptr, png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
png_uint_32 PNGAPI png_get_cHRM(png_structp png_ptr, png_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)
png_bytep PNGAPI png_get_signature(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI png_get_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
png_infop png_charp png_int_32 png_int_32 int * type
png_infop png_uint_32 png_uint_32 * res_y
png_uint_32 PNGAPI png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, png_unknown_chunkpp unknowns)
png_infop double double double double double double double double * blue_y
png_infop png_textp * text_ptr
png_colorp int num_palette
png_infop double double double double double double double * blue_x
png_uint_32 PNGAPI png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
png_color_16 FAR * png_color_16p
png_infop png_color_16p * background
#define PNG_COLOR_TYPE_PALETTE
png_uint_32 PNGAPI png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
png_infop png_charp png_int_32 png_int_32 * X1
png_infop png_charpp name
png_infop png_charp png_int_32 png_int_32 int int png_charp png_charpp * params
png_infop png_int_32 png_int_32 * offset_y
png_infop png_int_32 * offset_x
PNG_CONST char FAR * png_const_charp
float PNGAPI png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
png_infop double double double double * red_y
png_infop png_bytep * trans
png_unknown_chunk FAR *FAR * png_unknown_chunkpp
png_infop png_charp png_int_32 * X0
png_infop png_uint_32 * width
png_uint_32 PNGAPI png_get_mmx_flagmask(int flag_select, int *compilerID)
png_uint_32 PNGAPI png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point *int_file_gamma)
png_uint_32 PNGAPI png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, int *num_text)
png_uint_32 PNGAPI png_get_sCAL(png_structp png_ptr, png_infop info_ptr, int *unit, double *width, double *height)
png_infop png_bytep int png_color_16p * trans_values
png_byte PNGAPI png_get_mmx_bitdepth_threshold(png_structp png_ptr)
png_byte FAR *FAR * png_bytepp
png_infop png_charpp int * compression_type
png_uint_32 PNGAPI png_get_user_height_max(png_structp png_ptr)
png_infop png_uint_16p * hist
png_uint_32 PNGAPI png_get_compression_buffer_size(png_structp png_ptr)
png_uint_32 PNGAPI png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
png_byte PNGAPI png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
png_struct FAR * png_structp
png_uint_32 PNGAPI png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette)
void PNGAPI png_error(png_structp png_ptr, png_const_charp error_message)
png_uint_32 PNGAPI png_get_cHRM_fixed(png_structp png_ptr, png_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)
png_infop png_uint_32 png_uint_32 * height
png_uint_32 PNGAPI png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI png_get_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_type, int *compression_type, int *filter_type)
png_byte PNGAPI png_get_rgb_to_gray_status(png_structp png_ptr)
png_infop png_bytep int * num_trans
void PNGAPI png_warning(png_structp png_ptr, png_const_charp warning_message)
png_infop png_fixed_point * int_file_gamma
png_uint_32 PNGAPI png_get_user_width_max(png_structp png_ptr)
png_uint_32 PNGAPI png_get_mmx_rowbytes_threshold(png_structp png_ptr)
png_uint_16 FAR * png_uint_16p
#define PNG_RESOLUTION_METER
#define png_debug1(l, m, p1)
png_infop png_uint_32 png_uint_32 int * bit_depth
png_infop double * file_gamma
png_uint_32 PNGAPI png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI png_get_iCCP(png_structp png_ptr, png_infop info_ptr, png_charpp name, int *compression_type, png_charpp profile, png_uint_32 *proflen)
png_uint_32 PNGAPI png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI png_get_pCAL(png_structp png_ptr, png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params)
png_infop png_textp int * num_text
png_byte PNGAPI png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI png_get_asm_flags(png_structp png_ptr)
png_infop png_charp * purpose
png_int_32 PNGAPI png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
png_infop png_uint_32 png_uint_32 int int * color_type
png_infop double double double double double double * green_y
png_infop double double * white_y
png_int_32 PNGAPI png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
png_byte PNGAPI png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI png_get_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p *background)
png_infop png_charp png_int_32 png_int_32 int int * nparams
#define PNG_OFFSET_MICROMETER
png_color_8 FAR * png_color_8p
png_uint_32 PNGAPI png_get_asm_flagmask(int flag_select)
png_int_32 png_fixed_point
png_infop double double double * red_x
char FAR *FAR * png_charpp
png_uint_32 PNGAPI png_get_sPLT(png_structp png_ptr, png_infop info_ptr, png_sPLT_tpp spalettes)
png_infop png_int_32 png_int_32 int * unit_type
png_uint_32 PNGAPI png_get_image_height(png_structp png_ptr, png_infop info_ptr)
png_sPLT_t FAR *FAR * png_sPLT_tpp
png_byte PNGAPI png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
png_infop double double double double double * green_x
unsigned long png_uint_32
png_int_32 PNGAPI png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
png_bytepp PNGAPI png_get_rows(png_structp png_ptr, png_infop info_ptr)
png_infop png_uint_32 flag
png_uint_32 PNGAPI png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
png_voidp PNGAPI png_get_user_chunk_ptr(png_structp png_ptr)
png_infop double * white_x
png_infop png_timep * mod_time
png_byte PNGAPI png_get_color_type(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
png_byte PNGAPI png_get_channels(png_structp png_ptr, png_infop info_ptr)
png_infop png_unknown_chunkp unknowns
png_infop png_color_8p * sig_bit
png_color FAR * png_colorp