193 #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) 199 if (png_ptr == NULL || info_ptr == NULL)
209 png_error(png_ptr,
"Valid palette required for paletted images");
211 #ifdef PNG_WRITE_tRNS_SUPPORTED 214 #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED 220 for (j = 0; j<(int)info_ptr->
num_trans; j++)
221 info_ptr->trans_alpha[j] =
222 (png_byte)(255 - info_ptr->trans_alpha[j]);
225 png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color),
229 #ifdef PNG_WRITE_bKGD_SUPPORTED 234 #ifdef PNG_WRITE_hIST_SUPPORTED 239 #ifdef PNG_WRITE_oFFs_SUPPORTED 242 info_ptr->offset_unit_type);
245 #ifdef PNG_WRITE_pCAL_SUPPORTED 247 png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0,
248 info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams,
249 info_ptr->pcal_units, info_ptr->pcal_params);
252 #ifdef PNG_WRITE_sCAL_SUPPORTED 255 info_ptr->scal_s_width, info_ptr->scal_s_height);
258 #ifdef PNG_WRITE_pHYs_SUPPORTED 261 info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type);
264 #ifdef PNG_WRITE_tIME_SUPPORTED 272 #ifdef PNG_WRITE_sPLT_SUPPORTED 274 for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
278 #ifdef PNG_WRITE_TEXT_SUPPORTED 280 for (i = 0; i < info_ptr->num_text; i++)
282 png_debug2(2,
"Writing header text chunk %d, type %d", i,
283 info_ptr->text[i].compression);
285 if (info_ptr->text[i].compression > 0)
287 #ifdef PNG_WRITE_iTXt_SUPPORTED 290 info_ptr->text[i].compression,
291 info_ptr->text[i].key,
292 info_ptr->text[i].lang,
293 info_ptr->text[i].lang_key,
294 info_ptr->text[i].text);
301 png_warning(png_ptr,
"Unable to write international text");
308 #ifdef PNG_WRITE_zTXt_SUPPORTED 311 info_ptr->text[i].text, info_ptr->text[i].compression);
315 png_warning(png_ptr,
"Unable to write compressed text");
321 #ifdef PNG_WRITE_tEXt_SUPPORTED 324 info_ptr->text[i].text,
330 png_warning(png_ptr,
"Unable to write uncompressed text");
336 #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED void png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp palette)
Definition: pngwutil.c:1254
void png_write_tIME(png_structrp png_ptr, png_const_timep mod_time)
Definition: pngwutil.c:1916
#define PNG_INVERT_ALPHA
Definition: pngpriv.h:579
#define PNG_INFO_tIME
Definition: png.h:882
void png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
Definition: pngwrite.c:84
#define PNG_INFO_hIST
Definition: png.h:879
int i
Definition: rw_test.cpp:37
png_colorp palette
Definition: pnginfo.h:63
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:1797
#define PNG_COLOR_TYPE_PALETTE
Definition: png.h:810
PNG_IMPEXP void() png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
Definition: pngerror.c:216
#define png_debug(l, m)
Definition: pngdebug.h:146
#define PNG_HAVE_PLTE
Definition: png.h:786
void png_write_hIST(png_structrp png_ptr, png_const_uint_16p hist, int num_hist)
Definition: pngwutil.c:1552
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:1677
#define PNG_TEXT_COMPRESSION_NONE_WR
Definition: png.h:727
static void write_unknown_chunks(png_structrp png_ptr, png_const_inforp info_ptr, unsigned int where)
Definition: pngwrite.c:24
#define PNG_INFO_oFFs
Definition: png.h:881
void png_write_tRNS(png_structrp png_ptr, png_const_bytep trans, png_const_color_16p values, int number, int color_type)
Definition: pngwutil.c:1424
void png_write_bKGD(png_structrp png_ptr, png_const_color_16p values, int color_type)
Definition: pngwutil.c:1490
void png_write_oFFs(png_structrp png_ptr, png_int_32 x_offset, png_int_32 y_offset, int unit_type)
Definition: pngwutil.c:1777
png_byte color_type
Definition: pnginfo.h:67
#define PNG_TEXT_COMPRESSION_zTXt
Definition: png.h:730
#define PNG_TEXT_COMPRESSION_NONE
Definition: png.h:729
void png_write_sCAL_s(png_structrp png_ptr, int unit, png_const_charp width, png_const_charp height)
Definition: pngwutil.c:1862
png_uint_16 num_palette
Definition: pnginfo.h:64
#define PNG_INFO_PLTE
Definition: png.h:876
#define PNG_WROTE_tIME
Definition: pngpriv.h:551
#define PNG_TEXT_COMPRESSION_zTXt_WR
Definition: png.h:728
#define PNG_INFO_tRNS
Definition: png.h:877
void png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text, int compression)
Definition: pngwutil.c:1626
png_uint_32 valid
Definition: pnginfo.h:61
png_uint_32 mode
Definition: pngstruct.h:179
PNG_IMPEXP void() png_error(png_const_structrp png_ptr, png_const_charp error_message)
Definition: pngerror.c:40
void png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text, png_size_t text_len)
Definition: pngwutil.c:1583
#define PNG_INFO_sPLT
Definition: png.h:886
png_uint_16 num_trans
Definition: pnginfo.h:65
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:1892
#define PNG_INFO_pHYs
Definition: png.h:880
#define PNG_INFO_pCAL
Definition: png.h:883
png_uint_32 transformations
Definition: pngstruct.h:181
#define PNG_INFO_bKGD
Definition: png.h:878
#define PNG_INFO_sCAL
Definition: png.h:887
#define png_debug2(l, m, p1, p2)
Definition: pngdebug.h:152
void png_write_PLTE(png_structrp png_ptr, png_const_colorp palette, png_uint_32 num_pal)
Definition: pngwutil.c:922