Prusa MINI Firmware overview
|
#include "pngpriv.h"
#include <errno.h>
|
#define | UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+((alpha)>>1))/(alpha)) |
|
|
static void | write_unknown_chunks (png_structrp png_ptr, png_const_inforp info_ptr, unsigned int where) |
|
void PNGAPI | png_write_info_before_PLTE (png_structrp png_ptr, png_const_inforp info_ptr) |
|
void PNGAPI | png_write_info (png_structrp png_ptr, png_const_inforp info_ptr) |
|
void PNGAPI | png_write_end (png_structrp png_ptr, png_inforp info_ptr) |
|
void PNGAPI | png_convert_from_struct_tm (png_timep ptime, const struct tm *ttime) |
|
void PNGAPI | png_convert_from_time_t (png_timep ptime, time_t ttime) |
|
| PNG_FUNCTION (png_structp, PNGAPI png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn), PNG_ALLOCATED) |
|
| PNG_FUNCTION (png_structp, PNGAPI png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), PNG_ALLOCATED) |
|
void PNGAPI | png_write_rows (png_structrp png_ptr, png_bytepp row, png_uint_32 num_rows) |
|
void PNGAPI | png_write_image (png_structrp png_ptr, png_bytepp image) |
|
static void | png_do_write_intrapixel (png_row_infop row_info, png_bytep row) |
|
void PNGAPI | png_write_row (png_structrp png_ptr, png_const_bytep row) |
|
void PNGAPI | png_set_flush (png_structrp png_ptr, int nrows) |
|
void PNGAPI | png_write_flush (png_structrp png_ptr) |
|
static void | png_write_destroy (png_structrp png_ptr) |
|
void PNGAPI | png_destroy_write_struct (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) |
|
void PNGAPI | png_set_filter (png_structrp png_ptr, int method, int filters) |
|
void PNGAPI | png_set_filter_heuristics (png_structrp png_ptr, int heuristic_method, int num_weights, png_const_doublep filter_weights, png_const_doublep filter_costs) |
|
void PNGAPI | png_set_filter_heuristics_fixed (png_structrp png_ptr, int heuristic_method, int num_weights, png_const_fixed_point_p filter_weights, png_const_fixed_point_p filter_costs) |
|
void PNGAPI | png_set_compression_level (png_structrp png_ptr, int level) |
|
void PNGAPI | png_set_compression_mem_level (png_structrp png_ptr, int mem_level) |
|
void PNGAPI | png_set_compression_strategy (png_structrp png_ptr, int strategy) |
|
void PNGAPI | png_set_compression_window_bits (png_structrp png_ptr, int window_bits) |
|
void PNGAPI | png_set_compression_method (png_structrp png_ptr, int method) |
|
void PNGAPI | png_set_text_compression_level (png_structrp png_ptr, int level) |
|
void PNGAPI | png_set_text_compression_mem_level (png_structrp png_ptr, int mem_level) |
|
void PNGAPI | png_set_text_compression_strategy (png_structrp png_ptr, int strategy) |
|
void PNGAPI | png_set_text_compression_window_bits (png_structrp png_ptr, int window_bits) |
|
void PNGAPI | png_set_text_compression_method (png_structrp png_ptr, int method) |
|
void PNGAPI | png_set_write_status_fn (png_structrp png_ptr, png_write_status_ptr write_row_fn) |
|
void PNGAPI | png_set_write_user_transform_fn (png_structrp png_ptr, png_user_transform_ptr write_user_transform_fn) |
|
void PNGAPI | png_write_png (png_structrp png_ptr, png_inforp info_ptr, int transforms, voidp params) |
|
static int | png_image_write_init (png_imagep image) |
|
static int | png_write_image_16bit (png_voidp argument) |
|
static png_byte | png_unpremultiply (png_uint_32 component, png_uint_32 alpha, png_uint_32 reciprocal) |
|
static int | png_write_image_8bit (png_voidp argument) |
|
static void | png_image_set_PLTE (png_image_write_control *display) |
|
static int | png_image_write_main (png_voidp argument) |
|
static | void (PNGCBAPI image_memory_write)(png_structp png_ptr |
|
| if (size<=((png_alloc_size_t) -1) - ob) |
|
else | png_error (png_ptr, "png_image_write_to_memory: PNG too big") |
|
static int | png_image_write_memory (png_voidp argument) |
|
int PNGAPI | png_image_write_to_memory (png_imagep image, void *memory, png_alloc_size_t *PNG_RESTRICT memory_bytes, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) |
|
int PNGAPI | png_image_write_to_stdio (png_imagep image, FILE *file, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) |
|
int PNGAPI | png_image_write_to_file (png_imagep image, const char *file_name, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) |
|
◆ UNP_RECIPROCAL
#define UNP_RECIPROCAL |
( |
|
alpha | ) |
((((0xffff*0xff)<<7)+((alpha)>>1))/(alpha)) |
◆ write_unknown_chunks()
27 if (
info_ptr->unknown_chunks_num != 0)
34 up < info_ptr->unknown_chunks +
info_ptr->unknown_chunks_num;
36 if ((up->location & where) != 0)
41 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
57 ((up->name[3] & 0x20) ||
◆ png_write_info_before_PLTE()
86 png_debug(1,
"in png_write_info_before_PLTE");
96 #ifdef PNG_MNG_FEATURES_SUPPORTED
98 png_ptr->mng_features_permitted != 0)
101 "MNG features are not allowed in a PNG datastream");
102 png_ptr->mng_features_permitted = 0;
131 #ifdef PNG_GAMMA_SUPPORTED
132 # ifdef PNG_WRITE_gAMA_SUPPORTED
133 if ((
info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
134 (
info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA) != 0 &&
140 #ifdef PNG_COLORSPACE_SUPPORTED
144 # ifdef PNG_WRITE_iCCP_SUPPORTED
145 if ((
info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
148 # ifdef PNG_WRITE_sRGB_SUPPORTED
151 "profile matches sRGB but writing iCCP instead");
157 # ifdef PNG_WRITE_sRGB_SUPPORTED
162 # ifdef PNG_WRITE_sRGB_SUPPORTED
163 if ((
info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
169 #ifdef PNG_WRITE_sBIT_SUPPORTED
174 #ifdef PNG_COLORSPACE_SUPPORTED
175 # ifdef PNG_WRITE_cHRM_SUPPORTED
176 if ((
info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
177 (
info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
183 #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
◆ png_write_info()
194 #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
212 #ifdef PNG_WRITE_tRNS_SUPPORTED
215 #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
226 for (j = 0; j<jend; ++j)
228 (png_byte)(255 -
info_ptr->trans_alpha[j]);
235 #ifdef PNG_WRITE_bKGD_SUPPORTED
240 #ifdef PNG_WRITE_eXIf_SUPPORTED
245 #ifdef PNG_WRITE_hIST_SUPPORTED
250 #ifdef PNG_WRITE_oFFs_SUPPORTED
256 #ifdef PNG_WRITE_pCAL_SUPPORTED
263 #ifdef PNG_WRITE_sCAL_SUPPORTED
269 #ifdef PNG_WRITE_pHYs_SUPPORTED
275 #ifdef PNG_WRITE_tIME_SUPPORTED
283 #ifdef PNG_WRITE_sPLT_SUPPORTED
289 #ifdef PNG_WRITE_TEXT_SUPPORTED
293 png_debug2(2,
"Writing header text chunk %d, type %d",
i,
298 #ifdef PNG_WRITE_iTXt_SUPPORTED
319 #ifdef PNG_WRITE_zTXt_SUPPORTED
332 #ifdef PNG_WRITE_tEXt_SUPPORTED
347 #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
◆ png_write_end()
368 #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
376 #ifdef PNG_WRITE_TEXT_SUPPORTED
379 #ifdef PNG_WRITE_tIME_SUPPORTED
386 #ifdef PNG_WRITE_TEXT_SUPPORTED
390 png_debug2(2,
"Writing trailer text chunk %d, type %d",
i,
395 #ifdef PNG_WRITE_iTXt_SUPPORTED
415 #ifdef PNG_WRITE_zTXt_SUPPORTED
428 #ifdef PNG_WRITE_tEXt_SUPPORTED
441 #ifdef PNG_WRITE_eXIf_SUPPORTED
446 #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
463 #ifdef PNG_WRITE_FLUSH_SUPPORTED
464 # ifdef PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED
◆ png_convert_from_struct_tm()
474 png_debug(1,
"in png_convert_from_struct_tm");
477 ptime->
month = (png_byte)(ttime->tm_mon + 1);
478 ptime->
day = (png_byte)ttime->tm_mday;
479 ptime->
hour = (png_byte)ttime->tm_hour;
480 ptime->
minute = (png_byte)ttime->tm_min;
481 ptime->
second = (png_byte)ttime->tm_sec;
◆ png_convert_from_time_t()
489 png_debug(1,
"in png_convert_from_time_t");
491 tbuf = gmtime(&ttime);
◆ PNG_FUNCTION() [1/2]
501 #ifndef PNG_USER_MEM_SUPPORTED
505 return png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
◆ PNG_FUNCTION() [2/2]
516 error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
532 png_ptr->zlib_window_bits = 15;
535 #ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
538 png_ptr->zlib_text_mem_level = 8;
539 png_ptr->zlib_text_window_bits = 15;
548 #ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
558 #if PNG_RELEASE_BUILD
◆ png_write_rows()
591 for (
i = 0, rp = row;
i < num_rows;
i++, rp++)
◆ png_write_image()
612 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
621 for (pass = 0; pass < num_pass; pass++)
624 for (
i = 0, rp = image;
i <
png_ptr->height;
i++, rp++)
◆ png_do_write_intrapixel()
636 png_debug(1,
"in png_do_write_intrapixel");
656 for (
i = 0, rp = row;
i < row_width;
i++, rp += bytes_per_pixel)
658 *(rp) = (png_byte)(*rp - *(rp + 1));
659 *(rp + 2) = (png_byte)(*(rp + 2) - *(rp + 1));
663 #ifdef PNG_WRITE_16BIT_SUPPORTED
678 for (
i = 0, rp = row;
i < row_width;
i++, rp += bytes_per_pixel)
685 *(rp ) = (png_byte)(
red >> 8);
686 *(rp + 1) = (png_byte)
red;
687 *(rp + 4) = (png_byte)(blue >> 8);
688 *(rp + 5) = (png_byte)blue;
◆ png_write_row()
706 png_debug2(1,
"in png_write_row (row %u, pass %d)",
715 "png_write_info was never called before png_write_row");
718 #if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
723 #if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED)
727 #if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
728 defined(PNG_READ_PACKSWAP_SUPPORTED)
731 "PNG_WRITE_PACKSWAP_SUPPORTED is not defined");
734 #if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED)
739 #if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED)
744 #if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED)
749 #if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED)
757 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
759 if (
png_ptr->interlaced != 0 &&
765 if ((
png_ptr->row_number & 0x07) != 0)
781 if ((
png_ptr->row_number & 0x07) != 4)
797 if ((
png_ptr->row_number & 0x03) != 2)
813 if ((
png_ptr->row_number & 0x01) == 0)
844 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
851 if (row_info.
width == 0)
859 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
861 if (
png_ptr->transformations != 0)
872 #ifdef PNG_MNG_FEATURES_SUPPORTED
891 #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
◆ png_set_flush()
◆ png_write_flush()
◆ png_write_destroy()
951 #ifdef PNG_READ_EXPANDED_SUPPORTED
955 #ifdef PNG_WRITE_FILTER_SUPPORTED
964 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
◆ png_destroy_write_struct()
985 png_debug(1,
"in png_destroy_write_struct");
987 if (png_ptr_ptr !=
NULL)
◆ png_set_filter()
1011 #ifdef PNG_MNG_FEATURES_SUPPORTED
1021 #ifdef PNG_WRITE_FILTER_SUPPORTED
1030 #ifdef PNG_WRITE_FILTER_SUPPORTED
1051 #ifdef PNG_WRITE_FILTER_SUPPORTED
1087 "png_set_filter: UP/AVG/PAETH cannot be added after start");
1113 png_malloc(
png_ptr, buf_size));
1115 if (num_filters > 1)
1119 png_malloc(
png_ptr, buf_size));
◆ png_set_filter_heuristics()
void PNGAPI png_set_filter_heuristics |
( |
png_structrp |
png_ptr, |
|
|
int |
heuristic_method, |
|
|
int |
num_weights, |
|
|
png_const_doublep |
filter_weights, |
|
|
png_const_doublep |
filter_costs |
|
) |
| |
◆ png_set_filter_heuristics_fixed()
◆ png_set_compression_level()
1164 png_debug(1,
"in png_set_compression_level");
◆ png_set_compression_mem_level()
1175 png_debug(1,
"in png_set_compression_mem_level");
1180 png_ptr->zlib_mem_level = mem_level;
◆ png_set_compression_strategy()
1186 png_debug(1,
"in png_set_compression_strategy");
1194 png_ptr->zlib_strategy = strategy;
◆ png_set_compression_window_bits()
1212 if (window_bits > 15)
1218 else if (window_bits < 8)
1224 png_ptr->zlib_window_bits = window_bits;
◆ png_set_compression_method()
1230 png_debug(1,
"in png_set_compression_method");
1241 png_ptr->zlib_method = method;
◆ png_set_text_compression_level()
1250 png_debug(1,
"in png_set_text_compression_level");
1255 png_ptr->zlib_text_level = level;
◆ png_set_text_compression_mem_level()
1261 png_debug(1,
"in png_set_text_compression_mem_level");
1266 png_ptr->zlib_text_mem_level = mem_level;
◆ png_set_text_compression_strategy()
1272 png_debug(1,
"in png_set_text_compression_strategy");
1277 png_ptr->zlib_text_strategy = strategy;
◆ png_set_text_compression_window_bits()
1289 if (window_bits > 15)
1295 else if (window_bits < 8)
1301 png_ptr->zlib_text_window_bits = window_bits;
◆ png_set_text_compression_method()
1307 png_debug(1,
"in png_set_text_compression_method");
1315 png_ptr->zlib_text_method = method;
◆ png_set_write_status_fn()
1326 png_ptr->write_row_fn = write_row_fn;
◆ png_set_write_user_transform_fn()
void PNGAPI png_set_write_user_transform_fn |
( |
png_structrp |
png_ptr, |
|
|
png_user_transform_ptr |
write_user_transform_fn |
|
) |
| |
1334 png_debug(1,
"in png_set_write_user_transform_fn");
1340 png_ptr->write_user_transform_fn = write_user_transform_fn;
◆ png_write_png()
1366 #ifdef PNG_WRITE_INVERT_SUPPORTED
1376 #ifdef PNG_WRITE_SHIFT_SUPPORTED
1385 #ifdef PNG_WRITE_PACK_SUPPORTED
1393 #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
1406 #ifdef PNG_WRITE_FILLER_SUPPORTED
1411 "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
1426 #ifdef PNG_WRITE_BGR_SUPPORTED
1434 #ifdef PNG_WRITE_SWAP_SUPPORTED
1442 #ifdef PNG_WRITE_PACKSWAP_SUPPORTED
1450 #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
◆ png_image_write_init()
static int png_image_write_init |
( |
png_imagep |
image | ) |
|
|
static |
1484 png_malloc_warn(
png_ptr, (
sizeof *control)));
1486 if (control !=
NULL)
1488 memset(control, 0, (
sizeof *control));
◆ png_write_image_16bit()
static int png_write_image_16bit |
( |
png_voidp |
argument | ) |
|
|
static |
1550 # ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
1558 aindex = (
int)channels;
1560 aindex = (
int)channels;
1571 row_end = output_row + image->
width * (channels+1);
1578 while (out_ptr < row_end)
1584 out_ptr[aindex] = alpha;
1591 if (alpha > 0 && alpha < 65535)
1592 reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
1606 if (component >= alpha)
1612 else if (component > 0 && alpha < 65535)
1619 *out_ptr++ = component;
◆ png_unpremultiply()
1659 if (component >= alpha || alpha < 128)
1665 else if (component > 0)
1674 component *= reciprocal;
◆ png_write_image_8bit()
static int png_write_image_8bit |
( |
png_voidp |
argument | ) |
|
|
static |
1710 # ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
1720 aindex = (
int)channels;
1723 row_end = output_row + image->
width * (channels+1);
1730 while (out_ptr < row_end)
1733 png_byte alphabyte = (png_byte)
PNG_DIV257(alpha);
1738 out_ptr[aindex] = alphabyte;
1740 if (alphabyte > 0 && alphabyte < 255)
1771 while (out_ptr < row_end)
◆ png_image_set_PLTE()
1791 const void *cmap =
display->colormap;
1799 # if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
1800 defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
1807 # ifdef PNG_FORMAT_BGR_SUPPORTED
1817 memset(tRNS, 255, (
sizeof tRNS));
1818 memset(palette, 0, (
sizeof palette));
1820 for (
i=num_trans=0;
i<entries; ++
i)
1829 entry += (
unsigned int)
i * channels;
1831 if ((channels & 1) != 0)
1850 png_uint_16 alpha = entry[afirst ? 0 : channels-1];
1851 png_byte alphabyte = (png_byte)
PNG_DIV257(alpha);
1858 if (alphabyte > 0 && alphabyte < 255)
1859 reciprocal = (((0xffff*0xff)<<7)+(alpha>>1))/alpha;
1861 tRNS[
i] = alphabyte;
1862 if (alphabyte < 255)
1885 entry += (
unsigned int)
i * channels;
1890 tRNS[
i] = entry[afirst ? 0 : 3];
1895 palette[
i].
blue = entry[afirst + (2 ^ bgr)];
1896 palette[
i].
green = entry[afirst + 1];
1897 palette[
i].
red = entry[afirst + bgr];
1901 tRNS[
i] = entry[1 ^ afirst];
◆ png_image_write_main()
static int png_image_write_main |
( |
png_voidp |
argument | ) |
|
|
static |
1947 int write_16bit = linear && (
display->convert_to_8bit == 0);
1949 # ifdef PNG_BENIGN_ERRORS_SUPPORTED
1960 if (image->
width <= 0x7fffffffU/channels)
1974 if (check >= png_row_stride)
1980 if (image->
height > 0xffffffffU/png_row_stride)
2000 entries > 16 ? 8 : (entries > 4 ? 4 : (entries > 2 ? 2 : 1)),
2009 "no color-map for color-mapped image");
2014 write_16bit ? 16 : 8,
2025 if (write_16bit != 0)
2057 if (write_16bit != 0)
2065 # ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
2074 # ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
2096 ptrdiff_t row_bytes =
display->row_stride;
2102 row += (image->
height-1) * (-row_bytes);
2105 display->row_bytes = row_bytes;
2117 # ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
2126 if ((linear != 0 && alpha != 0 ) ||
2127 (colormap == 0 &&
display->convert_to_8bit != 0))
2134 if (write_16bit != 0)
2153 ptrdiff_t row_bytes =
display->row_bytes;
◆ void()
static void |
( |
PNGCBAPI |
image_memory_write | ) |
|
|
static |
◆ if()
◆ png_error()
else png_error |
( |
png_ptr |
, |
|
|
"png_image_write_to_memory: PNG too big" |
|
|
) |
| |
◆ png_image_write_memory()
static int png_image_write_memory |
( |
png_voidp |
argument | ) |
|
|
static |
2210 image_memory_write, image_memory_flush);
◆ png_image_write_to_memory()
2223 if (memory_bytes !=
NULL && buffer !=
NULL)
2239 display.row_stride = row_stride;
2241 display.convert_to_8bit = convert_to_8bit;
2243 display.memory_bytes = *memory_bytes;
2255 if (memory !=
NULL &&
display.output_bytes > *memory_bytes)
2258 *memory_bytes =
display.output_bytes;
2270 "png_image_write_to_memory: invalid argument");
2273 else if (image !=
NULL)
2275 "png_image_write_to_memory: incorrect PNG_IMAGE_VERSION");
◆ png_image_write_to_stdio()
2289 if (file !=
NULL && buffer !=
NULL)
2305 display.row_stride = row_stride;
2307 display.convert_to_8bit = convert_to_8bit;
2320 "png_image_write_to_stdio: invalid argument");
2323 else if (image !=
NULL)
2325 "png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION");
◆ png_image_write_to_file()
2339 if (file_name !=
NULL && buffer !=
NULL)
2341 FILE *fp = fopen(file_name,
"wb");
2346 row_stride, colormap) != 0)
2351 if (fflush(fp) == 0 && ferror(fp) == 0)
2353 if (fclose(fp) == 0)
2365 (
void)remove(file_name);
2376 (
void)remove(file_name);
2387 "png_image_write_to_file: invalid argument");
2390 else if (image !=
NULL)
2392 "png_image_write_to_file: incorrect PNG_IMAGE_VERSION");
◆ data
◆ size
◆ ob
#define PNG_BGR
Definition: pngpriv.h:642
png_uint_32 width
Definition: png.h:2675
void PNGAPI png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color)
Definition: pngset.c:994
static int png_image_write_memory(png_voidp argument)
Definition: pngwrite.c:2200
png_uint_32 colormap_entries
Definition: png.h:2679
const typedef png_byte * png_const_bytep
Definition: pngconf.h:580
void PNGAPI png_write_image(png_structrp png_ptr, png_bytepp image)
Definition: pngwrite.c:601
#define PNG_AFTER_IDAT
Definition: png.h:646
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY
Definition: pngpriv.h:679
int png_safe_execute(png_imagep image_in, int(*function)(png_voidp), png_voidp arg)
Definition: pngerror.c:936
#define PNG_TEXT_COMPRESSION_zTXt
Definition: png.h:589
#define PNG_FILLER_AFTER
Definition: png.h:1249
#define PNG_UNUSED(param)
Definition: pngpriv.h:438
#define PNG_sRGB_FROM_LINEAR(linear)
Definition: pngpriv.h:952
void png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
Definition: pngwutil.c:2550
bool error
Definition: auto_build.py:637
static png_byte png_unpremultiply(png_uint_32 component, png_uint_32 alpha, png_uint_32 reciprocal)
Definition: pngwrite.c:1646
png_byte second
Definition: png.h:607
void PNGAPI png_set_sRGB(png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)
Definition: pngset.c:653
#define PNG_INVERT_ALPHA
Definition: pngpriv.h:661
void png_write_gAMA_fixed(png_structrp png_ptr, png_fixed_point file_gamma)
Definition: pngwutil.c:1084
#define PNG_INFO_tIME
Definition: png.h:741
void png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text, size_t text_len)
Definition: pngwutil.c:1530
int ZEXPORT deflateEnd(z_streamp strm)
Definition: deflate.c:1076
#define PNG_HAVE_PLTE
Definition: png.h:645
void PNGAPI png_set_compression_level(png_structrp png_ptr, int level)
Definition: pngwrite.c:1162
png_structrp int int png_const_fixed_point_p filter_weights
Definition: png.h:1488
#define PNG_INFO_tRNS
Definition: png.h:736
void PNGAPI png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_const_colorp palette, int num_palette)
Definition: pngset.c:572
#define PNG_FLAG_APP_WARNINGS_WARN
Definition: pngpriv.h:700
static int png_image_write_main(png_voidp argument)
Definition: pngwrite.c:1934
void PNGAPI png_free(png_const_structrp png_ptr, png_voidp ptr)
Definition: pngmem.c:232
#define PNG_FILTER_AVG
Definition: png.h:1468
#define PNG_INFO_pCAL
Definition: png.h:742
#define PNG_INFO_oFFs
Definition: png.h:740
void PNGAPI png_set_swap_alpha(png_structrp png_ptr)
Definition: pngtrans.c:223
void png_write_oFFs(png_structrp png_ptr, png_int_32 x_offset, png_int_32 y_offset, int unit_type)
Definition: pngwutil.c:1724
#define PNG_IMAGE_VERSION
Definition: png.h:2668
void PNGAPI png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
Definition: pngwrite.c:192
int PNGAPI png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap)
Definition: pngwrite.c:2283
#define PNG_TRANSFORM_INVERT_MONO
Definition: png.h:838
int PNGAPI png_set_interlace_handling(png_structrp png_ptr)
Definition: pngtrans.c:99
png_uint_32 flags
Definition: png.h:2678
#define PNG_INTERLACE_NONE
Definition: png.h:687
png_info *PNG_RESTRICT png_inforp
Definition: png.h:471
png_byte ** png_bytepp
Definition: pngconf.h:606
void png_write_start_row(png_structrp png_ptr)
Definition: pngwutil.c:1890
png_byte * png_bytep
Definition: pngconf.h:579
uint8_t i
Definition: screen_test_graph.c:72
#define PNG_INVERT_MONO
Definition: pngpriv.h:647
void PNGAPI png_write_row(png_structrp png_ptr, png_const_bytep row)
Definition: pngwrite.c:698
void png_flush(png_structrp png_ptr)
Definition: pngwio.c:71
#define PNG_INFO_PLTE
Definition: png.h:735
static void png_image_set_PLTE(png_image_write_control *display)
Definition: pngwrite.c:1788
void png_write_cHRM_fixed(png_structrp png_ptr, const png_xy *xy)
Definition: pngwutil.c:1322
void PNGAPI png_set_shift(png_structrp png_ptr, png_const_color_8p true_bits)
Definition: pngtrans.c:84
void PNGAPI png_set_invert_mono(png_structrp png_ptr)
Definition: pngtrans.c:250
#define PNG_FORMAT_FLAG_AFIRST
Definition: png.h:2787
#define PNG_FORMAT_FLAG_BGR
Definition: png.h:2783
#define PNG_COLOR_TYPE_RGB_ALPHA
Definition: png.h:671
unsigned int for_write
Definition: pngpriv.h:2044
#define PNG_WRITE_INTERLACING_SUPPORTED
Definition: pnglibconf.h:138
void PNGAPI png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
Definition: pngwio.c:122
#define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB
Definition: png.h:2937
#define PNG_FILTER_TYPE_BASE
Definition: png.h:682
#define PNG_NO_FILTERS
Definition: png.h:1464
void png_free_buffer_list(png_structrp png_ptr, png_compression_bufferp *listp)
Definition: pngwutil.c:439
#define png_debug2(l, m, p1, p2)
Definition: pngdebug.h:151
#define PNG_GAMMA_LINEAR
Definition: png.h:1150
void PNGAPI png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
Definition: pngwrite.c:983
#define PNG_INTRAPIXEL_DIFFERENCING
Definition: png.h:683
void png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key, png_const_charp lang, png_const_charp lang_key, png_const_charp text)
Definition: pngwutil.c:1624
#define png_voidcast(type, value)
Definition: pngpriv.h:494
const typedef png_unknown_chunk * png_const_unknown_chunkp
Definition: png.h:639
#define NULL
Definition: usbd_def.h:53
png_uint_32 width
Definition: png.h:756
png_structrp png_ptr
Definition: png.h:1083
#define PNG_FORMAT_FLAG_LINEAR
Definition: png.h:2779
#define PNG_Z_DEFAULT_STRATEGY
Definition: pnglibconf.h:215
#define PNG_COLOR_TYPE_RGB
Definition: png.h:670
png_const_structrp png_const_inforp info_ptr
Definition: png.h:1939
#define PNG_FLAG_MNG_FILTER_64
Definition: png.h:858
png_uint_16 year
Definition: png.h:602
#define PNG_INFO_gAMA
Definition: png.h:732
#define PNG_TRANSFORM_PACKSWAP
Definition: png.h:836
png_byte month
Definition: png.h:603
#define PNG_INFO_bKGD
Definition: png.h:737
#define PNG_FORMAT_FLAG_COLOR
Definition: png.h:2778
#define PNG_SWAP_BYTES
Definition: pngpriv.h:646
void png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
Definition: pngtrans.c:699
#define PNG_TEXT_Z_DEFAULT_COMPRESSION
Definition: pnglibconf.h:205
void png_write_IEND(png_structrp png_ptr)
Definition: pngwutil.c:1073
unsigned int png_uint_32
Definition: pngconf.h:511
static int png_image_write_init(png_imagep image)
Definition: pngwrite.c:1472
#define PNG_INFO_eXIf
Definition: png.h:748
void PNGAPI png_image_free(png_imagep image)
Definition: png.c:4582
void png_write_PLTE(png_structrp png_ptr, png_const_colorp palette, png_uint_32 num_pal)
Definition: pngwutil.c:842
#define PNG_TEXT_COMPRESSION_NONE
Definition: png.h:588
png_uint_16(PNGAPI png_get_uint_16)(png_const_bytep buf)
Definition: pngrutil.c:102
void png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha, png_const_color_16p tran, int num_trans, int color_type)
Definition: pngwutil.c:1348
void png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
Definition: pngwutil.c:1263
#define PNG_MAX_PALETTE_LENGTH
Definition: png.h:725
const typedef png_uint_16 * png_const_uint_16p
Definition: pngconf.h:586
#define PNG_HAVE_IHDR
Definition: png.h:644
#define PNG_PACKSWAP
Definition: pngpriv.h:658
#define PNG_FORMAT_FLAG_COLORMAP
Definition: png.h:2780
Definition: pngwrite.c:1509
#define PNG_HAVE_IDAT
Definition: pngpriv.h:626
png_structrp int png_fixed_point red
Definition: png.h:1083
void PNGFAPI png_set_cHRM_fixed(png_const_structrp png_ptr, png_inforp info_ptr, png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x, png_fixed_point blue_y)
Definition: pngset.c:40
#define PNG_TEXT_Z_DEFAULT_STRATEGY
Definition: pnglibconf.h:206
#define UNP_RECIPROCAL(alpha)
Definition: pngwrite.c:1643
static png_bytep data
Definition: pngwrite.c:2169
png_uint_32 version
Definition: png.h:2674
void png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
Definition: pngwutil.c:1179
#define PNG_IMAGE_PIXEL_CHANNELS(fmt)
Definition: png.h:2881
png_byte channels
Definition: png.h:760
#define PNG_TRANSFORM_INVERT_ALPHA
Definition: png.h:843
static int png_write_image_8bit(png_voidp argument)
Definition: pngwrite.c:1691
#define PNG_TEXT_COMPRESSION_NONE_WR
Definition: png.h:586
png_byte color_type
Definition: png.h:758
#define PNG_INFO_sRGB
Definition: png.h:743
void PNGAPI png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
Definition: pngerror.c:362
#define PNG_HANDLE_CHUNK_ALWAYS
Definition: png.h:2348
#define PNG_HANDLE_CHUNK_NEVER
Definition: png.h:2346
png_byte blue
Definition: png.h:482
#define PNG_FILTER_NONE
Definition: png.h:1465
#define PNG_IMAGE_FLAG_FAST
Definition: png.h:2942
#define png_debug(l, m)
Definition: pngdebug.h:145
#define PNG_TRANSFORM_PACKING
Definition: png.h:835
void PNGAPI png_set_IHDR(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int interlace_type, int compression_type, int filter_type)
Definition: pngset.c:254
#define PNG_TRANSFORM_STRIP_FILLER_BEFORE
Definition: png.h:846
png_byte green
Definition: png.h:481
void png_write_hIST(png_structrp png_ptr, png_const_uint_16p hist, int num_hist)
Definition: pngwutil.c:1499
#define PNG_INTERLACE
Definition: pngpriv.h:643
void png_write_finish_row(png_structrp png_ptr)
Definition: pngwutil.c:2005
void PNGAPI png_set_invert_alpha(png_structrp png_ptr)
Definition: pngtrans.c:237
void PNGAPI png_write_end(png_structrp png_ptr, png_inforp info_ptr)
Definition: pngwrite.c:358
#define PNG_FILLER
Definition: pngpriv.h:657
#define PNG_TRANSFORM_STRIP_FILLER_AFTER
Definition: png.h:847
static void png_write_destroy(png_structrp png_ptr)
Definition: pngwrite.c:939
#define PNG_sRGB_INTENT_PERCEPTUAL
Definition: png.h:715
#define PNG_COMPRESSION_TYPE_BASE
Definition: png.h:678
void png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
Definition: pngwutil.c:1414
int png_image_error(png_imagep image, png_const_charp error_message)
Definition: png.c:4598
#define PNG_FILTER_VALUE_NONE
Definition: png.h:1476
size_t PNGAPI png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
Definition: pngget.c:30
png_structrp int int num_weights
Definition: png.h:1488
#define Z_SYNC_FLUSH
Definition: zlib.h:170
png_struct *PNG_RESTRICT png_structrp
Definition: png.h:469
void png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int compression_type, int filter_type, int interlace_type)
Definition: pngwutil.c:672
#define PNG_FILTER_UP
Definition: png.h:1467
void png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text, int compression)
Definition: pngwutil.c:1573
Definition: pngpriv.h:2035
void PNGAPI png_set_benign_errors(png_structrp png_ptr, int allowed)
Definition: pngset.c:1671
png_uint_32 format
Definition: png.h:2677
#define PNG_INFO_sCAL
Definition: png.h:746
#define PNG_FILTER_VALUE_AVG
Definition: png.h:1479
#define PNG_HANDLE_CHUNK_AS_DEFAULT
Definition: png.h:2345
if(size<=((png_alloc_size_t) -1) - ob)
Definition: pngwrite.c:2176
void png_write_sCAL_s(png_structrp png_ptr, int unit, png_const_charp width, png_const_charp height)
Definition: pngwutil.c:1809
void png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_const_charp units, png_charpp params)
Definition: pngwutil.c:1744
#define PNG_FILTER_VALUE_PAETH
Definition: png.h:1480
#define L(CODE)
Definition: macros.h:76
void PNGAPI png_set_packswap(png_structrp png_ptr)
Definition: pngtrans.c:70
#define PNG_FILTER_PAETH
Definition: png.h:1469
#define PNG_FILTER_VALUE_UP
Definition: png.h:1478
png_byte pixel_depth
Definition: png.h:761
void PNGAPI png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
Definition: pngtrans.c:120
#define PNG_IMAGE_SAMPLE_CHANNELS(fmt)
Definition: png.h:2845
#define PNG_TRANSFORM_BGR
Definition: png.h:840
#define PNG_INFO_sPLT
Definition: png.h:745
#define PNG_FILLER_BEFORE
Definition: png.h:1248
Definition: pngstruct.h:143
void png_write_iCCP(png_structrp png_ptr, png_const_charp name, png_const_bytep profile)
Definition: pngwutil.c:1117
display_t * display
Definition: display.c:6
void PNGAPI png_set_filter(png_structrp png_ptr, int method, int filters)
Definition: pngwrite.c:1004
void PNGCBAPI png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
Definition: pngerror.c:921
int PNGAPI png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
Definition: png.c:926
png_uint_32 height
Definition: png.h:2676
#define PNG_INFO_pHYs
Definition: png.h:739
#define PNG_FILTER_VALUE_SUB
Definition: png.h:1477
void PNGAPI png_set_packing(png_structrp png_ptr)
Definition: pngtrans.c:50
else png_error(png_ptr, "png_image_write_to_memory: PNG too big")
void PNGAPI png_set_swap(png_structrp png_ptr)
Definition: pngtrans.c:35
png_uint_16 * png_uint_16p
Definition: pngconf.h:585
static int png_write_image_16bit(png_voidp argument)
Definition: pngwrite.c:1532
png_voidp io_ptr
Definition: pngstruct.h:158
#define png_debug1(l, m, p1)
Definition: pngdebug.h:148
#define PNG_LIBPNG_VER_STRING
Definition: png.h:280
#define PNG_ZBUF_SIZE
Definition: pnglibconf.h:211
#define PNG_FLAG_ZSTREAM_INITIALIZED
Definition: pngpriv.h:680
#define PNG_FLAG_BENIGN_ERRORS_WARN
Definition: pngpriv.h:699
static void write_unknown_chunks(png_structrp png_ptr, png_const_inforp info_ptr, unsigned int where)
Definition: pngwrite.c:24
size_t png_alloc_size_t
Definition: pngconf.h:557
void png_destroy_png_struct(png_structrp png_ptr)
Definition: pngmem.c:25
#define PNG_SHIFT
Definition: pngpriv.h:645
png_byte minute
Definition: png.h:606
#define PNG_INFO_cHRM
Definition: png.h:734
void PNGAPI png_write_sig(png_structrp png_ptr)
Definition: pngwutil.c:51
#define PNG_ROWBYTES(pixel_bits, width)
Definition: pngpriv.h:738
void PNGAPI png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string, png_const_bytep data, size_t length)
Definition: pngwutil.c:192
void png_write_tIME(png_structrp png_ptr, png_const_timep mod_time)
Definition: pngwutil.c:1863
png_const_structrp png_const_inforp png_fixed_point *int_file_gamma png_set_gAMA_fixed
Definition: png.h:2004
static void(PNGCBAPI image_memory_write)(png_structp png_ptr
Definition: pngwrite.c:2193
void png_write_pHYs(png_structrp png_ptr, png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, int unit_type)
Definition: pngwutil.c:1839
#define PNG_COLOR_MASK_COLOR
Definition: png.h:664
#define PNG_HAVE_PNG_SIGNATURE
Definition: pngpriv.h:636
void png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, png_alloc_size_t input_len, int flush)
Definition: pngwutil.c:931
#define PNG_TRANSFORM_SWAP_ALPHA
Definition: png.h:841
png_byte red
Definition: png.h:480
#define PNG_WROTE_INFO_BEFORE_PLTE
Definition: pngpriv.h:634
int
Definition: createSpeedLookupTable.py:15
#define PNG_PACK
Definition: pngpriv.h:644
#define PNG_INFO_sBIT
Definition: png.h:733
static const char * filters[]
Definition: screen_filebrowser.cpp:44
void png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
Definition: pngwtran.c:501
#define PNG_WROTE_tIME
Definition: pngpriv.h:633
void png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif)
Definition: pngwutil.c:1477
#define PNG_TRANSFORM_SWAP_ENDIAN
Definition: png.h:842
#define PNG_INFO_hIST
Definition: png.h:738
png_byte day
Definition: png.h:604
#define PNG_FILTER_SUB
Definition: png.h:1466
png_alloc_size_t ob
Definition: pngwrite.c:2173
void png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
Definition: pngerror.c:392
size_t rowbytes
Definition: png.h:757
png_infop info_ptr
Definition: pngpriv.h:2038
void png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
Definition: pngerror.c:405
#define PNG_INFO_iCCP
Definition: png.h:744
#define PNG_TRANSFORM_SHIFT
Definition: png.h:839
png_byte bit_depth
Definition: png.h:759
void PNGAPI png_convert_from_struct_tm(png_timep ptime, const struct tm *ttime)
Definition: pngwrite.c:472
#define PNG_FORMAT_FLAG_ALPHA
Definition: png.h:2777
void PNGAPI png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
Definition: pngwrite.c:84
#define PNG_GAMMA_sRGB_INVERSE
Definition: pngpriv.h:906
png_byte hour
Definition: png.h:605
png_structp png_ptr
Definition: pngpriv.h:2037
#define PNG_Z_DEFAULT_COMPRESSION
Definition: pnglibconf.h:213
void PNGAPI png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
Definition: pngerror.c:216
png_structrp int heuristic_method
Definition: png.h:1488
void png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
Definition: pngwutil.c:2096
png_int_32(PNGAPI png_get_int_32)(png_const_bytep buf)
Definition: pngrutil.c:84
#define PNG_ALL_FILTERS
Definition: png.h:1471
#define PNG_DIV257(v16)
Definition: pngpriv.h:735
#define PNG_COLOR_MASK_ALPHA
Definition: png.h:665
#define PNG_INFO_IDAT
Definition: png.h:747
#define PNG_TEXT_COMPRESSION_zTXt_WR
Definition: png.h:587
void PNGAPI png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
Definition: png.c:386
void png_write_sRGB(png_structrp png_ptr, int srgb_intent)
Definition: pngwutil.c:1099
#define PNG_COLOR_TYPE_PALETTE
Definition: png.h:669
#define PNG_USER_TRANSFORM
Definition: pngpriv.h:662
static png_bytep size_t size
Definition: pngwrite.c:2170
static void png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
Definition: pngwrite.c:634
png_controlp opaque
Definition: png.h:2673
void PNGAPI png_set_bgr(png_structrp png_ptr)
Definition: pngtrans.c:21