istereo2

annotate libs/libpng/pngget.c @ 20:2b85d05df3f2

animation controls for easier screenshot grabbing
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 02 Oct 2015 04:54:55 +0300
parents
children
rev   line source
nuclear@2 1
nuclear@2 2 /* pngget.c - retrieval of values from info struct
nuclear@2 3 *
nuclear@2 4 * Last changed in libpng 1.2.30 [August 15, 2008]
nuclear@2 5 * For conditions of distribution and use, see copyright notice in png.h
nuclear@2 6 * Copyright (c) 1998-2008 Glenn Randers-Pehrson
nuclear@2 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
nuclear@2 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
nuclear@2 9 */
nuclear@2 10
nuclear@2 11 #define PNG_INTERNAL
nuclear@2 12 #include "png.h"
nuclear@2 13 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
nuclear@2 14
nuclear@2 15 png_uint_32 PNGAPI
nuclear@2 16 png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
nuclear@2 17 {
nuclear@2 18 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 19 return(info_ptr->valid & flag);
nuclear@2 20 else
nuclear@2 21 return(0);
nuclear@2 22 }
nuclear@2 23
nuclear@2 24 png_uint_32 PNGAPI
nuclear@2 25 png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
nuclear@2 26 {
nuclear@2 27 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 28 return(info_ptr->rowbytes);
nuclear@2 29 else
nuclear@2 30 return(0);
nuclear@2 31 }
nuclear@2 32
nuclear@2 33 #if defined(PNG_INFO_IMAGE_SUPPORTED)
nuclear@2 34 png_bytepp PNGAPI
nuclear@2 35 png_get_rows(png_structp png_ptr, png_infop info_ptr)
nuclear@2 36 {
nuclear@2 37 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 38 return(info_ptr->row_pointers);
nuclear@2 39 else
nuclear@2 40 return(0);
nuclear@2 41 }
nuclear@2 42 #endif
nuclear@2 43
nuclear@2 44 #ifdef PNG_EASY_ACCESS_SUPPORTED
nuclear@2 45 /* easy access to info, added in libpng-0.99 */
nuclear@2 46 png_uint_32 PNGAPI
nuclear@2 47 png_get_image_width(png_structp png_ptr, png_infop info_ptr)
nuclear@2 48 {
nuclear@2 49 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 50 {
nuclear@2 51 return info_ptr->width;
nuclear@2 52 }
nuclear@2 53 return (0);
nuclear@2 54 }
nuclear@2 55
nuclear@2 56 png_uint_32 PNGAPI
nuclear@2 57 png_get_image_height(png_structp png_ptr, png_infop info_ptr)
nuclear@2 58 {
nuclear@2 59 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 60 {
nuclear@2 61 return info_ptr->height;
nuclear@2 62 }
nuclear@2 63 return (0);
nuclear@2 64 }
nuclear@2 65
nuclear@2 66 png_byte PNGAPI
nuclear@2 67 png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
nuclear@2 68 {
nuclear@2 69 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 70 {
nuclear@2 71 return info_ptr->bit_depth;
nuclear@2 72 }
nuclear@2 73 return (0);
nuclear@2 74 }
nuclear@2 75
nuclear@2 76 png_byte PNGAPI
nuclear@2 77 png_get_color_type(png_structp png_ptr, png_infop info_ptr)
nuclear@2 78 {
nuclear@2 79 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 80 {
nuclear@2 81 return info_ptr->color_type;
nuclear@2 82 }
nuclear@2 83 return (0);
nuclear@2 84 }
nuclear@2 85
nuclear@2 86 png_byte PNGAPI
nuclear@2 87 png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
nuclear@2 88 {
nuclear@2 89 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 90 {
nuclear@2 91 return info_ptr->filter_type;
nuclear@2 92 }
nuclear@2 93 return (0);
nuclear@2 94 }
nuclear@2 95
nuclear@2 96 png_byte PNGAPI
nuclear@2 97 png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
nuclear@2 98 {
nuclear@2 99 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 100 {
nuclear@2 101 return info_ptr->interlace_type;
nuclear@2 102 }
nuclear@2 103 return (0);
nuclear@2 104 }
nuclear@2 105
nuclear@2 106 png_byte PNGAPI
nuclear@2 107 png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
nuclear@2 108 {
nuclear@2 109 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 110 {
nuclear@2 111 return info_ptr->compression_type;
nuclear@2 112 }
nuclear@2 113 return (0);
nuclear@2 114 }
nuclear@2 115
nuclear@2 116 png_uint_32 PNGAPI
nuclear@2 117 png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
nuclear@2 118 {
nuclear@2 119 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 120 #if defined(PNG_pHYs_SUPPORTED)
nuclear@2 121 if (info_ptr->valid & PNG_INFO_pHYs)
nuclear@2 122 {
nuclear@2 123 png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter");
nuclear@2 124 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
nuclear@2 125 return (0);
nuclear@2 126 else return (info_ptr->x_pixels_per_unit);
nuclear@2 127 }
nuclear@2 128 #else
nuclear@2 129 return (0);
nuclear@2 130 #endif
nuclear@2 131 return (0);
nuclear@2 132 }
nuclear@2 133
nuclear@2 134 png_uint_32 PNGAPI
nuclear@2 135 png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
nuclear@2 136 {
nuclear@2 137 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 138 #if defined(PNG_pHYs_SUPPORTED)
nuclear@2 139 if (info_ptr->valid & PNG_INFO_pHYs)
nuclear@2 140 {
nuclear@2 141 png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
nuclear@2 142 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
nuclear@2 143 return (0);
nuclear@2 144 else return (info_ptr->y_pixels_per_unit);
nuclear@2 145 }
nuclear@2 146 #else
nuclear@2 147 return (0);
nuclear@2 148 #endif
nuclear@2 149 return (0);
nuclear@2 150 }
nuclear@2 151
nuclear@2 152 png_uint_32 PNGAPI
nuclear@2 153 png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
nuclear@2 154 {
nuclear@2 155 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 156 #if defined(PNG_pHYs_SUPPORTED)
nuclear@2 157 if (info_ptr->valid & PNG_INFO_pHYs)
nuclear@2 158 {
nuclear@2 159 png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter");
nuclear@2 160 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
nuclear@2 161 info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
nuclear@2 162 return (0);
nuclear@2 163 else return (info_ptr->x_pixels_per_unit);
nuclear@2 164 }
nuclear@2 165 #else
nuclear@2 166 return (0);
nuclear@2 167 #endif
nuclear@2 168 return (0);
nuclear@2 169 }
nuclear@2 170
nuclear@2 171 #ifdef PNG_FLOATING_POINT_SUPPORTED
nuclear@2 172 float PNGAPI
nuclear@2 173 png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
nuclear@2 174 {
nuclear@2 175 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 176 #if defined(PNG_pHYs_SUPPORTED)
nuclear@2 177 if (info_ptr->valid & PNG_INFO_pHYs)
nuclear@2 178 {
nuclear@2 179 png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
nuclear@2 180 if (info_ptr->x_pixels_per_unit == 0)
nuclear@2 181 return ((float)0.0);
nuclear@2 182 else
nuclear@2 183 return ((float)((float)info_ptr->y_pixels_per_unit
nuclear@2 184 /(float)info_ptr->x_pixels_per_unit));
nuclear@2 185 }
nuclear@2 186 #else
nuclear@2 187 return (0.0);
nuclear@2 188 #endif
nuclear@2 189 return ((float)0.0);
nuclear@2 190 }
nuclear@2 191 #endif
nuclear@2 192
nuclear@2 193 png_int_32 PNGAPI
nuclear@2 194 png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
nuclear@2 195 {
nuclear@2 196 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 197 #if defined(PNG_oFFs_SUPPORTED)
nuclear@2 198 if (info_ptr->valid & PNG_INFO_oFFs)
nuclear@2 199 {
nuclear@2 200 png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
nuclear@2 201 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
nuclear@2 202 return (0);
nuclear@2 203 else return (info_ptr->x_offset);
nuclear@2 204 }
nuclear@2 205 #else
nuclear@2 206 return (0);
nuclear@2 207 #endif
nuclear@2 208 return (0);
nuclear@2 209 }
nuclear@2 210
nuclear@2 211 png_int_32 PNGAPI
nuclear@2 212 png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
nuclear@2 213 {
nuclear@2 214 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 215 #if defined(PNG_oFFs_SUPPORTED)
nuclear@2 216 if (info_ptr->valid & PNG_INFO_oFFs)
nuclear@2 217 {
nuclear@2 218 png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
nuclear@2 219 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
nuclear@2 220 return (0);
nuclear@2 221 else return (info_ptr->y_offset);
nuclear@2 222 }
nuclear@2 223 #else
nuclear@2 224 return (0);
nuclear@2 225 #endif
nuclear@2 226 return (0);
nuclear@2 227 }
nuclear@2 228
nuclear@2 229 png_int_32 PNGAPI
nuclear@2 230 png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
nuclear@2 231 {
nuclear@2 232 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 233 #if defined(PNG_oFFs_SUPPORTED)
nuclear@2 234 if (info_ptr->valid & PNG_INFO_oFFs)
nuclear@2 235 {
nuclear@2 236 png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
nuclear@2 237 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
nuclear@2 238 return (0);
nuclear@2 239 else return (info_ptr->x_offset);
nuclear@2 240 }
nuclear@2 241 #else
nuclear@2 242 return (0);
nuclear@2 243 #endif
nuclear@2 244 return (0);
nuclear@2 245 }
nuclear@2 246
nuclear@2 247 png_int_32 PNGAPI
nuclear@2 248 png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
nuclear@2 249 {
nuclear@2 250 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 251 #if defined(PNG_oFFs_SUPPORTED)
nuclear@2 252 if (info_ptr->valid & PNG_INFO_oFFs)
nuclear@2 253 {
nuclear@2 254 png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
nuclear@2 255 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
nuclear@2 256 return (0);
nuclear@2 257 else return (info_ptr->y_offset);
nuclear@2 258 }
nuclear@2 259 #else
nuclear@2 260 return (0);
nuclear@2 261 #endif
nuclear@2 262 return (0);
nuclear@2 263 }
nuclear@2 264
nuclear@2 265 #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
nuclear@2 266 png_uint_32 PNGAPI
nuclear@2 267 png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
nuclear@2 268 {
nuclear@2 269 return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
nuclear@2 270 *.0254 +.5));
nuclear@2 271 }
nuclear@2 272
nuclear@2 273 png_uint_32 PNGAPI
nuclear@2 274 png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
nuclear@2 275 {
nuclear@2 276 return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
nuclear@2 277 *.0254 +.5));
nuclear@2 278 }
nuclear@2 279
nuclear@2 280 png_uint_32 PNGAPI
nuclear@2 281 png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
nuclear@2 282 {
nuclear@2 283 return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
nuclear@2 284 *.0254 +.5));
nuclear@2 285 }
nuclear@2 286
nuclear@2 287 float PNGAPI
nuclear@2 288 png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
nuclear@2 289 {
nuclear@2 290 return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
nuclear@2 291 *.00003937);
nuclear@2 292 }
nuclear@2 293
nuclear@2 294 float PNGAPI
nuclear@2 295 png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
nuclear@2 296 {
nuclear@2 297 return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
nuclear@2 298 *.00003937);
nuclear@2 299 }
nuclear@2 300
nuclear@2 301 #if defined(PNG_pHYs_SUPPORTED)
nuclear@2 302 png_uint_32 PNGAPI
nuclear@2 303 png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
nuclear@2 304 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
nuclear@2 305 {
nuclear@2 306 png_uint_32 retval = 0;
nuclear@2 307
nuclear@2 308 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
nuclear@2 309 {
nuclear@2 310 png_debug1(1, "in %s retrieval function\n", "pHYs");
nuclear@2 311 if (res_x != NULL)
nuclear@2 312 {
nuclear@2 313 *res_x = info_ptr->x_pixels_per_unit;
nuclear@2 314 retval |= PNG_INFO_pHYs;
nuclear@2 315 }
nuclear@2 316 if (res_y != NULL)
nuclear@2 317 {
nuclear@2 318 *res_y = info_ptr->y_pixels_per_unit;
nuclear@2 319 retval |= PNG_INFO_pHYs;
nuclear@2 320 }
nuclear@2 321 if (unit_type != NULL)
nuclear@2 322 {
nuclear@2 323 *unit_type = (int)info_ptr->phys_unit_type;
nuclear@2 324 retval |= PNG_INFO_pHYs;
nuclear@2 325 if (*unit_type == 1)
nuclear@2 326 {
nuclear@2 327 if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
nuclear@2 328 if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
nuclear@2 329 }
nuclear@2 330 }
nuclear@2 331 }
nuclear@2 332 return (retval);
nuclear@2 333 }
nuclear@2 334 #endif /* PNG_pHYs_SUPPORTED */
nuclear@2 335 #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
nuclear@2 336
nuclear@2 337 /* png_get_channels really belongs in here, too, but it's been around longer */
nuclear@2 338
nuclear@2 339 #endif /* PNG_EASY_ACCESS_SUPPORTED */
nuclear@2 340
nuclear@2 341 png_byte PNGAPI
nuclear@2 342 png_get_channels(png_structp png_ptr, png_infop info_ptr)
nuclear@2 343 {
nuclear@2 344 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 345 return(info_ptr->channels);
nuclear@2 346 else
nuclear@2 347 return (0);
nuclear@2 348 }
nuclear@2 349
nuclear@2 350 png_bytep PNGAPI
nuclear@2 351 png_get_signature(png_structp png_ptr, png_infop info_ptr)
nuclear@2 352 {
nuclear@2 353 if (png_ptr != NULL && info_ptr != NULL)
nuclear@2 354 return(info_ptr->signature);
nuclear@2 355 else
nuclear@2 356 return (NULL);
nuclear@2 357 }
nuclear@2 358
nuclear@2 359 #if defined(PNG_bKGD_SUPPORTED)
nuclear@2 360 png_uint_32 PNGAPI
nuclear@2 361 png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
nuclear@2 362 png_color_16p *background)
nuclear@2 363 {
nuclear@2 364 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
nuclear@2 365 && background != NULL)
nuclear@2 366 {
nuclear@2 367 png_debug1(1, "in %s retrieval function\n", "bKGD");
nuclear@2 368 *background = &(info_ptr->background);
nuclear@2 369 return (PNG_INFO_bKGD);
nuclear@2 370 }
nuclear@2 371 return (0);
nuclear@2 372 }
nuclear@2 373 #endif
nuclear@2 374
nuclear@2 375 #if defined(PNG_cHRM_SUPPORTED)
nuclear@2 376 #ifdef PNG_FLOATING_POINT_SUPPORTED
nuclear@2 377 png_uint_32 PNGAPI
nuclear@2 378 png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
nuclear@2 379 double *white_x, double *white_y, double *red_x, double *red_y,
nuclear@2 380 double *green_x, double *green_y, double *blue_x, double *blue_y)
nuclear@2 381 {
nuclear@2 382 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
nuclear@2 383 {
nuclear@2 384 png_debug1(1, "in %s retrieval function\n", "cHRM");
nuclear@2 385 if (white_x != NULL)
nuclear@2 386 *white_x = (double)info_ptr->x_white;
nuclear@2 387 if (white_y != NULL)
nuclear@2 388 *white_y = (double)info_ptr->y_white;
nuclear@2 389 if (red_x != NULL)
nuclear@2 390 *red_x = (double)info_ptr->x_red;
nuclear@2 391 if (red_y != NULL)
nuclear@2 392 *red_y = (double)info_ptr->y_red;
nuclear@2 393 if (green_x != NULL)
nuclear@2 394 *green_x = (double)info_ptr->x_green;
nuclear@2 395 if (green_y != NULL)
nuclear@2 396 *green_y = (double)info_ptr->y_green;
nuclear@2 397 if (blue_x != NULL)
nuclear@2 398 *blue_x = (double)info_ptr->x_blue;
nuclear@2 399 if (blue_y != NULL)
nuclear@2 400 *blue_y = (double)info_ptr->y_blue;
nuclear@2 401 return (PNG_INFO_cHRM);
nuclear@2 402 }
nuclear@2 403 return (0);
nuclear@2 404 }
nuclear@2 405 #endif
nuclear@2 406 #ifdef PNG_FIXED_POINT_SUPPORTED
nuclear@2 407 png_uint_32 PNGAPI
nuclear@2 408 png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
nuclear@2 409 png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
nuclear@2 410 png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
nuclear@2 411 png_fixed_point *blue_x, png_fixed_point *blue_y)
nuclear@2 412 {
nuclear@2 413 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
nuclear@2 414 {
nuclear@2 415 png_debug1(1, "in %s retrieval function\n", "cHRM");
nuclear@2 416 if (white_x != NULL)
nuclear@2 417 *white_x = info_ptr->int_x_white;
nuclear@2 418 if (white_y != NULL)
nuclear@2 419 *white_y = info_ptr->int_y_white;
nuclear@2 420 if (red_x != NULL)
nuclear@2 421 *red_x = info_ptr->int_x_red;
nuclear@2 422 if (red_y != NULL)
nuclear@2 423 *red_y = info_ptr->int_y_red;
nuclear@2 424 if (green_x != NULL)
nuclear@2 425 *green_x = info_ptr->int_x_green;
nuclear@2 426 if (green_y != NULL)
nuclear@2 427 *green_y = info_ptr->int_y_green;
nuclear@2 428 if (blue_x != NULL)
nuclear@2 429 *blue_x = info_ptr->int_x_blue;
nuclear@2 430 if (blue_y != NULL)
nuclear@2 431 *blue_y = info_ptr->int_y_blue;
nuclear@2 432 return (PNG_INFO_cHRM);
nuclear@2 433 }
nuclear@2 434 return (0);
nuclear@2 435 }
nuclear@2 436 #endif
nuclear@2 437 #endif
nuclear@2 438
nuclear@2 439 #if defined(PNG_gAMA_SUPPORTED)
nuclear@2 440 #ifdef PNG_FLOATING_POINT_SUPPORTED
nuclear@2 441 png_uint_32 PNGAPI
nuclear@2 442 png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
nuclear@2 443 {
nuclear@2 444 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
nuclear@2 445 && file_gamma != NULL)
nuclear@2 446 {
nuclear@2 447 png_debug1(1, "in %s retrieval function\n", "gAMA");
nuclear@2 448 *file_gamma = (double)info_ptr->gamma;
nuclear@2 449 return (PNG_INFO_gAMA);
nuclear@2 450 }
nuclear@2 451 return (0);
nuclear@2 452 }
nuclear@2 453 #endif
nuclear@2 454 #ifdef PNG_FIXED_POINT_SUPPORTED
nuclear@2 455 png_uint_32 PNGAPI
nuclear@2 456 png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
nuclear@2 457 png_fixed_point *int_file_gamma)
nuclear@2 458 {
nuclear@2 459 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
nuclear@2 460 && int_file_gamma != NULL)
nuclear@2 461 {
nuclear@2 462 png_debug1(1, "in %s retrieval function\n", "gAMA");
nuclear@2 463 *int_file_gamma = info_ptr->int_gamma;
nuclear@2 464 return (PNG_INFO_gAMA);
nuclear@2 465 }
nuclear@2 466 return (0);
nuclear@2 467 }
nuclear@2 468 #endif
nuclear@2 469 #endif
nuclear@2 470
nuclear@2 471 #if defined(PNG_sRGB_SUPPORTED)
nuclear@2 472 png_uint_32 PNGAPI
nuclear@2 473 png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
nuclear@2 474 {
nuclear@2 475 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
nuclear@2 476 && file_srgb_intent != NULL)
nuclear@2 477 {
nuclear@2 478 png_debug1(1, "in %s retrieval function\n", "sRGB");
nuclear@2 479 *file_srgb_intent = (int)info_ptr->srgb_intent;
nuclear@2 480 return (PNG_INFO_sRGB);
nuclear@2 481 }
nuclear@2 482 return (0);
nuclear@2 483 }
nuclear@2 484 #endif
nuclear@2 485
nuclear@2 486 #if defined(PNG_iCCP_SUPPORTED)
nuclear@2 487 png_uint_32 PNGAPI
nuclear@2 488 png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
nuclear@2 489 png_charpp name, int *compression_type,
nuclear@2 490 png_charpp profile, png_uint_32 *proflen)
nuclear@2 491 {
nuclear@2 492 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
nuclear@2 493 && name != NULL && profile != NULL && proflen != NULL)
nuclear@2 494 {
nuclear@2 495 png_debug1(1, "in %s retrieval function\n", "iCCP");
nuclear@2 496 *name = info_ptr->iccp_name;
nuclear@2 497 *profile = info_ptr->iccp_profile;
nuclear@2 498 /* compression_type is a dummy so the API won't have to change
nuclear@2 499 if we introduce multiple compression types later. */
nuclear@2 500 *proflen = (int)info_ptr->iccp_proflen;
nuclear@2 501 *compression_type = (int)info_ptr->iccp_compression;
nuclear@2 502 return (PNG_INFO_iCCP);
nuclear@2 503 }
nuclear@2 504 return (0);
nuclear@2 505 }
nuclear@2 506 #endif
nuclear@2 507
nuclear@2 508 #if defined(PNG_sPLT_SUPPORTED)
nuclear@2 509 png_uint_32 PNGAPI
nuclear@2 510 png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
nuclear@2 511 png_sPLT_tpp spalettes)
nuclear@2 512 {
nuclear@2 513 if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
nuclear@2 514 {
nuclear@2 515 *spalettes = info_ptr->splt_palettes;
nuclear@2 516 return ((png_uint_32)info_ptr->splt_palettes_num);
nuclear@2 517 }
nuclear@2 518 return (0);
nuclear@2 519 }
nuclear@2 520 #endif
nuclear@2 521
nuclear@2 522 #if defined(PNG_hIST_SUPPORTED)
nuclear@2 523 png_uint_32 PNGAPI
nuclear@2 524 png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
nuclear@2 525 {
nuclear@2 526 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
nuclear@2 527 && hist != NULL)
nuclear@2 528 {
nuclear@2 529 png_debug1(1, "in %s retrieval function\n", "hIST");
nuclear@2 530 *hist = info_ptr->hist;
nuclear@2 531 return (PNG_INFO_hIST);
nuclear@2 532 }
nuclear@2 533 return (0);
nuclear@2 534 }
nuclear@2 535 #endif
nuclear@2 536
nuclear@2 537 png_uint_32 PNGAPI
nuclear@2 538 png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
nuclear@2 539 png_uint_32 *width, png_uint_32 *height, int *bit_depth,
nuclear@2 540 int *color_type, int *interlace_type, int *compression_type,
nuclear@2 541 int *filter_type)
nuclear@2 542
nuclear@2 543 {
nuclear@2 544 if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
nuclear@2 545 bit_depth != NULL && color_type != NULL)
nuclear@2 546 {
nuclear@2 547 png_debug1(1, "in %s retrieval function\n", "IHDR");
nuclear@2 548 *width = info_ptr->width;
nuclear@2 549 *height = info_ptr->height;
nuclear@2 550 *bit_depth = info_ptr->bit_depth;
nuclear@2 551 if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
nuclear@2 552 png_error(png_ptr, "Invalid bit depth");
nuclear@2 553 *color_type = info_ptr->color_type;
nuclear@2 554 if (info_ptr->color_type > 6)
nuclear@2 555 png_error(png_ptr, "Invalid color type");
nuclear@2 556 if (compression_type != NULL)
nuclear@2 557 *compression_type = info_ptr->compression_type;
nuclear@2 558 if (filter_type != NULL)
nuclear@2 559 *filter_type = info_ptr->filter_type;
nuclear@2 560 if (interlace_type != NULL)
nuclear@2 561 *interlace_type = info_ptr->interlace_type;
nuclear@2 562
nuclear@2 563 /* check for potential overflow of rowbytes */
nuclear@2 564 if (*width == 0 || *width > PNG_UINT_31_MAX)
nuclear@2 565 png_error(png_ptr, "Invalid image width");
nuclear@2 566 if (*height == 0 || *height > PNG_UINT_31_MAX)
nuclear@2 567 png_error(png_ptr, "Invalid image height");
nuclear@2 568 if (info_ptr->width > (PNG_UINT_32_MAX
nuclear@2 569 >> 3) /* 8-byte RGBA pixels */
nuclear@2 570 - 64 /* bigrowbuf hack */
nuclear@2 571 - 1 /* filter byte */
nuclear@2 572 - 7*8 /* rounding of width to multiple of 8 pixels */
nuclear@2 573 - 8) /* extra max_pixel_depth pad */
nuclear@2 574 {
nuclear@2 575 png_warning(png_ptr,
nuclear@2 576 "Width too large for libpng to process image data.");
nuclear@2 577 }
nuclear@2 578 return (1);
nuclear@2 579 }
nuclear@2 580 return (0);
nuclear@2 581 }
nuclear@2 582
nuclear@2 583 #if defined(PNG_oFFs_SUPPORTED)
nuclear@2 584 png_uint_32 PNGAPI
nuclear@2 585 png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
nuclear@2 586 png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
nuclear@2 587 {
nuclear@2 588 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
nuclear@2 589 && offset_x != NULL && offset_y != NULL && unit_type != NULL)
nuclear@2 590 {
nuclear@2 591 png_debug1(1, "in %s retrieval function\n", "oFFs");
nuclear@2 592 *offset_x = info_ptr->x_offset;
nuclear@2 593 *offset_y = info_ptr->y_offset;
nuclear@2 594 *unit_type = (int)info_ptr->offset_unit_type;
nuclear@2 595 return (PNG_INFO_oFFs);
nuclear@2 596 }
nuclear@2 597 return (0);
nuclear@2 598 }
nuclear@2 599 #endif
nuclear@2 600
nuclear@2 601 #if defined(PNG_pCAL_SUPPORTED)
nuclear@2 602 png_uint_32 PNGAPI
nuclear@2 603 png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
nuclear@2 604 png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
nuclear@2 605 png_charp *units, png_charpp *params)
nuclear@2 606 {
nuclear@2 607 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
nuclear@2 608 && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nuclear@2 609 nparams != NULL && units != NULL && params != NULL)
nuclear@2 610 {
nuclear@2 611 png_debug1(1, "in %s retrieval function\n", "pCAL");
nuclear@2 612 *purpose = info_ptr->pcal_purpose;
nuclear@2 613 *X0 = info_ptr->pcal_X0;
nuclear@2 614 *X1 = info_ptr->pcal_X1;
nuclear@2 615 *type = (int)info_ptr->pcal_type;
nuclear@2 616 *nparams = (int)info_ptr->pcal_nparams;
nuclear@2 617 *units = info_ptr->pcal_units;
nuclear@2 618 *params = info_ptr->pcal_params;
nuclear@2 619 return (PNG_INFO_pCAL);
nuclear@2 620 }
nuclear@2 621 return (0);
nuclear@2 622 }
nuclear@2 623 #endif
nuclear@2 624
nuclear@2 625 #if defined(PNG_sCAL_SUPPORTED)
nuclear@2 626 #ifdef PNG_FLOATING_POINT_SUPPORTED
nuclear@2 627 png_uint_32 PNGAPI
nuclear@2 628 png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
nuclear@2 629 int *unit, double *width, double *height)
nuclear@2 630 {
nuclear@2 631 if (png_ptr != NULL && info_ptr != NULL &&
nuclear@2 632 (info_ptr->valid & PNG_INFO_sCAL))
nuclear@2 633 {
nuclear@2 634 *unit = info_ptr->scal_unit;
nuclear@2 635 *width = info_ptr->scal_pixel_width;
nuclear@2 636 *height = info_ptr->scal_pixel_height;
nuclear@2 637 return (PNG_INFO_sCAL);
nuclear@2 638 }
nuclear@2 639 return(0);
nuclear@2 640 }
nuclear@2 641 #else
nuclear@2 642 #ifdef PNG_FIXED_POINT_SUPPORTED
nuclear@2 643 png_uint_32 PNGAPI
nuclear@2 644 png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
nuclear@2 645 int *unit, png_charpp width, png_charpp height)
nuclear@2 646 {
nuclear@2 647 if (png_ptr != NULL && info_ptr != NULL &&
nuclear@2 648 (info_ptr->valid & PNG_INFO_sCAL))
nuclear@2 649 {
nuclear@2 650 *unit = info_ptr->scal_unit;
nuclear@2 651 *width = info_ptr->scal_s_width;
nuclear@2 652 *height = info_ptr->scal_s_height;
nuclear@2 653 return (PNG_INFO_sCAL);
nuclear@2 654 }
nuclear@2 655 return(0);
nuclear@2 656 }
nuclear@2 657 #endif
nuclear@2 658 #endif
nuclear@2 659 #endif
nuclear@2 660
nuclear@2 661 #if defined(PNG_pHYs_SUPPORTED)
nuclear@2 662 png_uint_32 PNGAPI
nuclear@2 663 png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
nuclear@2 664 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
nuclear@2 665 {
nuclear@2 666 png_uint_32 retval = 0;
nuclear@2 667
nuclear@2 668 if (png_ptr != NULL && info_ptr != NULL &&
nuclear@2 669 (info_ptr->valid & PNG_INFO_pHYs))
nuclear@2 670 {
nuclear@2 671 png_debug1(1, "in %s retrieval function\n", "pHYs");
nuclear@2 672 if (res_x != NULL)
nuclear@2 673 {
nuclear@2 674 *res_x = info_ptr->x_pixels_per_unit;
nuclear@2 675 retval |= PNG_INFO_pHYs;
nuclear@2 676 }
nuclear@2 677 if (res_y != NULL)
nuclear@2 678 {
nuclear@2 679 *res_y = info_ptr->y_pixels_per_unit;
nuclear@2 680 retval |= PNG_INFO_pHYs;
nuclear@2 681 }
nuclear@2 682 if (unit_type != NULL)
nuclear@2 683 {
nuclear@2 684 *unit_type = (int)info_ptr->phys_unit_type;
nuclear@2 685 retval |= PNG_INFO_pHYs;
nuclear@2 686 }
nuclear@2 687 }
nuclear@2 688 return (retval);
nuclear@2 689 }
nuclear@2 690 #endif
nuclear@2 691
nuclear@2 692 png_uint_32 PNGAPI
nuclear@2 693 png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
nuclear@2 694 int *num_palette)
nuclear@2 695 {
nuclear@2 696 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
nuclear@2 697 && palette != NULL)
nuclear@2 698 {
nuclear@2 699 png_debug1(1, "in %s retrieval function\n", "PLTE");
nuclear@2 700 *palette = info_ptr->palette;
nuclear@2 701 *num_palette = info_ptr->num_palette;
nuclear@2 702 png_debug1(3, "num_palette = %d\n", *num_palette);
nuclear@2 703 return (PNG_INFO_PLTE);
nuclear@2 704 }
nuclear@2 705 return (0);
nuclear@2 706 }
nuclear@2 707
nuclear@2 708 #if defined(PNG_sBIT_SUPPORTED)
nuclear@2 709 png_uint_32 PNGAPI
nuclear@2 710 png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
nuclear@2 711 {
nuclear@2 712 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
nuclear@2 713 && sig_bit != NULL)
nuclear@2 714 {
nuclear@2 715 png_debug1(1, "in %s retrieval function\n", "sBIT");
nuclear@2 716 *sig_bit = &(info_ptr->sig_bit);
nuclear@2 717 return (PNG_INFO_sBIT);
nuclear@2 718 }
nuclear@2 719 return (0);
nuclear@2 720 }
nuclear@2 721 #endif
nuclear@2 722
nuclear@2 723 #if defined(PNG_TEXT_SUPPORTED)
nuclear@2 724 png_uint_32 PNGAPI
nuclear@2 725 png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
nuclear@2 726 int *num_text)
nuclear@2 727 {
nuclear@2 728 if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
nuclear@2 729 {
nuclear@2 730 png_debug1(1, "in %s retrieval function\n",
nuclear@2 731 (png_ptr->chunk_name[0] == '\0' ? "text"
nuclear@2 732 : (png_const_charp)png_ptr->chunk_name));
nuclear@2 733 if (text_ptr != NULL)
nuclear@2 734 *text_ptr = info_ptr->text;
nuclear@2 735 if (num_text != NULL)
nuclear@2 736 *num_text = info_ptr->num_text;
nuclear@2 737 return ((png_uint_32)info_ptr->num_text);
nuclear@2 738 }
nuclear@2 739 if (num_text != NULL)
nuclear@2 740 *num_text = 0;
nuclear@2 741 return(0);
nuclear@2 742 }
nuclear@2 743 #endif
nuclear@2 744
nuclear@2 745 #if defined(PNG_tIME_SUPPORTED)
nuclear@2 746 png_uint_32 PNGAPI
nuclear@2 747 png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
nuclear@2 748 {
nuclear@2 749 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
nuclear@2 750 && mod_time != NULL)
nuclear@2 751 {
nuclear@2 752 png_debug1(1, "in %s retrieval function\n", "tIME");
nuclear@2 753 *mod_time = &(info_ptr->mod_time);
nuclear@2 754 return (PNG_INFO_tIME);
nuclear@2 755 }
nuclear@2 756 return (0);
nuclear@2 757 }
nuclear@2 758 #endif
nuclear@2 759
nuclear@2 760 #if defined(PNG_tRNS_SUPPORTED)
nuclear@2 761 png_uint_32 PNGAPI
nuclear@2 762 png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
nuclear@2 763 png_bytep *trans, int *num_trans, png_color_16p *trans_values)
nuclear@2 764 {
nuclear@2 765 png_uint_32 retval = 0;
nuclear@2 766 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
nuclear@2 767 {
nuclear@2 768 png_debug1(1, "in %s retrieval function\n", "tRNS");
nuclear@2 769 if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
nuclear@2 770 {
nuclear@2 771 if (trans != NULL)
nuclear@2 772 {
nuclear@2 773 *trans = info_ptr->trans;
nuclear@2 774 retval |= PNG_INFO_tRNS;
nuclear@2 775 }
nuclear@2 776 if (trans_values != NULL)
nuclear@2 777 *trans_values = &(info_ptr->trans_values);
nuclear@2 778 }
nuclear@2 779 else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
nuclear@2 780 {
nuclear@2 781 if (trans_values != NULL)
nuclear@2 782 {
nuclear@2 783 *trans_values = &(info_ptr->trans_values);
nuclear@2 784 retval |= PNG_INFO_tRNS;
nuclear@2 785 }
nuclear@2 786 if (trans != NULL)
nuclear@2 787 *trans = NULL;
nuclear@2 788 }
nuclear@2 789 if (num_trans != NULL)
nuclear@2 790 {
nuclear@2 791 *num_trans = info_ptr->num_trans;
nuclear@2 792 retval |= PNG_INFO_tRNS;
nuclear@2 793 }
nuclear@2 794 }
nuclear@2 795 return (retval);
nuclear@2 796 }
nuclear@2 797 #endif
nuclear@2 798
nuclear@2 799 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
nuclear@2 800 png_uint_32 PNGAPI
nuclear@2 801 png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
nuclear@2 802 png_unknown_chunkpp unknowns)
nuclear@2 803 {
nuclear@2 804 if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
nuclear@2 805 {
nuclear@2 806 *unknowns = info_ptr->unknown_chunks;
nuclear@2 807 return ((png_uint_32)info_ptr->unknown_chunks_num);
nuclear@2 808 }
nuclear@2 809 return (0);
nuclear@2 810 }
nuclear@2 811 #endif
nuclear@2 812
nuclear@2 813 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
nuclear@2 814 png_byte PNGAPI
nuclear@2 815 png_get_rgb_to_gray_status (png_structp png_ptr)
nuclear@2 816 {
nuclear@2 817 return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
nuclear@2 818 }
nuclear@2 819 #endif
nuclear@2 820
nuclear@2 821 #if defined(PNG_USER_CHUNKS_SUPPORTED)
nuclear@2 822 png_voidp PNGAPI
nuclear@2 823 png_get_user_chunk_ptr(png_structp png_ptr)
nuclear@2 824 {
nuclear@2 825 return (png_ptr? png_ptr->user_chunk_ptr : NULL);
nuclear@2 826 }
nuclear@2 827 #endif
nuclear@2 828
nuclear@2 829 #ifdef PNG_WRITE_SUPPORTED
nuclear@2 830 png_uint_32 PNGAPI
nuclear@2 831 png_get_compression_buffer_size(png_structp png_ptr)
nuclear@2 832 {
nuclear@2 833 return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
nuclear@2 834 }
nuclear@2 835 #endif
nuclear@2 836
nuclear@2 837 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED
nuclear@2 838 #ifndef PNG_1_0_X
nuclear@2 839 /* this function was added to libpng 1.2.0 and should exist by default */
nuclear@2 840 png_uint_32 PNGAPI
nuclear@2 841 png_get_asm_flags (png_structp png_ptr)
nuclear@2 842 {
nuclear@2 843 /* obsolete, to be removed from libpng-1.4.0 */
nuclear@2 844 return (png_ptr? 0L: 0L);
nuclear@2 845 }
nuclear@2 846
nuclear@2 847 /* this function was added to libpng 1.2.0 and should exist by default */
nuclear@2 848 png_uint_32 PNGAPI
nuclear@2 849 png_get_asm_flagmask (int flag_select)
nuclear@2 850 {
nuclear@2 851 /* obsolete, to be removed from libpng-1.4.0 */
nuclear@2 852 flag_select=flag_select;
nuclear@2 853 return 0L;
nuclear@2 854 }
nuclear@2 855
nuclear@2 856 /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
nuclear@2 857 /* this function was added to libpng 1.2.0 */
nuclear@2 858 png_uint_32 PNGAPI
nuclear@2 859 png_get_mmx_flagmask (int flag_select, int *compilerID)
nuclear@2 860 {
nuclear@2 861 /* obsolete, to be removed from libpng-1.4.0 */
nuclear@2 862 flag_select=flag_select;
nuclear@2 863 *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
nuclear@2 864 return 0L;
nuclear@2 865 }
nuclear@2 866
nuclear@2 867 /* this function was added to libpng 1.2.0 */
nuclear@2 868 png_byte PNGAPI
nuclear@2 869 png_get_mmx_bitdepth_threshold (png_structp png_ptr)
nuclear@2 870 {
nuclear@2 871 /* obsolete, to be removed from libpng-1.4.0 */
nuclear@2 872 return (png_ptr? 0: 0);
nuclear@2 873 }
nuclear@2 874
nuclear@2 875 /* this function was added to libpng 1.2.0 */
nuclear@2 876 png_uint_32 PNGAPI
nuclear@2 877 png_get_mmx_rowbytes_threshold (png_structp png_ptr)
nuclear@2 878 {
nuclear@2 879 /* obsolete, to be removed from libpng-1.4.0 */
nuclear@2 880 return (png_ptr? 0L: 0L);
nuclear@2 881 }
nuclear@2 882 #endif /* ?PNG_1_0_X */
nuclear@2 883 #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
nuclear@2 884
nuclear@2 885 #ifdef PNG_SET_USER_LIMITS_SUPPORTED
nuclear@2 886 /* these functions were added to libpng 1.2.6 */
nuclear@2 887 png_uint_32 PNGAPI
nuclear@2 888 png_get_user_width_max (png_structp png_ptr)
nuclear@2 889 {
nuclear@2 890 return (png_ptr? png_ptr->user_width_max : 0);
nuclear@2 891 }
nuclear@2 892 png_uint_32 PNGAPI
nuclear@2 893 png_get_user_height_max (png_structp png_ptr)
nuclear@2 894 {
nuclear@2 895 return (png_ptr? png_ptr->user_height_max : 0);
nuclear@2 896 }
nuclear@2 897 #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
nuclear@2 898
nuclear@2 899
nuclear@2 900 #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */