Lines Matching refs:fp
77 static l_int32 pnmReadNextAsciiValue(FILE *fp, l_int32 *pval);
78 static l_int32 pnmSkipCommentLines(FILE *fp);
95 pixReadStreamPnm(FILE *fp) in pixReadStreamPnm() argument
107 if (!fp) in pixReadStreamPnm()
110 fscanf(fp, "P%d\n", &type); in pixReadStreamPnm()
114 if (pnmSkipCommentLines(fp)) in pixReadStreamPnm()
117 fscanf(fp, "%d %d\n", &w, &h); in pixReadStreamPnm()
125 fscanf(fp, "%d\n", &maxval); in pixReadStreamPnm()
140 fscanf(fp, "%d\n", &maxval); in pixReadStreamPnm()
156 if (pnmReadNextAsciiValue(fp, &val)) in pixReadStreamPnm()
161 if (pnmReadNextAsciiValue(fp, &rval)) in pixReadStreamPnm()
163 if (pnmReadNextAsciiValue(fp, &gval)) in pixReadStreamPnm()
165 if (pnmReadNextAsciiValue(fp, &bval)) in pixReadStreamPnm()
181 fread(&val8, 1, 1, fp); in pixReadStreamPnm()
195 fread(&val8, 1, 1, fp); in pixReadStreamPnm()
206 fread(&val16, 2, 1, fp); in pixReadStreamPnm()
218 fread(&rval8, 1, 1, fp); in pixReadStreamPnm()
219 fread(&gval8, 1, 1, fp); in pixReadStreamPnm()
220 fread(&bval8, 1, 1, fp); in pixReadStreamPnm()
245 pixWriteStreamPnm(FILE *fp, in pixWriteStreamPnm() argument
257 if (!fp) in pixWriteStreamPnm()
277 fprintf(fp, "P4\n# Raw PBM file written by leptonlib (www.leptonica.com)\n%d %d\n", w, h); in pixWriteStreamPnm()
284 fwrite(&val8, 1, 1, fp); in pixWriteStreamPnm()
290 …fprintf(fp, "P5\n# Raw PGM file written by leptonlib (www.leptonica.com)\n%d %d\n%d\n", w, h, maxv… in pixWriteStreamPnm()
302 fwrite(&val8, 1, 1, fp); in pixWriteStreamPnm()
311 fwrite(&val16, 2, 1, fp); in pixWriteStreamPnm()
317 … fprintf(fp, "P6\n# Raw PPM file written by leptonlib (www.leptonica.com)\n%d %d\n255\n", w, h); in pixWriteStreamPnm()
323 if (fwrite(lines, 1, filebpl, fp) != filebpl) in pixWriteStreamPnm()
335 if (fwrite(&pel, 1, 3, fp) != 3) in pixWriteStreamPnm()
362 pixWriteStreamAsciiPnm(FILE *fp, in pixWriteStreamAsciiPnm() argument
373 if (!fp) in pixWriteStreamAsciiPnm()
390 fprintf(fp, "P1\n# Ascii PBM file written by leptonlib (www.leptonica.com)\n%d %d\n", w, h); in pixWriteStreamAsciiPnm()
397 fputc('0', fp); in pixWriteStreamAsciiPnm()
399 fputc('1', fp); in pixWriteStreamAsciiPnm()
400 fputc(' ', fp); in pixWriteStreamAsciiPnm()
403 fputc('\n', fp); in pixWriteStreamAsciiPnm()
409 …fprintf(fp, "P2\n# Ascii PGM file written by leptonlib (www.leptonica.com)\n%d %d\n%d\n", w, h, ma… in pixWriteStreamAsciiPnm()
417 fwrite(buffer, 1, 2, fp); in pixWriteStreamAsciiPnm()
422 fwrite(buffer, 1, 3, fp); in pixWriteStreamAsciiPnm()
427 fwrite(buffer, 1, 4, fp); in pixWriteStreamAsciiPnm()
432 fwrite(buffer, 1, 6, fp); in pixWriteStreamAsciiPnm()
436 fputc('\n', fp); in pixWriteStreamAsciiPnm()
443 … fprintf(fp, "P3\n# Ascii PPM file written by leptonlib (www.leptonica.com)\n%d %d\n255\n", w, h); in pixWriteStreamAsciiPnm()
454 fwrite(buffer, 1, 4, fp); in pixWriteStreamAsciiPnm()
457 fputc('\n', fp); in pixWriteStreamAsciiPnm()
498 FILE *fp; in pixReadMemPnm() local
507 if ((fp = fmemopen(data, size, "r")) == NULL) in pixReadMemPnm()
509 pix = pixReadStreamPnm(fp); in pixReadMemPnm()
510 fclose(fp); in pixReadMemPnm()
533 FILE *fp; in pixWriteMemPnm() local
544 if ((fp = open_memstream((char **)pdata, psize)) == NULL) in pixWriteMemPnm()
546 ret = pixWriteStreamPnm(fp, pix); in pixWriteMemPnm()
547 fclose(fp); in pixWriteMemPnm()
588 pnmReadNextAsciiValue(FILE *fp, in pnmReadNextAsciiValue() argument
595 if (!fp) in pnmReadNextAsciiValue()
601 if ((c = fgetc(fp)) == EOF) in pnmReadNextAsciiValue()
605 fseek(fp, -1L, SEEK_CUR); /* back up one byte */ in pnmReadNextAsciiValue()
606 fscanf(fp, "%d", pval); in pnmReadNextAsciiValue()
621 pnmSkipCommentLines(FILE *fp) in pnmSkipCommentLines() argument
627 if (!fp) in pnmSkipCommentLines()
629 if ((c = fgetc(fp)) == EOF) in pnmSkipCommentLines()
634 if ((c = fgetc(fp)) == EOF) in pnmSkipCommentLines()
637 if ((c = fgetc(fp)) == EOF) in pnmSkipCommentLines()
643 fseek(fp, -1L, SEEK_CUR); in pnmSkipCommentLines()