114 #include "config_auto.h" 119 #include "allheaders.h" 131 static const l_int32 MAX_PNM_WIDTH = 100000;
132 static const l_int32 MAX_PNM_HEIGHT = 100000;
147 l_uint8 val8, rval8, gval8, bval8, aval8, mask8;
148 l_uint16 val16, rval16, gval16, bval16, aval16, mask16;
149 l_int32 w, h, d, bps, spp, bpl, wpl, i, j, type;
150 l_int32 val, rval, gval, bval;
152 l_uint32 *line, *data;
155 PROCNAME(
"pixReadStreamPnm");
158 return (
PIX *)ERROR_PTR(
"fp not defined", procName, NULL);
161 return (
PIX *)ERROR_PTR(
"header read failed", procName, NULL);
162 if (bps < 1 || bps > 16)
163 return (
PIX *)ERROR_PTR(
"invalid bps", procName, NULL);
164 if (spp < 1 || spp > 4)
165 return (
PIX *)ERROR_PTR(
"invalid spp", procName, NULL);
167 return (
PIX *)ERROR_PTR(
"pix not made", procName, NULL);
168 pixSetInputFormat(pix, IFF_PNM);
170 wpl = pixGetWpl(pix);
176 for (i = 0; i < h; i++) {
177 for (j = 0; j < w; j++) {
179 return (
PIX *)ERROR_PTR(
"read abend", procName, pix);
187 for (i = 0; i < h; i++) {
188 for (j = 0; j < w; j++) {
190 return (
PIX *)ERROR_PTR(
"read abend", procName, pix);
192 return (
PIX *)ERROR_PTR(
"read abend", procName, pix);
194 return (
PIX *)ERROR_PTR(
"read abend", procName, pix);
203 bpl = (d * w + 7) / 8;
204 for (i = 0; i < h; i++) {
205 line = data + i * wpl;
206 for (j = 0; j < bpl; j++) {
207 if (fread(&val8, 1, 1, fp) != 1)
208 return (
PIX *)ERROR_PTR(
"read error in 4", procName, pix);
216 for (i = 0; i < h; i++) {
217 line = data + i * wpl;
219 for (j = 0; j < w; j++) {
220 if (fread(&val8, 1, 1, fp) != 1)
221 return (
PIX *)ERROR_PTR(
"error in 5", procName, pix);
230 for (j = 0; j < w; j++) {
231 if (fread(&val16, 2, 1, fp) != 1)
232 return (
PIX *)ERROR_PTR(
"16 bpp error", procName, pix);
241 for (i = 0; i < h; i++) {
242 line = data + i * wpl;
243 for (j = 0; j < wpl; j++) {
244 if (fread(&rval8, 1, 1, fp) != 1)
245 return (
PIX *)ERROR_PTR(
"read error type 6",
247 if (fread(&gval8, 1, 1, fp) != 1)
248 return (
PIX *)ERROR_PTR(
"read error type 6",
250 if (fread(&bval8, 1, 1, fp) != 1)
251 return (
PIX *)ERROR_PTR(
"read error type 6",
263 mask8 = (1 << bps) - 1;
266 for (i = 0; i < h; i++) {
267 for (j = 0; j < w; j++) {
268 if (fread(&val8, 1, 1, fp) != 1)
269 return (
PIX *)ERROR_PTR(
"read error type 7",
272 if (bps == 1) val8 ^= 1;
279 for (i = 0; i < h; i++) {
280 for (j = 0; j < w; j++) {
281 if (fread(&val8, 1, 1, fp) != 1)
282 return (
PIX *)ERROR_PTR(
"read error type 7",
284 if (fread(&aval8, 1, 1, fp) != 1)
285 return (
PIX *)ERROR_PTR(
"read error type 7",
288 aval8 = aval8 & mask8;
297 for (i = 0; i < h; i++) {
298 line = data + i * wpl;
299 for (j = 0; j < wpl; j++) {
300 if (fread(&rval8, 1, 1, fp) != 1)
301 return (
PIX *)ERROR_PTR(
"read error type 7",
303 if (fread(&gval8, 1, 1, fp) != 1)
304 return (
PIX *)ERROR_PTR(
"read error type 7",
306 if (fread(&bval8, 1, 1, fp) != 1)
307 return (
PIX *)ERROR_PTR(
"read error type 7",
309 rval8 = rval8 & mask8;
310 gval8 = gval8 & mask8;
311 bval8 = bval8 & mask8;
319 for (i = 0; i < h; i++) {
320 line = data + i * wpl;
321 for (j = 0; j < wpl; j++) {
322 if (fread(&rval8, 1, 1, fp) != 1)
323 return (
PIX *)ERROR_PTR(
"read error type 7",
325 if (fread(&gval8, 1, 1, fp) != 1)
326 return (
PIX *)ERROR_PTR(
"read error type 7",
328 if (fread(&bval8, 1, 1, fp) != 1)
329 return (
PIX *)ERROR_PTR(
"read error type 7",
331 if (fread(&aval8, 1, 1, fp) != 1)
332 return (
PIX *)ERROR_PTR(
"read error type 7",
334 rval8 = rval8 & mask8;
335 gval8 = gval8 & mask8;
336 bval8 = bval8 & mask8;
337 aval8 = aval8 & mask8;
346 mask16 = (1 << 16) - 1;
349 for (i = 0; i < h; i++) {
350 for (j = 0; j < w; j++) {
351 if (fread(&val16, 2, 1, fp) != 1)
352 return (
PIX *)ERROR_PTR(
"read error type 7",
354 val8 = (val16 & mask16) >> 8;
361 for (i = 0; i < h; i++) {
362 for (j = 0; j < w; j++) {
363 if (fread(&val16, 2, 1, fp) != 1)
364 return (
PIX *)ERROR_PTR(
"read error type 7",
366 if (fread(&aval16, 2, 1, fp) != 1)
367 return (
PIX *)ERROR_PTR(
"read error type 7",
369 val8 = (val16 & mask16) >> 8;
370 aval8 = (aval16 & mask16) >> 8;
379 for (i = 0; i < h; i++) {
380 line = data + i * wpl;
381 for (j = 0; j < wpl; j++) {
382 if (fread(&rval16, 2, 1, fp) != 1)
383 return (
PIX *)ERROR_PTR(
"read error type 7",
385 if (fread(&gval16, 2, 1, fp) != 1)
386 return (
PIX *)ERROR_PTR(
"read error type 7",
388 if (fread(&bval16, 2, 1, fp) != 1)
389 return (
PIX *)ERROR_PTR(
"read error type 7",
391 rval8 = (rval16 & mask16) >> 8;
392 gval8 = (gval16 & mask16) >> 8;
393 bval8 = (bval16 & mask16) >> 8;
401 for (i = 0; i < h; i++) {
402 line = data + i * wpl;
403 for (j = 0; j < wpl; j++) {
404 if (fread(&rval16, 2, 1, fp) != 1)
405 return (
PIX *)ERROR_PTR(
"read error type 7",
407 if (fread(&gval16, 2, 1, fp) != 1)
408 return (
PIX *)ERROR_PTR(
"read error type 7",
410 if (fread(&bval16, 2, 1, fp) != 1)
411 return (
PIX *)ERROR_PTR(
"read error type 7",
413 if (fread(&aval16, 2, 1, fp) != 1)
414 return (
PIX *)ERROR_PTR(
"read error type 7",
416 rval8 = (rval16 & mask16) >> 8;
417 gval8 = (gval16 & mask16) >> 8;
418 bval8 = (bval16 & mask16) >> 8;
419 aval8 = (aval16 & mask16) >> 8;
458 PROCNAME(
"readHeaderPnm");
463 if (ptype) *ptype = 0;
467 return ERROR_INT(
"filename not defined", procName, 1);
470 return ERROR_INT(
"image file not found", procName, 1);
498 char tag[16], tupltype[32];
499 l_int32 i, w, h, d, bps, spp, type;
503 PROCNAME(
"freadHeaderPnm");
508 if (ptype) *ptype = 0;
512 return ERROR_INT(
"fp not defined", procName, 1);
514 if (fscanf(fp,
"P%d\n", &type) != 1)
515 return ERROR_INT(
"invalid read for type", procName, 1);
516 if (type < 1 || type > 7)
517 return ERROR_INT(
"invalid pnm file", procName, 1);
520 return ERROR_INT(
"no data in file", procName, 1);
523 w = h = d = bps = spp = maxval = 0;
524 for (i = 0; i < 10; i++) {
526 return ERROR_INT(
"found no next tag", procName, 1);
527 if (!strcmp(tag,
"WIDTH")) {
529 return ERROR_INT(
"failed reading width", procName, 1);
532 if (!strcmp(tag,
"HEIGHT")) {
534 return ERROR_INT(
"failed reading height", procName, 1);
537 if (!strcmp(tag,
"DEPTH")) {
539 return ERROR_INT(
"failed reading depth", procName, 1);
542 if (!strcmp(tag,
"MAXVAL")) {
544 return ERROR_INT(
"failed reading maxval", procName, 1);
547 if (!strcmp(tag,
"TUPLTYPE")) {
549 return ERROR_INT(
"failed reading tuple type", procName, 1);
552 if (!strcmp(tag,
"ENDHDR")) {
553 if (
'\n' != (ch = fgetc(fp)))
554 return ERROR_INT(
"missing LF after ENDHDR", procName, 1);
558 if (w <= 0 || h <= 0 || w > MAX_PNM_WIDTH || h > MAX_PNM_HEIGHT) {
559 L_INFO(
"invalid size: w = %d, h = %d\n", procName, w, h);
564 }
else if (maxval == 3) {
566 }
else if (maxval == 15) {
568 }
else if (maxval == 255) {
570 }
else if (maxval == 0xffff) {
573 L_INFO(
"invalid maxval = %d\n", procName, maxval);
587 L_INFO(
"invalid depth = %d\n", procName, spp);
592 if (fscanf(fp,
"%d %d\n", &w, &h) != 2)
593 return ERROR_INT(
"invalid read for w,h", procName, 1);
594 if (w <= 0 || h <= 0 || w > MAX_PNM_WIDTH || h > MAX_PNM_HEIGHT) {
595 L_INFO(
"invalid size: w = %d, h = %d\n", procName, w, h);
608 if (type == 1 || type == 4) {
612 }
else if (type == 2 || type == 5) {
614 return ERROR_INT(
"invalid read for maxval (2,5)", procName, 1);
617 }
else if (maxval == 15) {
619 }
else if (maxval == 255) {
621 }
else if (maxval == 0xffff) {
624 fprintf(stderr,
"maxval = %d\n", maxval);
625 return ERROR_INT(
"invalid maxval", procName, 1);
631 return ERROR_INT(
"invalid read for maxval (3,6)", procName, 1);
633 L_WARNING(
"unexpected maxval = %d\n", procName, maxval);
642 if (ptype) *ptype = type;
643 if (pbps) *pbps = bps;
644 if (pspp) *pspp = spp;
673 l_int32 h, w, d, ds, i, j, wpls, bpl, filebpl, writeerror, maxval;
674 l_uint32 *pword, *datas, *lines;
677 PROCNAME(
"pixWriteStreamPnm");
680 return ERROR_INT(
"fp not defined", procName, 1);
682 return ERROR_INT(
"pix not defined", procName, 1);
685 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 24 && d != 32)
686 return ERROR_INT(
"d not in {1,2,4,8,16,24,32}", procName, 1);
687 if (d == 32 && pixGetSpp(pix) == 4)
691 if (pixGetColormap(pix) != NULL)
695 ds = pixGetDepth(pixs);
697 wpls = pixGetWpl(pixs);
702 fprintf(fp,
"P4\n# Raw PBM file written by leptonica " 703 "(www.leptonica.com)\n%d %d\n", w, h);
706 for (i = 0; i < h; i++) {
707 lines = datas + i * wpls;
708 for (j = 0; j < bpl; j++) {
710 fwrite(&val8, 1, 1, fp);
713 }
else if (ds == 2 || ds == 4 || ds == 8 || ds == 16) {
714 maxval = (1 << ds) - 1;
715 fprintf(fp,
"P5\n# Raw PGM file written by leptonica " 716 "(www.leptonica.com)\n%d %d\n%d\n", w, h, maxval);
719 for (i = 0; i < h; i++) {
720 lines = datas + i * wpls;
721 for (j = 0; j < w; j++) {
728 fwrite(&val8, 1, 1, fp);
732 for (i = 0; i < h; i++) {
733 lines = datas + i * wpls;
734 for (j = 0; j < w; j++) {
736 fwrite(&val16, 2, 1, fp);
741 fprintf(fp,
"P6\n# Raw PPM file written by leptonica " 742 "(www.leptonica.com)\n%d %d\n255\n", w, h);
746 for (i = 0; i < h; i++) {
747 lines = datas + i * wpls;
748 if (fwrite(lines, 1, filebpl, fp) != filebpl)
752 for (i = 0; i < h; i++) {
753 lines = datas + i * wpls;
754 for (j = 0; j < wpls; j++) {
759 if (fwrite(pel, 1, 3, fp) != 3)
768 return ERROR_INT(
"image write fail", procName, 1);
791 l_int32 h, w, d, ds, i, j, k, maxval, count;
795 PROCNAME(
"pixWriteStreamAsciiPnm");
798 return ERROR_INT(
"fp not defined", procName, 1);
800 return ERROR_INT(
"pix not defined", procName, 1);
803 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 32)
804 return ERROR_INT(
"d not in {1,2,4,8,16,32}", procName, 1);
807 if (pixGetColormap(pix) != NULL)
811 ds = pixGetDepth(pixs);
814 fprintf(fp,
"P1\n# Ascii PBM file written by leptonica " 815 "(www.leptonica.com)\n%d %d\n", w, h);
818 for (i = 0; i < h; i++) {
819 for (j = 0; j < w; j++) {
833 }
else if (ds == 2 || ds == 4 || ds == 8 || ds == 16) {
834 maxval = (1 << ds) - 1;
835 fprintf(fp,
"P2\n# Ascii PGM file written by leptonica " 836 "(www.leptonica.com)\n%d %d\n%d\n", w, h, maxval);
839 for (i = 0; i < h; i++) {
840 for (j = 0; j < w; j++) {
843 snprintf(buffer,
sizeof(buffer),
"%1d ", val);
844 fwrite(buffer, 1, 2, fp);
846 }
else if (ds == 4) {
847 snprintf(buffer,
sizeof(buffer),
"%2d ", val);
848 fwrite(buffer, 1, 3, fp);
850 }
else if (ds == 8) {
851 snprintf(buffer,
sizeof(buffer),
"%3d ", val);
852 fwrite(buffer, 1, 4, fp);
855 snprintf(buffer,
sizeof(buffer),
"%5d ", val);
856 fwrite(buffer, 1, 6, fp);
866 fprintf(fp,
"P3\n# Ascii PPM file written by leptonica " 867 "(www.leptonica.com)\n%d %d\n255\n", w, h);
869 for (i = 0; i < h; i++) {
870 for (j = 0; j < w; j++) {
875 for (k = 0; k < 3; k++) {
876 snprintf(buffer,
sizeof(buffer),
"%3d ", cval[k]);
877 fwrite(buffer, 1, 4, fp);
914 l_int32 h, w, d, ds, i, j;
915 l_int32 wpls, spps, filebpl, writeerror, maxval;
916 l_uint32 *pword, *datas, *lines;
919 PROCNAME(
"pixWriteStreamPam");
922 return ERROR_INT(
"fp not defined", procName, 1);
924 return ERROR_INT(
"pix not defined", procName, 1);
927 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 24 && d != 32)
928 return ERROR_INT(
"d not in {1,2,4,8,16,24,32}", procName, 1);
931 if (pixGetColormap(pix) != NULL)
935 ds = pixGetDepth(pixs);
937 wpls = pixGetWpl(pixs);
938 spps = pixGetSpp(pixs);
940 maxval = (1 << ds) - 1;
945 fprintf(fp,
"P7\n# Arbitrary PAM file written by leptonica " 946 "(www.leptonica.com)\n");
947 fprintf(fp,
"WIDTH %d\n", w);
948 fprintf(fp,
"HEIGHT %d\n", h);
949 fprintf(fp,
"DEPTH %d\n", spps);
950 fprintf(fp,
"MAXVAL %d\n", maxval);
951 if (spps == 1 && ds == 1)
952 fprintf(fp,
"TUPLTYPE BLACKANDWHITE\n");
954 fprintf(fp,
"TUPLTYPE GRAYSCALE\n");
956 fprintf(fp,
"TUPLTYPE RGB\n");
958 fprintf(fp,
"TUPLTYPE RGB_ALPHA\n");
959 fprintf(fp,
"ENDHDR\n");
963 for (i = 0; i < h; i++) {
964 lines = datas + i * wpls;
965 for (j = 0; j < w; j++) {
968 if (fwrite(&val8, 1, 1, fp) != 1)
975 for (i = 0; i < h; i++) {
976 lines = datas + i * wpls;
977 for (j = 0; j < w; j++) {
979 if (fwrite(&val8, 1, 1, fp) != 1)
986 for (i = 0; i < h; i++) {
987 lines = datas + i * wpls;
988 for (j = 0; j < w; j++) {
990 if (fwrite(&val8, 1, 1, fp) != 1)
997 for (i = 0; i < h; i++) {
998 lines = datas + i * wpls;
999 for (j = 0; j < w; j++) {
1001 if (fwrite(&val8, 1, 1, fp) != 1)
1008 for (i = 0; i < h; i++) {
1009 lines = datas + i * wpls;
1010 for (j = 0; j < w; j++) {
1012 if (fwrite(&val16, 2, 1, fp) != 1)
1020 for (i = 0; i < h; i++) {
1021 lines = datas + i * wpls;
1022 if (fwrite(lines, 1, filebpl, fp) != filebpl)
1030 for (i = 0; i < h; i++) {
1031 lines = datas + i * wpls;
1032 for (j = 0; j < wpls; j++) {
1037 if (fwrite(pel, 1, 3, fp) != 3)
1043 for (i = 0; i < h; i++) {
1044 lines = datas + i * wpls;
1045 for (j = 0; j < wpls; j++) {
1051 if (fwrite(pel, 1, 4, fp) != 4)
1062 return ERROR_INT(
"image write fail", procName, 1);
1090 PROCNAME(
"pixReadMemPnm");
1093 return (
PIX *)ERROR_PTR(
"data not defined", procName, NULL);
1095 return (
PIX *)ERROR_PTR(
"stream not opened", procName, NULL);
1098 if (!pix) L_ERROR(
"pix not read\n", procName);
1129 PROCNAME(
"readHeaderMemPnm");
1132 return ERROR_INT(
"data not defined", procName, 1);
1135 return ERROR_INT(
"stream not opened", procName, 1);
1139 return ERROR_INT(
"header data read failed", procName, 1);
1166 PROCNAME(
"pixWriteMemPnm");
1168 if (pdata) *pdata = NULL;
1169 if (psize) *psize = 0;
1171 return ERROR_INT(
"&data not defined", procName, 1 );
1173 return ERROR_INT(
"&size not defined", procName, 1 );
1175 return ERROR_INT(
"&pix not defined", procName, 1 );
1178 if ((fp = open_memstream((
char **)pdata, psize)) == NULL)
1179 return ERROR_INT(
"stream not opened", procName, 1);
1182 L_INFO(
"work-around: writing to a temp file\n", procName);
1185 return ERROR_INT(
"tmpfile stream not opened", procName, 1);
1187 if ((fp = tmpfile()) == NULL)
1188 return ERROR_INT(
"tmpfile stream not opened", procName, 1);
1221 PROCNAME(
"pixWriteMemPam");
1223 if (pdata) *pdata = NULL;
1224 if (psize) *psize = 0;
1226 return ERROR_INT(
"&data not defined", procName, 1 );
1228 return ERROR_INT(
"&size not defined", procName, 1 );
1230 return ERROR_INT(
"&pix not defined", procName, 1 );
1233 if ((fp = open_memstream((
char **)pdata, psize)) == NULL)
1234 return ERROR_INT(
"stream not opened", procName, 1);
1237 L_INFO(
"work-around: writing to a temp file\n", procName);
1240 return ERROR_INT(
"tmpfile stream not opened", procName, 1);
1242 if ((fp = tmpfile()) == NULL)
1243 return ERROR_INT(
"tmpfile stream not opened", procName, 1);
1272 PROCNAME(
"pnmReadNextAsciiValue");
1275 return ERROR_INT(
"&val not defined", procName, 1);
1278 return ERROR_INT(
"stream not open", procName, 1);
1280 if ((c = fgetc(fp)) == EOF)
1282 }
while (c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r');
1284 fseek(fp, -1L, SEEK_CUR);
1285 ignore = fscanf(fp,
"%d", pval);
1310 l_int32 i, c, foundws;
1312 PROCNAME(
"pnmReadNextNumber");
1315 return ERROR_INT(
"&val not defined", procName, 1);
1318 return ERROR_INT(
"stream not open", procName, 1);
1323 for (i = 0; i < 8; i++)
1325 for (i = 0; i < 8; i++) {
1326 if ((c = fgetc(fp)) == EOF)
1327 return ERROR_INT(
"end of file reached", procName, 1);
1328 if (c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r') {
1334 return ERROR_INT(
"char read is not a digit", procName, 1);
1338 return ERROR_INT(
"no whitespace found", procName, 1);
1339 if (sscanf(buf,
"%d", pval) != 1)
1340 return ERROR_INT(
"invalid read", procName, 1);
1368 PROCNAME(
"pnmReadNextString");
1371 return ERROR_INT(
"buff not defined", procName, 1);
1374 return ERROR_INT(
"stream not open", procName, 1);
1376 return ERROR_INT(
"size is too small", procName, 1);
1379 if ((c = fgetc(fp)) == EOF)
1380 return ERROR_INT(
"end of file reached", procName, 1);
1381 }
while (c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r');
1388 if ((c = fgetc(fp)) == EOF)
1389 return ERROR_INT(
"end of file reached", procName, 1);
1390 }
while (c !=
'\n');
1391 if ((c = fgetc(fp)) == EOF)
1392 return ERROR_INT(
"end of file reached", procName, 1);
1398 for (i = 0; i < size - 1; i++) {
1399 if (c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r')
1402 if ((c = fgetc(fp)) == EOF)
1403 return ERROR_INT(
"end of file reached", procName, 1);
1408 fseek(fp, -1L, SEEK_CUR);
1410 return ERROR_INT(
"buff size too small", procName, 1);
1414 if ((c = fgetc(fp)) == EOF)
1415 return ERROR_INT(
"end of file reached", procName, 1);
1416 if (c !=
' ' && c !=
'\t')
1421 fseek(fp, -1L, SEEK_CUR);
1440 PROCNAME(
"pnmSkipCommentLines");
1443 return ERROR_INT(
"stream not open", procName, 1);
1444 if ((c = fgetc(fp)) == EOF)
1449 if ((c = fgetc(fp)) == EOF)
1451 }
while (c !=
'\n');
1452 if ((c = fgetc(fp)) == EOF)
1458 fseek(fp, -1L, SEEK_CUR);
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
l_ok pixWriteMemPam(l_uint8 **pdata, size_t *psize, PIX *pix)
pixWriteMemPam()
l_ok readHeaderPnm(const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp)
readHeaderPnm()
static l_int32 pnmSkipCommentLines(FILE *fp)
pnmSkipCommentLines()
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
FILE * fopenReadFromMemory(const l_uint8 *data, size_t size)
fopenReadFromMemory()
#define SET_DATA_QBIT(pdata, n, val)
l_uint32 * pixGetData(PIX *pix)
pixGetData()
PIX * pixReadMemPnm(const l_uint8 *data, size_t size)
pixReadMemPnm()
#define GET_DATA_BIT(pdata, n)
l_ok readHeaderMemPnm(const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp)
readHeaderMemPnm()
static l_int32 pnmReadNextString(FILE *fp, char *buff, l_int32 size)
pnmReadNextString()
PIX * pixReadStreamPnm(FILE *fp)
pixReadStreamPnm()
#define SET_DATA_DIBIT(pdata, n, val)
l_ok freadHeaderPnm(FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp)
freadHeaderPnm()
l_ok pixSetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 val)
pixSetPixel()
l_ok composeRGBAPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_int32 aval, l_uint32 *ppixel)
composeRGBAPixel()
#define SET_DATA_BYTE(pdata, n, val)
#define GET_DATA_QBIT(pdata, n)
FILE * fopenWriteWinTempfile()
fopenWriteWinTempfile()
#define GET_DATA_BYTE(pdata, n)
PIX * pixClone(PIX *pixs)
pixClone()
l_ok pixWriteStreamPnm(FILE *fp, PIX *pix)
pixWriteStreamPnm()
void pixDestroy(PIX **ppix)
pixDestroy()
static l_int32 pnmReadNextNumber(FILE *fp, l_int32 *pval)
pnmReadNextNumber()
l_ok pixGetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 *pval)
pixGetPixel()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
FILE * fopenReadStream(const char *filename)
fopenReadStream()
l_uint8 * l_binaryReadStream(FILE *fp, size_t *pnbytes)
l_binaryReadStream()
#define GET_DATA_TWO_BYTES(pdata, n)
#define GET_DATA_DIBIT(pdata, n)
static l_int32 pnmReadNextAsciiValue(FILE *fp, l_int32 *pval)
pnmReadNextAsciiValue()
l_ok pixWriteStreamPam(FILE *fp, PIX *pix)
pixWriteStreamPam()
l_ok pixWriteStreamAsciiPnm(FILE *fp, PIX *pix)
pixWriteStreamAsciiPnm()
l_ok composeRGBPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *ppixel)
composeRGBPixel()
#define SET_DATA_TWO_BYTES(pdata, n, val)
l_ok pixWriteMemPnm(l_uint8 **pdata, size_t *psize, PIX *pix)
pixWriteMemPnm()