istereo

annotate libs/libpng/pngget.c @ 35:23e5d274b2a2

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