Lines Matching refs:mainprog_ptr
84 int writepng_init(mainprog_info *mainprog_ptr) in writepng_init() argument
93 png_ptr = png_create_write_struct(png_get_libpng_ver(NULL), mainprog_ptr, in writepng_init()
111 if (setjmp(mainprog_ptr->jmpbuf)) { in writepng_init()
119 png_init_io(png_ptr, mainprog_ptr->outfile); in writepng_init()
142 if (mainprog_ptr->pnmtype == 5) in writepng_init()
144 else if (mainprog_ptr->pnmtype == 6) in writepng_init()
146 else if (mainprog_ptr->pnmtype == 8) in writepng_init()
153 interlace_type = mainprog_ptr->interlaced? PNG_INTERLACE_ADAM7 : in writepng_init()
156 png_set_IHDR(png_ptr, info_ptr, mainprog_ptr->width, mainprog_ptr->height, in writepng_init()
157 mainprog_ptr->sample_depth, color_type, interlace_type, in writepng_init()
160 if (mainprog_ptr->gamma > 0.0) in writepng_init()
161 png_set_gAMA(png_ptr, info_ptr, mainprog_ptr->gamma); in writepng_init()
163 if (mainprog_ptr->have_bg) { /* we know it's RGBA, not gray+alpha */ in writepng_init()
166 background.red = mainprog_ptr->bg_red; in writepng_init()
167 background.green = mainprog_ptr->bg_green; in writepng_init()
168 background.blue = mainprog_ptr->bg_blue; in writepng_init()
172 if (mainprog_ptr->have_time) { in writepng_init()
175 png_convert_from_time_t(&modtime, mainprog_ptr->modtime); in writepng_init()
179 if (mainprog_ptr->have_text) { in writepng_init()
183 if (mainprog_ptr->have_text & TEXT_TITLE) { in writepng_init()
186 text[num_text].text = mainprog_ptr->title; in writepng_init()
189 if (mainprog_ptr->have_text & TEXT_AUTHOR) { in writepng_init()
192 text[num_text].text = mainprog_ptr->author; in writepng_init()
195 if (mainprog_ptr->have_text & TEXT_DESC) { in writepng_init()
198 text[num_text].text = mainprog_ptr->desc; in writepng_init()
201 if (mainprog_ptr->have_text & TEXT_COPY) { in writepng_init()
204 text[num_text].text = mainprog_ptr->copyright; in writepng_init()
207 if (mainprog_ptr->have_text & TEXT_EMAIL) { in writepng_init()
210 text[num_text].text = mainprog_ptr->email; in writepng_init()
213 if (mainprog_ptr->have_text & TEXT_URL) { in writepng_init()
216 text[num_text].text = mainprog_ptr->url; in writepng_init()
244 mainprog_ptr->png_ptr = png_ptr; in writepng_init()
245 mainprog_ptr->info_ptr = info_ptr; in writepng_init()
259 int writepng_encode_image(mainprog_info *mainprog_ptr) in writepng_encode_image() argument
261 png_structp png_ptr = (png_structp)mainprog_ptr->png_ptr; in writepng_encode_image()
262 png_infop info_ptr = (png_infop)mainprog_ptr->info_ptr; in writepng_encode_image()
268 if (setjmp(mainprog_ptr->jmpbuf)) { in writepng_encode_image()
270 mainprog_ptr->png_ptr = NULL; in writepng_encode_image()
271 mainprog_ptr->info_ptr = NULL; in writepng_encode_image()
279 png_write_image(png_ptr, mainprog_ptr->row_pointers); in writepng_encode_image()
297 int writepng_encode_row(mainprog_info *mainprog_ptr) /* NON-interlaced only! */ in writepng_encode_row() argument
299 png_structp png_ptr = (png_structp)mainprog_ptr->png_ptr; in writepng_encode_row()
300 png_infop info_ptr = (png_infop)mainprog_ptr->info_ptr; in writepng_encode_row()
306 if (setjmp(mainprog_ptr->jmpbuf)) { in writepng_encode_row()
308 mainprog_ptr->png_ptr = NULL; in writepng_encode_row()
309 mainprog_ptr->info_ptr = NULL; in writepng_encode_row()
316 png_write_row(png_ptr, mainprog_ptr->image_data); in writepng_encode_row()
327 int writepng_encode_finish(mainprog_info *mainprog_ptr) /* NON-interlaced! */ in writepng_encode_finish() argument
329 png_structp png_ptr = (png_structp)mainprog_ptr->png_ptr; in writepng_encode_finish()
330 png_infop info_ptr = (png_infop)mainprog_ptr->info_ptr; in writepng_encode_finish()
336 if (setjmp(mainprog_ptr->jmpbuf)) { in writepng_encode_finish()
338 mainprog_ptr->png_ptr = NULL; in writepng_encode_finish()
339 mainprog_ptr->info_ptr = NULL; in writepng_encode_finish()
356 void writepng_cleanup(mainprog_info *mainprog_ptr) in writepng_cleanup() argument
358 png_structp png_ptr = (png_structp)mainprog_ptr->png_ptr; in writepng_cleanup()
359 png_infop info_ptr = (png_infop)mainprog_ptr->info_ptr; in writepng_cleanup()
371 mainprog_info *mainprog_ptr; in writepng_error_handler() local
385 mainprog_ptr = png_get_error_ptr(png_ptr); in writepng_error_handler()
386 if (mainprog_ptr == NULL) { /* we are completely hosed now */ in writepng_error_handler()
400 longjmp(mainprog_ptr->jmpbuf, 1); in writepng_error_handler()