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