118 #include <config_auto.h>
123 #include "allheaders.h"
146 l_int32 npts, diff, getyofx, sign, i, x, y;
151 if (x1 == x2 && y1 == y2) {
154 }
else if (L_ABS(x2 - x1) >= L_ABS(y2 - y1)) {
156 npts = L_ABS(x2 - x1) + 1;
158 sign = L_SIGN(x2 - x1);
159 slope = (l_float32)(sign * (y2 - y1)) / (l_float32)diff;
162 npts = L_ABS(y2 - y1) + 1;
164 sign = L_SIGN(y2 - y1);
165 slope = (l_float32)(sign * (x2 - x1)) / (l_float32)diff;
169 return (
PTA *)ERROR_PTR(
"pta not made", __func__, NULL);
178 for (i = 0; i < npts; i++) {
180 y = (l_int32)(y1 + (l_float32)i * slope + 0.5);
184 for (i = 0; i < npts; i++) {
185 x = (l_int32)(x1 + (l_float32)i * slope + 0.5);
210 l_int32 i, x1a, x2a, y1a, y2a;
214 L_WARNING(
"width < 1; setting to 1\n", __func__);
219 return (
PTA *)ERROR_PTR(
"ptaj not made", __func__, NULL);
224 if (L_ABS(x1 - x2) > L_ABS(y1 - y2)) {
225 for (i = 1; i < width; i++) {
227 y1a = y1 - (i + 1) / 2;
228 y2a = y2 - (i + 1) / 2;
230 y1a = y1 + (i + 1) / 2;
231 y2a = y2 + (i + 1) / 2;
239 for (i = 1; i < width; i++) {
241 x1a = x1 - (i + 1) / 2;
242 x2a = x2 - (i + 1) / 2;
244 x1a = x1 + (i + 1) / 2;
245 x2a = x2 + (i + 1) / 2;
279 return (
PTA *)ERROR_PTR(
"box not defined", __func__, NULL);
281 L_WARNING(
"width < 1; setting to 1\n", __func__);
287 if (w == 0 || h == 0)
288 return (
PTA *)ERROR_PTR(
"box has w = 0 or h = 0", __func__, NULL);
290 if ((width & 1) == 1) {
292 x + w - 1 + width / 2, y, width);
296 x + w - 1, y + h - 2 - width / 2, width);
300 x - width / 2, y + h - 1, width);
304 x, y + 1 + width / 2, width);
309 x + w - 2 + width / 2, y, width);
313 x + w - 1, y + h - 2 - width / 2, width);
317 x - width / 2, y + h - 1, width);
321 x, y + 0 + width / 2, width);
353 PTA *ptad, *ptat, *pta;
356 return (
PTA *)ERROR_PTR(
"boxa not defined", __func__, NULL);
358 L_WARNING(
"width < 1; setting to 1\n", __func__);
364 for (i = 0; i < n; i++) {
408 l_int32 bx, by, bh, bw, x, y, x1, y1, x2, y2, i, n, npts;
412 return (
PTA *)ERROR_PTR(
"box not defined", __func__, NULL);
414 return (
PTA *)ERROR_PTR(
"spacing not > 1", __func__, NULL);
417 return (
PTA *)ERROR_PTR(
"invalid line orientation", __func__, NULL);
419 if (bw == 0 || bh == 0)
420 return (
PTA *)ERROR_PTR(
"box has bw = 0 or bh = 0", __func__, NULL);
422 L_WARNING(
"width < 1; setting to 1\n", __func__);
434 n = 1 + bh / spacing;
435 for (i = 0; i < n; i++) {
436 y = by + (i * (bh - 1)) / (n - 1);
442 n = 1 + bw / spacing;
443 for (i = 0; i < n; i++) {
444 x = bx + (i * (bw - 1)) / (n - 1);
450 n = 2 + (l_int32)((bw + bh) / (1.4 * spacing));
451 for (i = 0; i < n; i++) {
452 x = (l_int32)(bx + (i + 0.5) * 1.4 * spacing);
461 n = 2 + (l_int32)((bw + bh) / (1.4 * spacing));
462 for (i = 0; i < n; i++) {
463 x = (l_int32)(bx - bh + (i + 0.5) * 1.4 * spacing);
512 PTA *ptad, *ptat, *pta;
515 return (
PTA *)ERROR_PTR(
"boxa not defined", __func__, NULL);
517 return (
PTA *)ERROR_PTR(
"spacing not > 1", __func__, NULL);
519 L_WARNING(
"width < 1; setting to 1\n", __func__);
524 return (
PTA *)ERROR_PTR(
"invalid line orientation", __func__, NULL);
528 for (i = 0; i < n; i++) {
563 l_int32 i, n, x, y, w, h;
569 return (
PTAA *)ERROR_PTR(
"boxa not defined", __func__, NULL);
573 for (i = 0; i < n; i++) {
579 ptaAddPt(pta, x + w - 1, y + h - 1);
624 return (
PTAA *)ERROR_PTR(
"boxa not defined", __func__, NULL);
626 return (
PTAA *)ERROR_PTR(
"spacing not > 1", __func__, NULL);
628 L_WARNING(
"width < 1; setting to 1\n", __func__);
633 return (
PTAA *)ERROR_PTR(
"invalid line orientation", __func__, NULL);
637 for (i = 0; i < n; i++) {
663 l_int32 i, n, x1, y1, x2, y2;
664 PTA *ptad, *ptat, *pta;
667 return (
PTA *)ERROR_PTR(
"ptas not defined", __func__, NULL);
669 L_WARNING(
"width < 1; setting to 1\n", __func__);
679 for (i = 1; i < n; i++) {
720 l_int32 i, j, bx, by, x1, x2, y1, y2;
725 if (nx < 1 || ny < 1)
726 return (
PTA *)ERROR_PTR(
"nx and ny must be > 0", __func__, NULL);
727 if (w < 2 * nx || h < 2 * ny)
728 return (
PTA *)ERROR_PTR(
"w and/or h too small", __func__, NULL);
730 L_WARNING(
"width < 1; setting to 1\n", __func__);
735 bx = (w + nx - 1) / nx;
736 by = (h + ny - 1) / ny;
737 for (i = 0; i < ny; i++) {
739 y2 = L_MIN(y1 + by, h - 1);
740 for (j = 0; j < nx; j++) {
742 x2 = L_MIN(x1 + bx, w - 1);
743 box =
boxCreate(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
772 l_int32 i, n, x, y, xp, yp;
776 return (
PTA *)ERROR_PTR(
"ptas not defined", __func__, NULL);
782 for (i = 1; i < n; i++) {
784 if (x != xp && y != yp)
814 l_float32 radthresh, sqdist;
818 return (
PTA *)ERROR_PTR(
"radius must be >= 1", __func__, NULL);
821 radthresh = (radius + 0.5) * (radius + 0.5);
822 for (y = 0; y <= 2 * radius; y++) {
823 for (x = 0; x <= 2 * radius; x++) {
824 sqdist = (l_float32)((y - radius) * (y - radius) +
825 (x - radius) * (x - radius));
826 if (sqdist <= radthresh)
855 return (
PTA *)ERROR_PTR(
"side must be > 0", __func__, NULL);
858 for (y = 0; y < side; y++)
859 for (x = 0; x < side; x++)
889 x2 = x + (l_int32)((length - 1.0) * cos(radang));
890 y2 = y + (l_int32)((length - 1.0) * sin(radang));
914 return ERROR_INT(
"&x and &y not both defined", __func__, 1);
916 *px = xr + dist * cos(radang);
917 *py = yr + dist * sin(radang);
953 l_int32 w, h, size, rval, gval, bval;
958 return ERROR_INT(
"&pix not defined", __func__, 1);
960 return ERROR_INT(
"pix not defined", __func__, 1);
967 return ERROR_INT(
"pta not made", __func__, 1);
969 if (pixGetDepth(*ppix) != 32) {
1009 l_int32 orient, refpos;
1012 return (
PTA *)ERROR_PTR(
"na not defined", __func__, NULL);
1020 return (
PTA *)ERROR_PTR(
"invalid plotloc", __func__, NULL);
1028 refpos = size - max - 1;
1067 l_int32 rval, gval, bval;
1072 return ERROR_INT(
"&pix not defined", __func__, 1);
1074 return ERROR_INT(
"pix not defined", __func__, 1);
1078 return ERROR_INT(
"pta not made", __func__, 1);
1080 if (pixGetDepth(*ppix) != 32) {
1129 l_int32 i, n, maxw, maxh;
1130 l_float32 minval, maxval, absval, val, scale, start, del;
1131 PTA *pta1, *pta2, *ptad;
1134 return (
PTA *)ERROR_PTR(
"na not defined", __func__, NULL);
1136 return (
PTA *)ERROR_PTR(
"invalid orient", __func__, NULL);
1137 if (linewidth < 1) {
1138 L_WARNING(
"linewidth < 1; setting to 1\n", __func__);
1141 if (linewidth > 7) {
1142 L_WARNING(
"linewidth > 7; setting to 7\n", __func__);
1148 absval = L_MAX(L_ABS(minval), L_ABS(maxval));
1149 scale = (l_float32)max / (l_float32)absval;
1155 for (i = 0; i < n; i++) {
1158 ptaAddPt(pta1, start + i * del, refpos + scale * val);
1159 maxw = (del >= 0) ? start + n * del + linewidth
1160 : start + linewidth;
1161 maxh = refpos + max + linewidth;
1163 ptaAddPt(pta1, refpos + scale * val, start + i * del);
1164 maxw = refpos + max + linewidth;
1165 maxh = (del >= 0) ? start + n * del + linewidth
1166 : start + linewidth;
1171 if (linewidth > 1) {
1172 if (linewidth % 2 == 0)
1177 linewidth / 2, maxw, maxh);
1191 start, refpos + max);
1198 refpos + max, start);
1236 l_int32 i, n, x, y, w, h, d, maxval;
1239 return ERROR_INT(
"pix not defined", __func__, 1);
1240 if (pixGetColormap(pix))
1241 return ERROR_INT(
"pix is colormapped", __func__, 1);
1243 return ERROR_INT(
"pta not defined", __func__, 1);
1245 return ERROR_INT(
"invalid op", __func__, 1);
1265 maxval = 0xffffffff;
1271 for (i = 0; i < n; i++) {
1273 if (x < 0 || x >= w)
1275 if (y < 0 || y >= h)
1325 l_int32 i, n, x, y, w, h, d, index;
1331 return ERROR_INT(
"pix not defined", __func__, 1);
1333 return ERROR_INT(
"pta not defined", __func__, 1);
1334 d = pixGetDepth(pix);
1335 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 32)
1336 return ERROR_INT(
"depth not in {1,2,4,8,32}", __func__, 1);
1343 cmap = pixGetColormap(pix);
1349 val = (rval + gval + bval) / (3 * 64);
1351 val = (rval + gval + bval) / (3 * 16);
1353 val = (rval + gval + bval) / 3;
1359 for (i = 0; i < n; i++) {
1361 if (x < 0 || x >= w)
1363 if (y < 0 || y >= h)
1399 l_int32 i, n, x, y, w, h;
1400 l_uint8 nrval, ngval, nbval;
1402 l_float32 frval, fgval, fbval;
1405 return ERROR_INT(
"pix not defined", __func__, 1);
1407 return ERROR_INT(
"pta not defined", __func__, 1);
1408 if (pixGetDepth(pix) != 32)
1409 return ERROR_INT(
"depth not 32 bpp", __func__, 1);
1410 if (fract < 0.0 || fract > 1.0) {
1411 L_WARNING(
"fract must be in [0.0, 1.0]; setting to 0.5\n", __func__);
1417 frval = fract * rval;
1418 fgval = fract * gval;
1419 fbval = fract * bval;
1420 for (i = 0; i < n; i++) {
1422 if (x < 0 || x >= w)
1424 if (y < 0 || y >= h)
1428 nrval = (l_uint8)((1. - fract) * nrval + frval);
1430 ngval = (l_uint8)((1. - fract) * ngval + fgval);
1432 nbval = (l_uint8)((1. - fract) * nbval + fbval);
1466 return ERROR_INT(
"pix not defined", __func__, 1);
1468 L_WARNING(
"width must be > 0; setting to 1\n", __func__);
1472 return ERROR_INT(
"invalid op", __func__, 1);
1475 return ERROR_INT(
"pta not made", __func__, 1);
1506 return ERROR_INT(
"pix not defined", __func__, 1);
1508 L_WARNING(
"width must be > 0; setting to 1\n", __func__);
1513 return ERROR_INT(
"pta not made", __func__, 1);
1546 return ERROR_INT(
"pix not defined", __func__, 1);
1548 L_WARNING(
"width must be > 0; setting to 1\n", __func__);
1553 return ERROR_INT(
"pta not made", __func__, 1);
1578 return ERROR_INT(
"pix not defined", __func__, 1);
1580 return ERROR_INT(
"box not defined", __func__, 1);
1582 L_WARNING(
"width < 1; setting to 1\n", __func__);
1586 return ERROR_INT(
"invalid op", __func__, 1);
1589 return ERROR_INT(
"pta not made", __func__, 1);
1616 return ERROR_INT(
"pix not defined", __func__, 1);
1618 return ERROR_INT(
"box not defined", __func__, 1);
1620 L_WARNING(
"width < 1; setting to 1\n", __func__);
1625 return ERROR_INT(
"pta not made", __func__, 1);
1655 return ERROR_INT(
"pix not defined", __func__, 1);
1657 return ERROR_INT(
"box not defined", __func__, 1);
1659 L_WARNING(
"width < 1; setting to 1\n", __func__);
1664 return ERROR_INT(
"pta not made", __func__, 1);
1689 return ERROR_INT(
"pix not defined", __func__, 1);
1691 return ERROR_INT(
"boxa not defined", __func__, 1);
1693 L_WARNING(
"width < 1; setting to 1\n", __func__);
1697 return ERROR_INT(
"invalid op", __func__, 1);
1700 return ERROR_INT(
"pta not made", __func__, 1);
1727 return ERROR_INT(
"pix not defined", __func__, 1);
1729 return ERROR_INT(
"boxa not defined", __func__, 1);
1731 L_WARNING(
"width < 1; setting to 1\n", __func__);
1736 return ERROR_INT(
"pta not made", __func__, 1);
1768 return ERROR_INT(
"pix not defined", __func__, 1);
1770 return ERROR_INT(
"boxa not defined", __func__, 1);
1772 L_WARNING(
"width < 1; setting to 1\n", __func__);
1777 return ERROR_INT(
"pta not made", __func__, 1);
1808 return ERROR_INT(
"pix not defined", __func__, 1);
1810 return ERROR_INT(
"box not defined", __func__, 1);
1812 return ERROR_INT(
"spacing not > 1", __func__, 1);
1814 L_WARNING(
"width < 1; setting to 1\n", __func__);
1819 return ERROR_INT(
"invalid line orientation", __func__, 1);
1821 return ERROR_INT(
"invalid op", __func__, 1);
1825 return ERROR_INT(
"pta not made", __func__, 1);
1858 return ERROR_INT(
"pix not defined", __func__, 1);
1860 return ERROR_INT(
"box not defined", __func__, 1);
1862 return ERROR_INT(
"spacing not > 1", __func__, 1);
1864 L_WARNING(
"width < 1; setting to 1\n", __func__);
1869 return ERROR_INT(
"invalid line orientation", __func__, 1);
1873 return ERROR_INT(
"pta not made", __func__, 1);
1909 return ERROR_INT(
"pix not defined", __func__, 1);
1911 return ERROR_INT(
"box not defined", __func__, 1);
1913 return ERROR_INT(
"spacing not > 1", __func__, 1);
1915 L_WARNING(
"width < 1; setting to 1\n", __func__);
1920 return ERROR_INT(
"invalid line orientation", __func__, 1);
1924 return ERROR_INT(
"pta not made", __func__, 1);
1971 return ERROR_INT(
"pix not defined", __func__, 1);
1972 if (!pixm || pixGetDepth(pixm) != 1)
1973 return ERROR_INT(
"pixm not defined or not 1 bpp", __func__, 1);
1975 return ERROR_INT(
"spacing not > 1", __func__, 1);
1977 L_WARNING(
"width < 1; setting to 1\n", __func__);
1982 return ERROR_INT(
"invalid line orientation", __func__, 1);
2032 return ERROR_INT(
"pix not defined", __func__, 1);
2034 return ERROR_INT(
"boxa not defined", __func__, 1);
2036 return ERROR_INT(
"spacing not > 1", __func__, 1);
2038 L_WARNING(
"width < 1; setting to 1\n", __func__);
2043 return ERROR_INT(
"invalid line orientation", __func__, 1);
2045 return ERROR_INT(
"invalid op", __func__, 1);
2049 return ERROR_INT(
"pta not made", __func__, 1);
2084 return ERROR_INT(
"pix not defined", __func__, 1);
2086 return ERROR_INT(
"boxa not defined", __func__, 1);
2088 return ERROR_INT(
"spacing not > 1", __func__, 1);
2090 L_WARNING(
"width < 1; setting to 1\n", __func__);
2095 return ERROR_INT(
"invalid line orientation", __func__, 1);
2099 return ERROR_INT(
"pta not made", __func__, 1);
2137 return ERROR_INT(
"pix not defined", __func__, 1);
2139 return ERROR_INT(
"boxa not defined", __func__, 1);
2141 return ERROR_INT(
"spacing not > 1", __func__, 1);
2143 L_WARNING(
"width < 1; setting to 1\n", __func__);
2148 return ERROR_INT(
"invalid line orientation", __func__, 1);
2152 return ERROR_INT(
"pta not made", __func__, 1);
2184 return ERROR_INT(
"pix not defined", __func__, 1);
2186 return ERROR_INT(
"ptas not defined", __func__, 1);
2188 L_WARNING(
"width < 1; setting to 1\n", __func__);
2192 return ERROR_INT(
"invalid op", __func__, 1);
2195 return ERROR_INT(
"pta not made", __func__, 1);
2229 return ERROR_INT(
"pix not defined", __func__, 1);
2231 return ERROR_INT(
"ptas not defined", __func__, 1);
2233 L_WARNING(
"width < 1; setting to 1\n", __func__);
2238 return ERROR_INT(
"pta not made", __func__, 1);
2272 return ERROR_INT(
"pix not defined", __func__, 1);
2274 return ERROR_INT(
"ptas not defined", __func__, 1);
2276 L_WARNING(
"width < 1; setting to 1\n", __func__);
2281 return ERROR_INT(
"pta not made", __func__, 1);
2310 return ERROR_INT(
"pix not defined", __func__, 1);
2311 if (nx < 1 || ny < 1)
2312 return ERROR_INT(
"nx, ny must be > 0", __func__, 1);
2314 L_WARNING(
"width < 1; setting to 1\n", __func__);
2320 return ERROR_INT(
"pta not made", __func__, 1);
2362 l_int32 i, n, index, rval, gval, bval;
2368 return (
PIX *)ERROR_PTR(
"pix not defined", __func__, NULL);
2370 return (
PIX *)ERROR_PTR(
"ptaa not defined", __func__, NULL);
2371 if (polyflag != 0 && width < 1) {
2372 L_WARNING(
"width < 1; setting to 1\n", __func__);
2383 for (i = 0; i < n; i++) {
2384 index = 1 + (i % 254);
2428 l_float32 fxmin, fxmax, fymin, fymax;
2432 if (pxmin) *pxmin = 0;
2433 if (pymin) *pymin = 0;
2435 return (
PIX *)ERROR_PTR(
"ptas not defined", __func__, NULL);
2439 return (
PIX *)ERROR_PTR(
"pta1 not made", __func__, NULL);
2446 ptaGetRange(pta2, &fxmin, &fxmax, &fymin, &fymax);
2447 if (pxmin) *pxmin = (l_int32)(fxmin + 0.5);
2448 if (pymin) *pymin = (l_int32)(fymin + 0.5);
2449 pixd =
pixCreate((l_int32)(fxmax + 0.5) + 1, (l_int32)(fymax + 0.5) + 1, 1);
2481 l_int32 w, h, i, n, inside, found;
2482 l_int32 *xstart, *xend;
2485 if (!pixs || (pixGetDepth(pixs) != 1))
2486 return (
PIX *)ERROR_PTR(
"pixs undefined or not 1 bpp", __func__, NULL);
2488 return (
PIX *)ERROR_PTR(
"pta not defined", __func__, NULL);
2490 return (
PIX *)ERROR_PTR(
"pta has < 2 pts", __func__, NULL);
2493 xstart = (l_int32 *)LEPT_CALLOC(L_MAX(1, w / 2),
sizeof(l_int32));
2494 xend = (l_int32 *)LEPT_CALLOC(L_MAX(1, w / 2),
sizeof(l_int32));
2495 if (!xstart || !xend) {
2498 return (
PIX *)ERROR_PTR(
"xstart and xend not made", __func__, NULL);
2505 for (i = ymin + 1; i < h; i++) {
2516 L_WARNING(
"nothing found to fill\n", __func__);
2531 pixOr(pixd, pixd, pixs);
2565 l_int32 w, h, d, maxval, wpls, wpld, i, j, val, test;
2566 l_uint32 *datas, *datad, *lines, *lined;
2570 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2571 if (pixGetColormap(pixs))
2572 return (
PIX *)ERROR_PTR(
"pixs has colormap", __func__, NULL);
2574 if (d != 8 && d != 16)
2575 return (
PIX *)ERROR_PTR(
"pixs not 8 or 16 bpp", __func__, NULL);
2576 if (outdepth != 1 && outdepth != d) {
2577 L_WARNING(
"invalid outdepth; setting to 1\n", __func__);
2580 maxval = (1 << d) - 1;
2581 if (startval < 0 || startval > maxval)
2582 return (
PIX *)ERROR_PTR(
"startval not in [0 ... maxval]",
2585 return (
PIX *)ERROR_PTR(
"incr < 1", __func__, NULL);
2592 pixCopyResolution(pixd, pixs);
2594 wpld = pixGetWpl(pixd);
2596 wpls = pixGetWpl(pixs);
2601 if (outdepth == 1) {
2602 for (i = 0; i < h; i++) {
2603 lines = datas + i * wpls;
2604 lined = datad + i * wpld;
2605 for (j = 0; j < w; j++) {
2609 test = (val - startval) % incr;
2615 for (i = 0; i < h; i++) {
2616 lines = datas + i * wpls;
2617 lined = datad + i * wpld;
2618 for (j = 0; j < w; j++) {
2622 test = (val - startval) % incr;
2631 if (outdepth == 1) {
2632 for (i = 0; i < h; i++) {
2633 lines = datas + i * wpls;
2634 lined = datad + i * wpld;
2635 for (j = 0; j < w; j++) {
2639 test = (val - startval) % incr;
2645 for (i = 0; i < h; i++) {
2646 lines = datas + i * wpls;
2647 lined = datad + i * wpld;
2648 for (j = 0; j < w; j++) {
2652 test = (val - startval) % incr;
2661 return (
PIX *)ERROR_PTR(
"pixs not 8 or 16 bpp", __func__, NULL);
2687 l_float32 minval, maxval, incr;
2690 return (
PIX *)ERROR_PTR(
"fpix not defined", __func__, NULL);
2691 if (ncontours < 2 || ncontours > 500)
2692 return (
PIX *)ERROR_PTR(
"ncontours < 2 or > 500", __func__, NULL);
2696 if (minval == maxval)
2697 return (
PIX *)ERROR_PTR(
"all values in fpix are equal", __func__, NULL);
2698 incr = (maxval - minval) / ((l_float32)ncontours - 1);
2724 l_int32 i, j, w, h, wpls, wpld;
2725 l_float32 val, invincr, finter, above, below, diff;
2726 l_uint32 *datad, *lined;
2727 l_float32 *datas, *lines;
2732 return (
PIX *)ERROR_PTR(
"fpixs not defined", __func__, NULL);
2734 return (
PIX *)ERROR_PTR(
"incr <= 0.0", __func__, NULL);
2739 if ((pixd =
pixCreate(w, h, 8)) == NULL)
2740 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2750 wpld = pixGetWpl(pixd);
2751 invincr = 1.0 / incr;
2752 for (i = 0; i < h; i++) {
2753 lines = datas + i * wpls;
2754 lined = datad + i * wpld;
2755 for (j = 0; j < w; j++) {
2757 finter = invincr * val;
2758 above = finter - floorf(finter);
2759 below = ceilf(finter) - finter;
2760 diff = L_MIN(above, below);
2761 if (diff <= proxim) {
2803 if (!pixs || pixGetDepth(pixs) != 1)
2804 return (
PTA *)ERROR_PTR(
"pixs undefined or not 1 bpp", __func__, NULL);
2806 L_WARNING(
"width < 1; setting to 1\n", __func__);
2810 pix1 =
pixErodeBrick(NULL, pixs, 2 * width + 1, 2 * width + 1);
2811 pixXor(pix1, pix1, pixs);
#define GET_DATA_TWO_BYTES(pdata, n)
#define SET_DATA_BIT(pdata, n)
#define SET_DATA_TWO_BYTES(pdata, n, val)
#define GET_DATA_BYTE(pdata, n)
#define SET_DATA_BYTE(pdata, n, val)
l_ok boxGetGeometry(const BOX *box, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxGetGeometry()
void boxDestroy(BOX **pbox)
boxDestroy()
l_ok boxaAddBox(BOXA *boxa, BOX *box, l_int32 copyflag)
boxaAddBox()
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
l_int32 boxaGetCount(const BOXA *boxa)
boxaGetCount()
BOX * boxaGetBox(BOXA *boxa, l_int32 index, l_int32 accessflag)
boxaGetBox()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
BOXA * boxaCreate(l_int32 n)
boxaCreate()
l_ok boxIntersectByLine(const BOX *box, l_int32 x, l_int32 y, l_float32 slope, l_int32 *px1, l_int32 *py1, l_int32 *px2, l_int32 *py2, l_int32 *pn)
boxIntersectByLine()
PIXCMAP * pixcmapCreateRandom(l_int32 depth, l_int32 hasblack, l_int32 haswhite)
pixcmapCreateRandom()
PIXCMAP * pixcmapCreate(l_int32 depth)
pixcmapCreate()
l_ok pixcmapAddNearestColor(PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *pindex)
pixcmapAddNearestColor()
l_ok pixcmapGetColor(PIXCMAP *cmap, l_int32 index, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
pixcmapGetColor()
l_ok pixcmapAddColor(PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval)
pixcmapAddColor()
l_ok fpixGetDimensions(FPIX *fpix, l_int32 *pw, l_int32 *ph)
fpixGetDimensions()
l_int32 fpixGetWpl(FPIX *fpix)
fpixGetWpl()
l_float32 * fpixGetData(FPIX *fpix)
fpixGetData()
l_ok fpixGetMax(FPIX *fpix, l_float32 *pmaxval, l_int32 *pxmaxloc, l_int32 *pymaxloc)
fpixGetMax()
l_ok fpixGetMin(FPIX *fpix, l_float32 *pminval, l_int32 *pxminloc, l_int32 *pyminloc)
fpixGetMin()
l_ok pixRenderPolyline(PIX *pix, PTA *ptas, l_int32 width, l_int32 op, l_int32 closeflag)
pixRenderPolyline()
l_ok pixRenderHashBoxaBlend(PIX *pix, BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval, l_float32 fract)
pixRenderHashBoxaBlend()
l_ok pixRenderGridArb(PIX *pix, l_int32 nx, l_int32 ny, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderGridArb()
l_ok pixRenderHashBoxBlend(PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval, l_float32 fract)
pixRenderHashBoxBlend()
l_ok pixRenderHashBox(PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 op)
pixRenderHashBox()
l_ok pixRenderPtaArb(PIX *pix, PTA *pta, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderPtaArb()
l_ok locatePtRadially(l_int32 xr, l_int32 yr, l_float64 dist, l_float64 radang, l_float64 *px, l_float64 *py)
locatePtRadially()
l_ok pixRenderBoxBlend(PIX *pix, BOX *box, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract)
pixRenderBoxBlend()
l_ok pixRenderPtaBlend(PIX *pix, PTA *pta, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract)
pixRenderPtaBlend()
l_ok pixRenderLine(PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_int32 op)
pixRenderLine()
l_ok pixRenderHashBoxa(PIX *pix, BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 op)
pixRenderHashBoxa()
PTA * convertPtaLineTo4cc(PTA *ptas)
convertPtaLineTo4cc()
l_ok pixRenderHashBoxaArb(PIX *pix, BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval)
pixRenderHashBoxaArb()
PTA * generatePtaBox(BOX *box, l_int32 width)
generatePtaBox()
PIX * pixRenderRandomCmapPtaa(PIX *pix, PTAA *ptaa, l_int32 polyflag, l_int32 width, l_int32 closeflag)
pixRenderRandomCmapPtaa()
l_ok pixRenderBox(PIX *pix, BOX *box, l_int32 width, l_int32 op)
pixRenderBox()
l_ok pixRenderPolylineArb(PIX *pix, PTA *ptas, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_int32 closeflag)
pixRenderPolylineArb()
PTAA * generatePtaaHashBoxa(BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline)
generatePtaaHashBoxa()
PTA * generatePtaGrid(l_int32 w, l_int32 h, l_int32 nx, l_int32 ny, l_int32 width)
generatePtaGrid()
PTA * generatePtaPolyline(PTA *ptas, l_int32 width, l_int32 closeflag, l_int32 removedups)
generatePtaPolyline()
l_ok pixRenderPolylineBlend(PIX *pix, PTA *ptas, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract, l_int32 closeflag, l_int32 removedups)
pixRenderPolylineBlend()
l_ok pixRenderPlotFromNuma(PIX **ppix, NUMA *na, l_int32 plotloc, l_int32 linewidth, l_int32 max, l_uint32 color)
pixRenderPlotFromNuma()
PTA * pixGeneratePtaBoundary(PIX *pixs, l_int32 width)
pixGeneratePtaBoundary()
l_ok pixRenderPlotFromNumaGen(PIX **ppix, NUMA *na, l_int32 orient, l_int32 linewidth, l_int32 refpos, l_int32 max, l_int32 drawref, l_uint32 color)
pixRenderPlotFromNumaGen()
l_ok pixRenderHashBoxArb(PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval)
pixRenderHashBoxArb()
l_ok pixRenderHashMaskArb(PIX *pix, PIX *pixm, l_int32 x, l_int32 y, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval)
pixRenderHashMaskArb()
PTA * makePlotPtaFromNuma(NUMA *na, l_int32 size, l_int32 plotloc, l_int32 linewidth, l_int32 max)
makePlotPtaFromNuma()
l_ok pixRenderLineArb(PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderLineArb()
PTAA * generatePtaaBoxa(BOXA *boxa)
generatePtaaBoxa()
PTA * generatePtaLineFromPt(l_int32 x, l_int32 y, l_float64 length, l_float64 radang)
generatePtaLineFromPt()
PIX * pixFillPolygon(PIX *pixs, PTA *pta, l_int32 xmin, l_int32 ymin)
pixFillPolygon()
l_ok pixRenderLineBlend(PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract)
pixRenderLineBlend()
PTA * generatePtaLine(l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2)
generatePtaLine()
PIX * fpixAutoRenderContours(FPIX *fpix, l_int32 ncontours)
fpixAutoRenderContours()
l_ok pixRenderBoxaBlend(PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract, l_int32 removedups)
pixRenderBoxaBlend()
PTA * generatePtaHashBox(BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline)
generatePtaHashBox()
l_ok pixRenderBoxArb(PIX *pix, BOX *box, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderBoxArb()
l_ok pixRenderBoxa(PIX *pix, BOXA *boxa, l_int32 width, l_int32 op)
pixRenderBoxa()
PIX * pixRenderPolygon(PTA *ptas, l_int32 width, l_int32 *pxmin, l_int32 *pymin)
pixRenderPolygon()
PTA * makePlotPtaFromNumaGen(NUMA *na, l_int32 orient, l_int32 linewidth, l_int32 refpos, l_int32 max, l_int32 drawref)
makePlotPtaFromNumaGen()
PTA * generatePtaHashBoxa(BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 removedups)
generatePtaHashBoxa()
PTA * generatePtaWideLine(l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width)
generatePtaWideLine()
l_ok pixRenderBoxaArb(PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderBoxaArb()
PTA * generatePtaBoxa(BOXA *boxa, l_int32 width, l_int32 removedups)
generatePtaBoxa()
l_ok pixRenderPta(PIX *pix, PTA *pta, l_int32 op)
pixRenderPta()
PIX * pixRenderContours(PIX *pixs, l_int32 startval, l_int32 incr, l_int32 outdepth)
pixRenderContours()
PTA * generatePtaFilledCircle(l_int32 radius)
generatePtaFilledCircle()
PIX * fpixRenderContours(FPIX *fpixs, l_float32 incr, l_float32 proxim)
fpixRenderContours()
PTA * generatePtaFilledSquare(l_int32 side)
generatePtaFilledSquare()
PIX * pixErodeBrick(PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize)
pixErodeBrick()
l_ok numaGetFValue(NUMA *na, l_int32 index, l_float32 *pval)
numaGetFValue()
l_int32 numaGetCount(NUMA *na)
numaGetCount()
l_ok numaGetParameters(NUMA *na, l_float32 *pstartx, l_float32 *pdelx)
numaGetParameters()
l_ok numaGetMin(NUMA *na, l_float32 *pminval, l_int32 *piminloc)
numaGetMin()
l_ok numaGetMax(NUMA *na, l_float32 *pmaxval, l_int32 *pimaxloc)
numaGetMax()
l_uint32 * pixGetData(PIX *pix)
pixGetData()
l_ok pixSetColormap(PIX *pix, PIXCMAP *colormap)
pixSetColormap()
void pixDestroy(PIX **ppix)
pixDestroy()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
PIX * pixCopy(PIX *pixd, const PIX *pixs)
pixCopy()
PIX * pixCreateTemplate(const PIX *pixs)
pixCreateTemplate()
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
l_ok pixSetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 val)
pixSetPixel()
l_ok pixGetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 *pval)
pixGetPixel()
l_ok pixClearPixel(PIX *pix, l_int32 x, l_int32 y)
pixClearPixel()
l_ok pixFlipPixel(PIX *pix, l_int32 x, l_int32 y)
pixFlipPixel()
l_ok composeRGBPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *ppixel)
composeRGBPixel()
void extractRGBValues(l_uint32 pixel, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
extractRGBValues()
PIX * pixInvert(PIX *pixd, PIX *pixs)
pixInvert()
PIX * pixOr(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixOr()
PIX * pixXor(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixXor()
PIX * pixClipRectangle(PIX *pixs, BOX *box, BOX **pboxc)
pixClipRectangle()
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
PIX * pixConvertTo32(PIX *pixs)
pixConvertTo32()
PTAA * ptaaCreate(l_int32 n)
ptaaCreate()
PTA * ptaaGetPta(PTAA *ptaa, l_int32 index, l_int32 accessflag)
ptaaGetPta()
l_ok ptaGetIPt(PTA *pta, l_int32 index, l_int32 *px, l_int32 *py)
ptaGetIPt()
l_ok ptaaAddPta(PTAA *ptaa, PTA *pta, l_int32 copyflag)
ptaaAddPta()
PTA * ptaClone(PTA *pta)
ptaClone()
l_int32 ptaaGetCount(PTAA *ptaa)
ptaaGetCount()
l_ok ptaAddPt(PTA *pta, l_float32 x, l_float32 y)
ptaAddPt()
l_int32 ptaGetCount(PTA *pta)
ptaGetCount()
PTA * ptaCreate(l_int32 n)
ptaCreate()
void ptaDestroy(PTA **ppta)
ptaDestroy()
PTA * ptaGetPixelsFromPix(PIX *pixs, BOX *box)
ptaGetPixelsFromPix()
l_int32 ptaPtInsidePolygon(PTA *pta, l_float32 x, l_float32 y, l_int32 *pinside)
ptaPtInsidePolygon()
l_ok ptaJoin(PTA *ptad, PTA *ptas, l_int32 istart, l_int32 iend)
ptaJoin()
l_ok ptaGetRange(PTA *pta, l_float32 *pminx, l_float32 *pmaxx, l_float32 *pminy, l_float32 *pmaxy)
ptaGetRange()
PTA * ptaReplicatePattern(PTA *ptas, PIX *pixp, PTA *ptap, l_int32 cx, l_int32 cy, l_int32 w, l_int32 h)
ptaReplicatePattern()
PTA * ptaCropToMask(PTA *ptas, PIX *pixm)
ptaCropToMask()
l_ok ptaRemoveDupsByAset(PTA *ptas, PTA **pptad)
ptaRemoveDupsByAset()
l_ok pixRasterop(PIX *pixd, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, PIX *pixs, l_int32 sx, l_int32 sy)
pixRasterop()
l_ok pixFindHorizontalRuns(PIX *pix, l_int32 y, l_int32 *xstart, l_int32 *xend, l_int32 *pn)
pixFindHorizontalRuns()
PIX * pixSeedfillBinary(PIX *pixd, PIX *pixs, PIX *pixm, l_int32 connectivity)
pixSeedfillBinary()