3dphotoshoot

annotate libs/libpng/pngget.c @ 17:aef7f51f6397

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