Lines Matching refs:wpng_info

113 static mainprog_info wpng_info;   /* lone global */
140 wpng_info.infile = NULL;
141 wpng_info.outfile = NULL;
142 wpng_info.image_data = NULL;
143 wpng_info.row_pointers = NULL;
144 wpng_info.filter = FALSE;
145 wpng_info.interlaced = FALSE;
146 wpng_info.have_bg = FALSE;
147 wpng_info.have_time = FALSE;
148 wpng_info.have_text = 0;
149 wpng_info.gamma = 0.0;
216 wpng_info.interlaced = TRUE;
218 wpng_info.modtime = time(NULL);
219 wpng_info.have_time = TRUE;
226 wpng_info.gamma = atof(*argv);
227 if (wpng_info.gamma <= 0.0)
229 else if (wpng_info.gamma > 1.01)
244 wpng_info.bg_red = (uch)r;
245 wpng_info.bg_green = (uch)g;
246 wpng_info.bg_blue = (uch)b;
247 wpng_info.have_bg = TRUE;
274 if ((wpng_info.infile = fdopen(fileno(stdin), "rb")) == NULL) {
279 if ((wpng_info.outfile = fdopen(fileno(stdout), "wb")) == NULL) {
282 fclose(wpng_info.infile);
285 wpng_info.filter = TRUE;
291 } else if (!(wpng_info.infile = fopen(inname, "rb"))) {
297 fgets(pnmline, 256, wpng_info.infile);
306 wpng_info.pnmtype = (int)(pnmchar - '0');
307 if (wpng_info.pnmtype != 8)
308 wpng_info.have_bg = FALSE; /* no need for bg if opaque */
310 fgets(pnmline, 256, wpng_info.infile); /* lose any comments */
312 sscanf(pnmline, "%ld %ld", &wpng_info.width, &wpng_info.height);
314 fgets(pnmline, 256, wpng_info.infile); /* more comment lines */
317 if (wpng_info.width <= 0L || wpng_info.height <= 0L ||
324 wpng_info.sample_depth = 8; /* <==> maxval 255 */
326 if (!wpng_info.filter) {
339 if ((wpng_info.outfile = fopen(outname, "rb")) != NULL) {
342 fclose(wpng_info.outfile);
344 } else if (!(wpng_info.outfile = fopen(outname, "wb"))) {
352 fclose(wpng_info.infile);
353 wpng_info.infile = NULL;
354 if (wpng_info.filter) {
355 fclose(wpng_info.outfile);
356 wpng_info.outfile = NULL;
421 wpng_info.title = p;
422 wpng_info.have_text |= TEXT_TITLE;
431 wpng_info.have_text &= ~TEXT_TITLE;
435 wpng_info.have_text &= ~TEXT_TITLE;
451 wpng_info.author = p;
452 wpng_info.have_text |= TEXT_AUTHOR;
461 wpng_info.have_text &= ~TEXT_AUTHOR;
465 wpng_info.have_text &= ~TEXT_AUTHOR;
490 wpng_info.desc = textbuf + TEXT_DESC_OFFSET;
491 wpng_info.have_text |= TEXT_DESC;
501 wpng_info.have_text &= ~TEXT_DESC;
505 wpng_info.have_text &= ~TEXT_DESC;
521 wpng_info.copyright = p;
522 wpng_info.have_text |= TEXT_COPY;
531 wpng_info.have_text &= ~TEXT_COPY;
535 wpng_info.have_text &= ~TEXT_COPY;
551 wpng_info.email = p;
552 wpng_info.have_text |= TEXT_EMAIL;
561 wpng_info.have_text &= ~TEXT_EMAIL;
565 wpng_info.have_text &= ~TEXT_EMAIL;
581 wpng_info.url = p;
582 wpng_info.have_text |= TEXT_URL;
591 wpng_info.have_text &= ~TEXT_URL;
595 wpng_info.have_text &= ~TEXT_URL;
610 wpng_info.have_text = 0;
616 if ((rc = writepng_init(&wpng_info)) != 0) {
651 if (wpng_info.pnmtype == 5)
652 rowbytes = wpng_info.width;
653 else if (wpng_info.pnmtype == 6)
654 rowbytes = wpng_info.width * 3;
655 else /* if (wpng_info.pnmtype == 8) */
656 rowbytes = wpng_info.width * 4;
665 if (wpng_info.interlaced) {
668 ulg image_bytes = rowbytes * wpng_info.height; /* overflow? */
670 wpng_info.image_data = (uch *)malloc(image_bytes);
671 wpng_info.row_pointers = (uch **)malloc(wpng_info.height*sizeof(uch *));
672 if (wpng_info.image_data == NULL || wpng_info.row_pointers == NULL) {
674 writepng_cleanup(&wpng_info);
678 for (i = 0; i < wpng_info.height; ++i)
679 wpng_info.row_pointers[i] = wpng_info.image_data + i*rowbytes;
680 bytes = fread(wpng_info.image_data, 1, image_bytes, wpng_info.infile);
686 if (writepng_encode_image(&wpng_info) != 0) {
689 writepng_cleanup(&wpng_info);
698 wpng_info.image_data = (uch *)malloc(rowbytes);
699 if (wpng_info.image_data == NULL) {
701 writepng_cleanup(&wpng_info);
706 for (j = wpng_info.height; j > 0L; --j) {
707 bytes = fread(wpng_info.image_data, 1, rowbytes, wpng_info.infile);
711 bytes, wpng_info.height-j);
715 if (writepng_encode_row(&wpng_info) != 0) {
718 wpng_info.height-j);
724 writepng_cleanup(&wpng_info);
728 if (writepng_encode_finish(&wpng_info) != 0) {
730 writepng_cleanup(&wpng_info);
742 writepng_cleanup(&wpng_info);
772 if (wpng_info.outfile) {
773 fclose(wpng_info.outfile);
774 wpng_info.outfile = NULL;
777 if (wpng_info.infile) {
778 fclose(wpng_info.infile);
779 wpng_info.infile = NULL;
782 if (wpng_info.image_data) {
783 free(wpng_info.image_data);
784 wpng_info.image_data = NULL;
787 if (wpng_info.row_pointers) {
788 free(wpng_info.row_pointers);
789 wpng_info.row_pointers = NULL;