137#include <config_auto.h>
141#include "allheaders.h"
144static const l_uint32 rmask32[] = {0x0,
145 0x00000001, 0x00000003, 0x00000007, 0x0000000f,
146 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
147 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
148 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
149 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
150 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
151 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
152 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff};
157LEPT_DLL l_float32 AlphaMaskBorderVals[2] = {0.0, 0.5};
161#define DEBUG_SERIALIZE 0
197l_int32 w, h, d, wpl, val;
198l_uint32 *line, *data;
201 return ERROR_INT(
"&val not defined", __func__, 1);
204 return ERROR_INT(
"pix not defined", __func__, 1);
206 pixGetDimensions(pix, &w, &h, &d);
207 if (x < 0 || x >= w || y < 0 || y >= h)
210 wpl = pixGetWpl(pix);
211 data = pixGetData(pix);
212 line = data + y * wpl;
234 return ERROR_INT(
"depth must be in {1,2,4,8,16,32} bpp", __func__, 1);
269l_uint32 *line, *data;
272 return ERROR_INT(
"pix not defined", __func__, 1);
273 pixGetDimensions(pix, &w, &h, &d);
274 if (x < 0 || x >= w || y < 0 || y >= h)
277 data = pixGetData(pix);
278 wpl = pixGetWpl(pix);
279 line = data + y * wpl;
304 return ERROR_INT(
"depth must be in {1,2,4,8,16,32} bpp", __func__, 1);
336l_uint32 *data, *ppixel;
338 if (prval) *prval = 0;
339 if (pgval) *pgval = 0;
340 if (pbval) *pbval = 0;
341 if (!prval && !pgval && !pbval)
342 return ERROR_INT(
"no output requested", __func__, 1);
344 return ERROR_INT(
"pix not defined", __func__, 1);
345 pixGetDimensions(pix, &w, &h, &d);
347 return ERROR_INT(
"pix not 32 bpp", __func__, 1);
348 if (x < 0 || x >= w || y < 0 || y >= h)
351 wpl = pixGetWpl(pix);
352 data = pixGetData(pix);
353 ppixel = data + y * wpl + x;
387l_uint32 *data, *line;
390 return ERROR_INT(
"pix not defined", __func__, 1);
391 pixGetDimensions(pix, &w, &h, &d);
393 return ERROR_INT(
"pix not 32 bpp", __func__, 1);
394 if (x < 0 || x >= w || y < 0 || y >= h)
397 wpl = pixGetWpl(pix);
398 data = pixGetData(pix);
399 line = data + y * wpl;
441l_int32 w, h, d, index;
445 return ERROR_INT(
"pix not defined", __func__, 1);
446 if ((cmap = pixGetColormap(pix)) == NULL)
447 return ERROR_INT(
"pix is not colormapped", __func__, 1);
448 pixGetDimensions(pix, &w, &h, &d);
449 if (d != 2 && d != 4 && d != 8)
450 return ERROR_INT(
"pix depth not 2, 4 or 8", __func__, 1);
451 if (x < 0 || x >= w || y < 0 || y >= h)
455 pixcmapAddNearestColor(cmap, rval, gval, bval, &index);
457 if (pixcmapAddNewColor(cmap, rval, gval, bval, &index) == 2)
458 return ERROR_INT(
"colormap is full", __func__, 2);
485l_int32 w, h, x, y, rval, gval, bval;
492 if (!pval && !px && !py)
493 return ERROR_INT(
"no output requested", __func__, 1);
495 return ERROR_INT(
"pix not defined", __func__, 1);
497 pixGetDimensions(pix, &w, &h, NULL);
504 if ((cmap = pixGetColormap(pix)) != NULL) {
505 pixcmapGetColor(cmap, val, &rval, &gval, &bval);
535l_uint32 *line, *data;
538 return ERROR_INT(
"pix not defined", __func__, 1);
539 if (pixGetColormap(pix))
540 L_WARNING(
"cmapped: setting to 0 may not be intended\n", __func__);
541 pixGetDimensions(pix, &w, &h, &d);
542 if (x < 0 || x >= w || y < 0 || y >= h)
545 wpl = pixGetWpl(pix);
546 data = pixGetData(pix);
547 line = data + y * wpl;
569 return ERROR_INT(
"depth must be in {1,2,4,8,16,32} bpp", __func__, 1);
596l_uint32 *line, *data;
599 return ERROR_INT(
"pix not defined", __func__, 1);
600 if (pixGetColormap(pix))
601 L_WARNING(
"cmapped: setting to 0 may not be intended\n", __func__);
602 pixGetDimensions(pix, &w, &h, &d);
603 if (x < 0 || x >= w || y < 0 || y >= h)
606 data = pixGetData(pix);
607 wpl = pixGetWpl(pix);
608 line = data + y * wpl;
639 val = line[x] ^ 0xffffffff;
643 return ERROR_INT(
"depth must be in {1,2,4,8,16,32} bpp", __func__, 1);
694 lept_stderr(
"illegal depth in setPixelLow()\n");
727 return ERROR_INT(
"&val not defined", __func__, 1);
730 return ERROR_INT(
"pixs not defined", __func__, 1);
732 return ERROR_INT(
"invalid op", __func__, 1);
734 cmap = pixGetColormap(pixs);
735 d = pixGetDepth(pixs);
741 val = (d == 32) ? 0xffffff00 : (1 << d) - 1;
745 pixcmapAddBlackOrWhite(cmap, 0, &val);
747 pixcmapAddBlackOrWhite(cmap, 1, &val);
776 return ERROR_INT(
"pix not defined", __func__, 1);
778 memset(pix->
data, 0, 4LL * pix->
wpl * pix->
h);
805 return ERROR_INT(
"pix not defined", __func__, 1);
806 if ((cmap = pixGetColormap(pix)) != NULL) {
807 n = pixcmapGetCount(cmap);
808 if (n < cmap->nalloc)
809 return ERROR_INT(
"cmap entry does not exist", __func__, 1);
812 memset(pix->
data, 0xff, 4LL * pix->
wpl * pix->
h);
842l_int32 d, spp, index;
848 return ERROR_INT(
"pix not defined", __func__, 1);
850 L_WARNING(
"grayval < 0; setting to 0\n", __func__);
852 }
else if (grayval > 255) {
853 L_WARNING(
"grayval > 255; setting to 255\n", __func__);
858 cmap = pixGetColormap(pix);
860 pixcmapAddNearestColor(cmap, grayval, grayval, grayval, &index);
866 d = pixGetDepth(pix);
867 spp = pixGetSpp(pix);
878 }
else if (d == 16) {
879 grayval |= (grayval << 8);
881 }
else if (d == 32 && spp == 3) {
884 }
else if (d == 32 && spp == 4) {
891 L_ERROR(
"invalid depth: %d\n", __func__, d);
932l_int32 n, i, j, w, h, d, wpl, npix;
933l_uint32 maxval, wordval;
934l_uint32 *data, *line;
938 return ERROR_INT(
"pix not defined", __func__, 1);
942 if ((cmap = pixGetColormap(pix)) != NULL) {
943 n = pixcmapGetCount(cmap);
945 L_WARNING(
"index not in colormap; using last color\n", __func__);
952 pixGetDimensions(pix, &w, &h, &d);
954 maxval = (1 << d) - 1;
956 L_WARNING(
"val = %d too large for depth; using maxval = %d\n",
957 __func__, val, maxval);
965 for (j = 0; j < npix; j++)
966 wordval |= (val << (j * d));
967 wpl = pixGetWpl(pix);
968 data = pixGetData(pix);
969 for (i = 0; i < h; i++) {
970 line = data + i * wpl;
971 for (j = 0; j < wpl; j++) {
972 *(line + j) = wordval;
1004 return ERROR_INT(
"pix not defined", __func__, 1);
1006 return ERROR_INT(
"invalid op", __func__, 1);
1008 cmap = pixGetColormap(pixs);
1009 d = pixGetDepth(pixs);
1017 pixcmapAddBlackOrWhite(cmap, 0, &index);
1019 pixcmapAddBlackOrWhite(cmap, 1, &index);
1047l_uint32 mask1, mask2;
1050 if (!pix || pixGetDepth(pix) != 32)
1051 return ERROR_INT(
"pix not defined or not 32 bpp", __func__, 1);
1054 return ERROR_INT(
"invalid component", __func__, 1);
1055 if (val < 0 || val > 255)
1056 return ERROR_INT(
"val not in [0 ... 255]", __func__, 1);
1058 mask1 = ~(255 << (8 * (3 - comp)));
1059 mask2 = val << (8 * (3 - comp));
1060 nwords = pixGetHeight(pix) * pixGetWpl(pix);
1061 data = pixGetData(pix);
1062 for (i = 0; i < nwords; i++) {
1096 return ERROR_INT(
"pix not defined", __func__, 1);
1098 return ERROR_INT(
"box not defined", __func__, 1);
1100 boxGetGeometry(box, &x, &y, &w, &h);
1101 pixRasterop(pix, x, y, w, h,
PIX_CLR, NULL, 0, 0);
1126l_int32 n, x, y, w, h;
1130 return ERROR_INT(
"pix not defined", __func__, 1);
1132 return ERROR_INT(
"box not defined", __func__, 1);
1133 if ((cmap = pixGetColormap(pix)) != NULL) {
1134 n = pixcmapGetCount(cmap);
1135 if (n < cmap->nalloc)
1136 return ERROR_INT(
"cmap entry does not exist", __func__, 1);
1139 boxGetGeometry(box, &x, &y, &w, &h);
1140 pixRasterop(pix, x, y, w, h,
PIX_SET, NULL, 0, 0);
1167l_int32 n, x, y, xstart, xend, ystart, yend, bw, bh, w, h, d, wpl, maxval;
1168l_uint32 *data, *line;
1173 return ERROR_INT(
"pix not defined", __func__, 1);
1175 return ERROR_INT(
"box not defined", __func__, 1);
1176 pixGetDimensions(pix, &w, &h, &d);
1177 if (d != 1 && d != 2 && d != 4 && d !=8 && d != 16 && d != 32)
1178 return ERROR_INT(
"depth must be in {1,2,4,8,16,32} bpp", __func__, 1);
1179 if ((cmap = pixGetColormap(pix)) != NULL) {
1180 n = pixcmapGetCount(cmap);
1182 L_WARNING(
"index not in colormap; using last color\n", __func__);
1187 maxval = (d == 32) ? 0xffffff00 : (1 << d) - 1;
1188 if (val > maxval) val = maxval;
1196 (d == 2 && val == 3) ||
1197 (d == 4 && val == 0xf) ||
1198 (d == 8 && val == 0xff) ||
1199 (d == 16 && val == 0xffff) ||
1200 (d == 32 && ((val ^ 0xffffff00) >> 8 == 0))) {
1206 if ((boxc = boxClipToRectangle(box, w, h)) == NULL)
1207 return ERROR_INT(
"no overlap of box with image", __func__, 1);
1208 boxGetGeometry(boxc, &xstart, &ystart, &bw, &bh);
1209 xend = xstart + bw - 1;
1210 yend = ystart + bh - 1;
1213 wpl = pixGetWpl(pix);
1214 data = pixGetData(pix);
1215 for (y = ystart; y <= yend; y++) {
1216 line = data + y * wpl;
1217 for (x = xstart; x <= xend; x++) {
1236 return ERROR_INT(
"depth not 2|4|8|16|32 bpp", __func__, 1);
1267l_int32 i, j, bx, by, bw, bh, w, h, wpls;
1268l_int32 prval, pgval, pbval, rval, gval, bval;
1270l_uint32 *datas, *lines;
1272 if (!pixs || pixGetDepth(pixs) != 32)
1273 return ERROR_INT(
"pixs not defined or not 32 bpp", __func__, 1);
1276 pixGetDimensions(pixs, &w, &h, NULL);
1277 datas = pixGetData(pixs);
1278 wpls = pixGetWpl(pixs);
1280 for (i = 0; i < h; i++) {
1281 lines = datas + i * wpls;
1282 for (j = 0; j < w; j++) {
1283 val32 = *(lines + j);
1285 prval = (l_int32)((1. - fract) * prval + fract * rval);
1286 pgval = (l_int32)((1. - fract) * pgval + fract * gval);
1287 pbval = (l_int32)((1. - fract) * pbval + fract * bval);
1289 *(lines + j) = val32;
1295 boxGetGeometry(box, &bx, &by, &bw, &bh);
1296 for (i = 0; i < bh; i++) {
1297 if (by + i < 0 || by + i >= h)
continue;
1298 lines = datas + (by + i) * wpls;
1299 for (j = 0; j < bw; j++) {
1300 if (bx + j < 0 || bx + j >= w)
continue;
1301 val32 = *(lines + bx + j);
1303 prval = (l_int32)((1. - fract) * prval + fract * rval);
1304 pgval = (l_int32)((1. - fract) * pgval + fract * gval);
1305 pbval = (l_int32)((1. - fract) * pbval + fract * bval);
1307 *(lines + bx + j) = val32;
1352l_int32 i, w, h, d, wpl, endbits, fullwords;
1354l_uint32 *data, *pword;
1357 return ERROR_INT(
"pix not defined", __func__, 1);
1359 pixGetDimensions(pix, &w, &h, &d);
1363 L_INFO(
"pix is 24 bpp\n", __func__);
1367 data = pixGetData(pix);
1368 wpl = pixGetWpl(pix);
1369 endbits = 32 - (((l_int64)w * d) % 32);
1372 fullwords = (1LL * w * d) / 32;
1373 mask = rmask32[endbits];
1377 for (i = 0; i < h; i++) {
1378 pword = data + i * wpl + fullwords;
1380 *pword = *pword & mask;
1382 *pword = *pword | mask;
1417l_int32 i, w, h, d, wpl, endbits, fullwords;
1419l_uint32 *data, *pword;
1422 return ERROR_INT(
"pix not defined", __func__, 1);
1424 pixGetDimensions(pix, &w, &h, &d);
1428 L_INFO(
"pix is 24 bpp\n", __func__);
1435 return ERROR_INT(
"start y not in image", __func__, 1);
1439 data = pixGetData(pix);
1440 wpl = pixGetWpl(pix);
1441 endbits = 32 - (((l_int64)w * d) % 32);
1444 fullwords = (l_int64)w * d / 32;
1446 mask = rmask32[endbits];
1450 for (i = by; i < by + bh; i++) {
1451 pword = data + i * wpl + fullwords;
1453 *pword = *pword & mask;
1455 *pword = *pword | mask;
1496 return ERROR_INT(
"pixs not defined", __func__, 1);
1498 return ERROR_INT(
"op must be PIX_SET or PIX_CLR", __func__, 1);
1500 pixGetDimensions(pixs, &w, &h, NULL);
1501 pixRasterop(pixs, 0, 0, left, h, op, NULL, 0, 0);
1502 pixRasterop(pixs, w - right, 0, right, h, op, NULL, 0, 0);
1503 pixRasterop(pixs, 0, 0, w, top, op, NULL, 0, 0);
1504 pixRasterop(pixs, 0, h - bot, w, bot, op, NULL, 0, 0);
1540l_int32 w, h, d, wpls, i, j, bstart, rstart;
1541l_uint32 *datas, *lines;
1544 return ERROR_INT(
"pixs not defined", __func__, 1);
1545 pixGetDimensions(pixs, &w, &h, &d);
1546 if (d != 8 && d != 16 && d != 32)
1547 return ERROR_INT(
"depth must be 8, 16 or 32 bpp", __func__, 1);
1549 datas = pixGetData(pixs);
1550 wpls = pixGetWpl(pixs);
1553 for (i = 0; i < top; i++) {
1554 lines = datas + i * wpls;
1555 for (j = 0; j < w; j++)
1560 for (i = top; i < bstart; i++) {
1561 lines = datas + i * wpls;
1562 for (j = 0; j < left; j++)
1564 for (j = rstart; j < w; j++)
1567 for (i = bstart; i < h; i++) {
1568 lines = datas + i * wpls;
1569 for (j = 0; j < w; j++)
1572 }
else if (d == 16) {
1574 for (i = 0; i < top; i++) {
1575 lines = datas + i * wpls;
1576 for (j = 0; j < w; j++)
1581 for (i = top; i < bstart; i++) {
1582 lines = datas + i * wpls;
1583 for (j = 0; j < left; j++)
1585 for (j = rstart; j < w; j++)
1588 for (i = bstart; i < h; i++) {
1589 lines = datas + i * wpls;
1590 for (j = 0; j < w; j++)
1594 for (i = 0; i < top; i++) {
1595 lines = datas + i * wpls;
1596 for (j = 0; j < w; j++)
1601 for (i = top; i < bstart; i++) {
1602 lines = datas + i * wpls;
1603 for (j = 0; j < left; j++)
1605 for (j = rstart; j < w; j++)
1608 for (i = bstart; i < h; i++) {
1609 lines = datas + i * wpls;
1610 for (j = 0; j < w; j++)
1639l_int32 w, h, d, i, j, xend, yend;
1642 return ERROR_INT(
"pixs not defined", __func__, 1);
1644 return ERROR_INT(
"dist must be > 0", __func__, 1);
1645 pixGetDimensions(pixs, &w, &h, &d);
1646 if (w < 2 * dist + 1 || h < 2 * dist + 1)
1647 return ERROR_INT(
"ring doesn't exist", __func__, 1);
1648 if (d < 32 && (val >= (1 << d)))
1649 return ERROR_INT(
"invalid pixel value", __func__, 1);
1653 for (j = dist - 1; j <= xend; j++)
1655 for (j = dist - 1; j <= xend; j++)
1657 for (i = dist - 1; i <= yend; i++)
1659 for (i = dist - 1; i <= yend; i++)
1693 return ERROR_INT(
"pixs not defined", __func__, 1);
1695 pixGetDimensions(pixs, &w, &h, NULL);
1696 for (j = 0; j < left; j++)
1697 pixRasterop(pixs, left - 1 - j, top, 1, h - top - bot,
PIX_SRC,
1698 pixs, left + j, top);
1699 for (j = 0; j < right; j++)
1700 pixRasterop(pixs, w - right + j, top, 1, h - top - bot,
PIX_SRC,
1701 pixs, w - right - 1 - j, top);
1702 for (i = 0; i < top; i++)
1703 pixRasterop(pixs, 0, top - 1 - i, w, 1,
PIX_SRC,
1705 for (i = 0; i < bot; i++)
1706 pixRasterop(pixs, 0, h - bot + i, w, 1,
PIX_SRC,
1707 pixs, 0, h - bot - 1 - i);
1743 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, pixd);
1747 L_WARNING(
"same: nothing to do\n", __func__);
1749 }
else if (!pixSizesEqual(pixs, pixd)) {
1750 return (
PIX *)ERROR_PTR(
"pixs and pixd sizes differ",
1754 if ((pixd = pixCreateTemplate(pixs)) == NULL)
1755 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, pixd);
1758 pixGetDimensions(pixs, &w, &h, NULL);
1759 pixRasterop(pixd, 0, 0, left, h,
PIX_SRC, pixs, 0, 0);
1760 pixRasterop(pixd, w - right, 0, right, h,
PIX_SRC, pixs, w - right, 0);
1761 pixRasterop(pixd, 0, 0, w, top,
PIX_SRC, pixs, 0, 0);
1762 pixRasterop(pixd, 0, h - bot, w, bot,
PIX_SRC, pixs, 0, h - bot);
1790 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1792 return pixClone(pixs);
1833 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1835 return (
PIX *)ERROR_PTR(
"invalid op", __func__, NULL);
1882l_int32 ws, hs, wd, hd, d, maxval, op;
1886 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1887 if (left < 0 || right < 0 || top < 0 || bot < 0)
1888 return (
PIX *)ERROR_PTR(
"negative border added!", __func__, NULL);
1890 pixGetDimensions(pixs, &ws, &hs, &d);
1891 wd = ws + left + right;
1892 hd = hs + top + bot;
1893 if ((pixd = pixCreate(wd, hd, d)) == NULL)
1894 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
1895 pixCopyResolution(pixd, pixs);
1896 pixCopyColormap(pixd, pixs);
1899 maxval = (d == 32) ? 0xffffff00 : (1 << d) - 1;
1903 else if (val >= maxval)
1908 pixRasterop(pixd, 0, 0, left, hd, op, NULL, 0, 0);
1909 pixRasterop(pixd, wd - right, 0, right, hd, op, NULL, 0, 0);
1910 pixRasterop(pixd, 0, 0, wd, top, op, NULL, 0, 0);
1911 pixRasterop(pixd, 0, hd - bot, wd, bot, op, NULL, 0, 0);
1915 pixRasterop(pixd, left, top, ws, hs,
PIX_SRC, pixs, 0, 0);
1956 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1964 pixd = pixClone(pixs);
1965 for (i = 0; i < 6; i++) {
1967 L_WARNING(
"w = %d > 500; skipping\n", __func__, w[i]);
1968 if (w[i] > 0 && w[i] <= 500) {
1993 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1995 return pixClone(pixs);
2014l_int32 ws, hs, wd, hd, d;
2018 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2019 if (left < 0 || right < 0 || top < 0 || bot < 0)
2020 return (
PIX *)ERROR_PTR(
"negative border removed!", __func__, NULL);
2022 pixGetDimensions(pixs, &ws, &hs, &d);
2023 wd = ws - left - right;
2024 hd = hs - top - bot;
2026 return (
PIX *)ERROR_PTR(
"width must be > 0", __func__, NULL);
2028 return (
PIX *)ERROR_PTR(
"height must be > 0", __func__, NULL);
2029 if ((pixd = pixCreate(wd, hd, d)) == NULL)
2030 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2031 pixCopyResolution(pixd, pixs);
2032 pixCopySpp(pixd, pixs);
2033 pixCopyColormap(pixd, pixs);
2035 pixRasterop(pixd, 0, 0, wd, hd,
PIX_SRC, pixs, left, top);
2036 if (pixGetDepth(pixs) == 32 && pixGetSpp(pixs) == 4)
2063l_int32 w, h, top, bot, left, right, delta;
2066 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2068 pixGetDimensions(pixs, &w, &h, NULL);
2069 if ((wd <= 0 || wd >= w) && (hd <= 0 || hd >= h))
2070 return pixClone(pixs);
2072 left = right = (w - wd) / 2;
2073 delta = w - 2 * left - wd;
2075 top = bot = (h - hd) / 2;
2076 delta = h - hd - 2 * top;
2078 if (wd <= 0 || wd > w)
2080 else if (hd <= 0 || hd > h)
2122 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2123 pixGetDimensions(pixs, &w, &h, NULL);
2124 if (left > w || right > w || top > h || bot > h)
2125 return (
PIX *)ERROR_PTR(
"border too large", __func__, NULL);
2129 for (j = 0; j < left; j++)
2130 pixRasterop(pixd, left - 1 - j, top, 1, h,
PIX_SRC,
2131 pixd, left + j, top);
2132 for (j = 0; j < right; j++)
2133 pixRasterop(pixd, left + w + j, top, 1, h,
PIX_SRC,
2134 pixd, left + w - 1 - j, top);
2135 for (i = 0; i < top; i++)
2136 pixRasterop(pixd, 0, top - 1 - i, left + w + right, 1,
PIX_SRC,
2138 for (i = 0; i < bot; i++)
2139 pixRasterop(pixd, 0, top + h + i, left + w + right, 1,
PIX_SRC,
2140 pixd, 0, top + h - 1 - i);
2173 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2174 pixGetDimensions(pixs, &w, &h, NULL);
2175 if (left > w || right > w || top > h || bot > h)
2176 return (
PIX *)ERROR_PTR(
"border too large", __func__, NULL);
2181 pixRasterop(pixd, 0, top, left, h,
PIX_SRC, pixd, w, top);
2182 pixRasterop(pixd, left + w, top, right, h,
PIX_SRC, pixd, left, top);
2183 pixRasterop(pixd, 0, 0, left + w + right, top,
PIX_SRC, pixd, 0, h);
2184 pixRasterop(pixd, 0, top + h, left + w + right, bot,
PIX_SRC, pixd, 0, top);
2227 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2228 pixGetDimensions(pixs, &w, &h, NULL);
2229 if (left > w || right > w || top > h || bot > h)
2230 return (
PIX *)ERROR_PTR(
"border too large", __func__, NULL);
2235 for (j = 0; j < left; j++)
2236 pixRasterop(pixd, left - 1 - j, top, 1, h,
PIX_SRC,
2237 pixd, left + j, top);
2238 for (j = 0; j < right; j++)
2239 pixRasterop(pixd, left + w + j, top, 1, h,
PIX_SRC,
2240 pixd, left + w - 1 - j, top);
2241 pixRasterop(pixd, 0, 0, left + w + right, top,
PIX_SRC, pixd, 0, h);
2242 pixRasterop(pixd, 0, top + h, left + w + right, bot,
PIX_SRC, pixd, 0, top);
2272 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2275 pixGetDimensions(pixs, &w, &h, NULL);
2276 for (j = 0; j < left; j++)
2277 pixRasterop(pixd, j, top, 1, h,
PIX_SRC, pixd, left, top);
2278 for (j = 0; j < right; j++)
2279 pixRasterop(pixd, left + w + j, top, 1, h,
2280 PIX_SRC, pixd, left + w - 1, top);
2281 for (i = 0; i < top; i++)
2282 pixRasterop(pixd, 0, i, left + w + right, 1,
PIX_SRC, pixd, 0, top);
2283 for (i = 0; i < bot; i++)
2284 pixRasterop(pixd, 0, top + h + i, left + w + right, 1,
2285 PIX_SRC, pixd, 0, top + h - 1);
2312 return ERROR_INT(
"pixs and pixd not both defined", __func__, 1);
2313 if (pixGetDepth(pixs) != 32 || pixGetSpp(pixs) != 4)
2314 return ERROR_INT(
"pixs not 32 bpp and 4 spp", __func__, 1);
2315 if (pixGetDepth(pixd) != 32)
2316 return ERROR_INT(
"pixd not 32 bpp", __func__, 1);
2318 if (shiftx == 0 && shifty == 0) {
2324 pixGetDimensions(pixd, &w, &h, NULL);
2325 pix2 = pixCreate(w, h, 8);
2326 pixRasterop(pix2, 0, 0, w, h,
PIX_SRC, pix1, -shiftx, -shifty);
2358PIX *pix1, *pix2, *pixd;
2363 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2364 cmap = pixGetColormap(pixs);
2365 if (!cmap && !(pixGetDepth(pixs) == 32 && pixGetSpp(pixs) == 4))
2366 return (
PIX *)ERROR_PTR(
"pixs not cmap and not 32 bpp rgba",
2368 if ((w = pixGetWidth(pixs)) == 0)
2369 return (
PIX *)ERROR_PTR(
"pixs width 0 !!", __func__, NULL);
2374 pix1 = pixCopy(NULL, pixs);
2377 scalefact = (maxw == 0) ? 1.0f : L_MIN(1.0f, (l_float32)(maxw) / w);
2378 width = (l_int32)(scalefact * w);
2380 pixa = pixaCreate(3);
2384 pix2 = pixConvertTo32(pix1);
2387 pix1 = pixAlphaBlendUniform(pixs, (val & 0xffffff00));
2389 pixd = pixaDisplayTiledInRows(pixa, 32, width, scalefact, 0, 25, 2);
2426l_int32 wr, wg, wb, hr, hg, hb, dr, dg, db;
2430 return (
PIX *)ERROR_PTR(
"pixr not defined", __func__, NULL);
2432 return (
PIX *)ERROR_PTR(
"pixg not defined", __func__, NULL);
2434 return (
PIX *)ERROR_PTR(
"pixb not defined", __func__, NULL);
2435 pixGetDimensions(pixr, &wr, &hr, &dr);
2436 pixGetDimensions(pixg, &wg, &hg, &dg);
2437 pixGetDimensions(pixb, &wb, &hb, &db);
2438 if (dr != 8 || dg != 8 || db != 8)
2439 return (
PIX *)ERROR_PTR(
"input pix not all 8 bpp", __func__, NULL);
2440 if (wr != wg || wr != wb)
2441 return (
PIX *)ERROR_PTR(
"widths not the same", __func__, NULL);
2442 if (hr != hg || hr != hb)
2443 return (
PIX *)ERROR_PTR(
"heights not the same", __func__, NULL);
2445 if ((pixd = pixCreate(wr, hr, 32)) == NULL)
2446 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2447 pixCopyResolution(pixd, pixr);
2479l_int32 i, j, w, h, wpls, wpld, val;
2480l_uint32 *lines, *lined;
2481l_uint32 *datas, *datad;
2485 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2486 if (pixGetColormap(pixs))
2488 if (pixGetDepth(pixs) != 32)
2489 return (
PIX *)ERROR_PTR(
"pixs not 32 bpp", __func__, NULL);
2492 return (
PIX *)ERROR_PTR(
"invalid comp", __func__, NULL);
2494 pixGetDimensions(pixs, &w, &h, NULL);
2495 if ((pixd = pixCreate(w, h, 8)) == NULL)
2496 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2497 pixCopyResolution(pixd, pixs);
2498 wpls = pixGetWpl(pixs);
2499 wpld = pixGetWpl(pixd);
2500 datas = pixGetData(pixs);
2501 datad = pixGetData(pixd);
2502 for (i = 0; i < h; i++) {
2503 lines = datas + i * wpls;
2504 lined = datad + i * wpld;
2505 for (j = 0; j < w; j++) {
2538l_int32 i, j, w, h, ws, hs, wd, hd;
2540l_uint32 *lines, *lined;
2541l_uint32 *datas, *datad;
2544 return ERROR_INT(
"pixd not defined", __func__, 1);
2546 return ERROR_INT(
"pixs not defined", __func__, 1);
2547 if (pixGetDepth(pixd) != 32)
2548 return ERROR_INT(
"pixd not 32 bpp", __func__, 1);
2549 if (pixGetDepth(pixs) != 8)
2550 return ERROR_INT(
"pixs not 8 bpp", __func__, 1);
2553 return ERROR_INT(
"invalid comp", __func__, 1);
2554 pixGetDimensions(pixs, &ws, &hs, NULL);
2555 pixGetDimensions(pixd, &wd, &hd, NULL);
2556 if (ws != wd || hs != hd)
2557 L_WARNING(
"images sizes not equal\n", __func__);
2562 datas = pixGetData(pixs);
2563 datad = pixGetData(pixd);
2564 wpls = pixGetWpl(pixs);
2565 wpld = pixGetWpl(pixd);
2566 for (i = 0; i < h; i++) {
2567 lines = datas + i * wpls;
2568 lined = datad + i * wpld;
2569 for (j = 0; j < w; j++) {
2596l_int32 i, j, w, h, val, index, valid;
2598l_uint32 *linec, *lined;
2599l_uint32 *datac, *datad;
2605 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2606 if ((cmap = pixGetColormap(pixs)) == NULL)
2607 return (
PIX *)ERROR_PTR(
"pixs not cmapped", __func__, NULL);
2609 return (
PIX *)ERROR_PTR(
"alpha in cmaps not supported", __func__, NULL);
2611 return (
PIX *)ERROR_PTR(
"invalid comp", __func__, NULL);
2614 if (pixGetDepth(pixs) == 8)
2615 pixc = pixClone(pixs);
2617 pixc = pixConvertTo8(pixs, TRUE);
2618 pixcmapIsValid(cmap, pixc, &valid);
2621 return (
PIX *)ERROR_PTR(
"invalid colormap", __func__, NULL);
2624 pixGetDimensions(pixs, &w, &h, NULL);
2625 if ((pixd = pixCreate(w, h, 8)) == NULL) {
2627 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2629 pixCopyResolution(pixd, pixs);
2630 wplc = pixGetWpl(pixc);
2631 wpld = pixGetWpl(pixd);
2632 datac = pixGetData(pixc);
2633 datad = pixGetData(pixd);
2636 for (i = 0; i < h; i++) {
2637 linec = datac + i * wplc;
2638 lined = datad + i * wpld;
2640 for (j = 0; j < w; j++) {
2642 val = cta[index].
red;
2646 for (j = 0; j < w; j++) {
2648 val = cta[index].
green;
2652 for (j = 0; j < w; j++) {
2654 val = cta[index].
blue;
2685l_int32 i, j, w, h, ws, hs, wd, hd, val;
2687l_uint32 *lines, *lined;
2688l_uint32 *datas, *datad;
2690 if (!pixd && pixGetDepth(pixd) != 32)
2691 return ERROR_INT(
"pixd not defined or not 32 bpp", __func__, 1);
2692 if (!pixs && pixGetDepth(pixs) != 32)
2693 return ERROR_INT(
"pixs not defined or not 32 bpp", __func__, 1);
2696 return ERROR_INT(
"invalid component", __func__, 1);
2697 pixGetDimensions(pixs, &ws, &hs, NULL);
2698 pixGetDimensions(pixd, &wd, &hd, NULL);
2699 if (ws != wd || hs != hd)
2700 L_WARNING(
"images sizes not equal\n", __func__);
2705 wpls = pixGetWpl(pixs);
2706 wpld = pixGetWpl(pixd);
2707 datas = pixGetData(pixs);
2708 datad = pixGetData(pixd);
2709 for (i = 0; i < h; i++) {
2710 lines = datas + i * wpls;
2711 lined = datad + i * wpld;
2712 for (j = 0; j < w; j++) {
2746 return ERROR_INT(
"&pixel not defined", __func__, 1);
2748 *ppixel = ((l_uint32)rval << L_RED_SHIFT) |
2749 ((l_uint32)gval << L_GREEN_SHIFT) |
2750 ((l_uint32)bval << L_BLUE_SHIFT);
2777 return ERROR_INT(
"&pixel not defined", __func__, 1);
2779 *ppixel = ((l_uint32)rval << L_RED_SHIFT) |
2780 ((l_uint32)gval << L_GREEN_SHIFT) |
2781 ((l_uint32)bval << L_BLUE_SHIFT) |
2810 if (prval) *prval = (pixel >> L_RED_SHIFT) & 0xff;
2811 if (pgval) *pgval = (pixel >> L_GREEN_SHIFT) & 0xff;
2812 if (pbval) *pbval = (pixel >> L_BLUE_SHIFT) & 0xff;
2833 if (prval) *prval = (pixel >> L_RED_SHIFT) & 0xff;
2834 if (pgval) *pgval = (pixel >> L_GREEN_SHIFT) & 0xff;
2835 if (pbval) *pbval = (pixel >> L_BLUE_SHIFT) & 0xff;
2836 if (paval) *paval = (pixel >> L_ALPHA_SHIFT) & 0xff;
2851l_int32 rval, gval, bval, val;
2854 if (type == L_CHOOSE_MIN) {
2855 val = L_MIN(rval, gval);
2856 val = L_MIN(val, bval);
2858 val = L_MAX(rval, gval);
2859 val = L_MAX(val, bval);
2893 return ERROR_INT(
"pixs not defined", __func__, 1);
2894 if (pixGetDepth(pixs) != 32)
2895 return ERROR_INT(
"pixs not 32 bpp", __func__, 1);
2896 if (!bufr || !bufg || !bufb)
2897 return ERROR_INT(
"buffer not defined", __func__, 1);
2899 pixGetDimensions(pixs, &w, &h, NULL);
2900 if (row < 0 || row >= h)
2901 return ERROR_INT(
"row out of bounds", __func__, 1);
2902 wpls = pixGetWpl(pixs);
2903 lines = pixGetData(pixs) + row * wpls;
2905 for (j = 0; j < w; j++) {
2941 return ERROR_INT(
"line not defined", __func__, 1);
2943 return ERROR_INT(
"j must be >= 0", __func__, 1);
2944 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 32)
2945 return ERROR_INT(
"invalid d", __func__, 1);
2993l_uint32 *datas, *datad;
2994l_int32 i, j, h, wpl;
3000 return pixClone(pixs);
3005 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
3007 datas = pixGetData(pixs);
3008 wpl = pixGetWpl(pixs);
3009 h = pixGetHeight(pixs);
3010 if ((pixd = pixCreateTemplate(pixs)) == NULL)
3011 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
3012 datad = pixGetData(pixd);
3013 for (i = 0; i < h; i++) {
3014 for (j = 0; j < wpl; j++, datas++, datad++) {
3016 *datad = (word >> 24) |
3017 ((word >> 8) & 0x0000ff00) |
3018 ((word << 8) & 0x00ff0000) |
3056l_int32 i, j, h, wpl;
3066 return ERROR_INT(
"pixs not defined", __func__, 1);
3068 data = pixGetData(pixs);
3069 wpl = pixGetWpl(pixs);
3070 h = pixGetHeight(pixs);
3071 for (i = 0; i < h; i++) {
3072 for (j = 0; j < wpl; j++, data++) {
3074 *data = (word >> 24) |
3075 ((word >> 8) & 0x0000ff00) |
3076 ((word << 8) & 0x00ff0000) |
3116 if (!datad || !datas)
3117 return ERROR_INT(
"datad and datas not both defined", __func__, 1);
3121 memcpy(datad, datas, 4 * wpl);
3126 for (j = 0; j < wpl; j++, datas++, datad++) {
3128 *datad = (word >> 24) |
3129 ((word >> 8) & 0x0000ff00) |
3130 ((word << 8) & 0x00ff0000) |
3162l_uint32 *datas, *datad;
3163l_int32 i, j, h, wpl;
3169 return pixClone(pixs);
3174 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
3176 datas = pixGetData(pixs);
3177 wpl = pixGetWpl(pixs);
3178 h = pixGetHeight(pixs);
3179 if ((pixd = pixCreateTemplate(pixs)) == NULL)
3180 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
3181 datad = pixGetData(pixd);
3182 for (i = 0; i < h; i++) {
3183 for (j = 0; j < wpl; j++, datas++, datad++) {
3185 *datad = (word << 16) | (word >> 16);
3215l_int32 i, j, h, wpl;
3225 return ERROR_INT(
"pixs not defined", __func__, 1);
3227 data = pixGetData(pixs);
3228 wpl = pixGetWpl(pixs);
3229 h = pixGetHeight(pixs);
3230 for (i = 0; i < h; i++) {
3231 for (j = 0; j < wpl; j++, data++) {
3233 *data = (word << 16) | (word >> 16);
3268l_int32 w, h, d, wpl, i, j, rval, gval, bval;
3270l_uint8 *line, *data;
3271l_uint32 *rline, *rdata;
3273 if (pdata) *pdata = NULL;
3274 if (pnbytes) *pnbytes = 0;
3275 if (!pdata || !pnbytes)
3276 return ERROR_INT(
"&data and &nbytes not both defined", __func__, 1);
3278 return ERROR_INT(
"pixs not defined", __func__, 1);
3279 pixGetDimensions(pixs, &w, &h, &d);
3280 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 32)
3281 return ERROR_INT(
"depth not in {1,2,4,8,16,32}", __func__, 1);
3284 rdata = pixGetData(pixs);
3285 wpl = pixGetWpl(pixs);
3287 databpl = (w + 7) / 8;
3289 databpl = (w + 3) / 4;
3291 databpl = (w + 1) / 2;
3292 else if (d == 8 || d == 16)
3293 databpl = w * (d / 8);
3296 if ((data = (l_uint8 *)LEPT_CALLOC((
size_t)databpl * h,
sizeof(l_uint8)))
3298 return ERROR_INT(
"data not allocated", __func__, 1);
3300 *pnbytes = (size_t)databpl * h;
3302 for (i = 0; i < h; i++) {
3303 rline = rdata + i * wpl;
3304 line = data + i * databpl;
3306 for (j = 0; j < databpl; j++)
3308 }
else if (d == 16) {
3309 for (j = 0; j < w; j++)
3312 for (j = 0; j < w; j++) {
3314 *(line + 3 * j) = rval;
3315 *(line + 3 * j + 1) = gval;
3316 *(line + 3 * j + 2) = bval;
3350l_int32 w, h, maxdim, res;
3353 return ERROR_INT(
"&res not defined", __func__, 1);
3356 return ERROR_INT(
"pix not defined", __func__, 1);
3357 if (longside <= 0.0)
3358 return ERROR_INT(
"longside not > 0", __func__, 1);
3360 pixGetDimensions(pix, &w, &h, NULL);
3361 maxdim = L_MAX(w, h);
3362 res = (l_int32)(maxdim / longside + 0.5);
3363 res = L_MAX(res, 1);
3365 L_WARNING(
"low inferred resolution: %d ppi\n", __func__, res);
3367 L_WARNING(
"high inferred resolution: %d ppi\n", __func__, res);
3393l_int32 w, h, wpl, i, j, alpha;
3394l_uint32 *data, *line;
3397 return ERROR_INT(
"&opaque not defined", __func__, 1);
3400 return ERROR_INT(
"&pix not defined", __func__, 1);
3401 if (pixGetDepth(pix) != 32)
3402 return ERROR_INT(
"&pix not 32 bpp", __func__, 1);
3403 if (pixGetSpp(pix) != 4)
3404 return ERROR_INT(
"&pix not 4 spp", __func__, 1);
3406 data = pixGetData(pix);
3407 wpl = pixGetWpl(pix);
3408 pixGetDimensions(pix, &w, &h, NULL);
3409 for (i = 0; i < h; i++) {
3410 line = data + i * wpl;
3411 for (j = 0; j < w; j++) {
3461 if (!pix || pixGetDepth(pix) != 8)
3462 return (l_uint8 **)ERROR_PTR(
"pix not defined or not 8 bpp",
3464 pixGetDimensions(pix, &w, &h, NULL);
3467 if (pixGetColormap(pix))
3468 return (l_uint8 **)ERROR_PTR(
"pix has colormap", __func__, NULL);
3471 return (l_uint8 **)pixGetLinePtrs(pix, NULL);
3493 return ERROR_INT(
"pix not defined", __func__, 1);
3495 return ERROR_INT(
"lineptrs not defined", __func__, 1);
3498 LEPT_FREE(lineptrs);
3532 val1 = L_MAX(0.0f, L_MIN(1.0f, val1));
3533 val2 = L_MAX(0.0f, L_MIN(1.0f, val2));
3534 AlphaMaskBorderVals[0] = val1;
3535 AlphaMaskBorderVals[1] = val2;
#define GET_DATA_QBIT(pdata, n)
#define GET_DATA_TWO_BYTES(pdata, n)
#define CLEAR_DATA_QBIT(pdata, n)
#define CLEAR_DATA_DIBIT(pdata, n)
#define SET_DATA_BIT(pdata, n)
#define SET_DATA_DIBIT(pdata, n, val)
#define SET_DATA_TWO_BYTES(pdata, n, val)
#define SET_DATA_BIT_VAL(pdata, n, val)
#define GET_DATA_BYTE(pdata, n)
#define GET_DATA_DIBIT(pdata, n)
#define SET_DATA_BYTE(pdata, n, val)
#define CLEAR_DATA_BIT(pdata, n)
#define GET_DATA_BIT(pdata, n)
#define SET_DATA_QBIT(pdata, n, val)
l_ok pixSetInRectArbitrary(PIX *pix, BOX *box, l_uint32 val)
pixSetInRectArbitrary()
l_ok pixSetBorderRingVal(PIX *pixs, l_int32 dist, l_uint32 val)
pixSetBorderRingVal()
PIX * pixAddMultipleBlackWhiteBorders(PIX *pixs, l_int32 nblack1, l_int32 nwhite1, l_int32 nblack2, l_int32 nwhite2, l_int32 nblack3, l_int32 nwhite3)
pixAddMultipleBlackWhiteBorders()
l_ok pixAlphaIsOpaque(PIX *pix, l_int32 *popaque)
pixAlphaIsOpaque()
PIX * pixAddContinuedBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot)
pixAddContinuedBorder()
l_int32 lineEndianByteSwap(l_uint32 *datad, l_uint32 *datas, l_int32 wpl)
lineEndianByteSwap()
PIX * pixDisplayLayersRGBA(PIX *pixs, l_uint32 val, l_int32 maxw)
pixDisplayLayersRGBA()
l_uint8 ** pixSetupByteProcessing(PIX *pix, l_int32 *pw, l_int32 *ph)
pixSetupByteProcessing()
l_ok pixSetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 val)
pixSetPixel()
PIX * pixAddRepeatedBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot)
pixAddRepeatedBorder()
l_int32 extractMinMaxComponent(l_uint32 pixel, l_int32 type)
extractMinMaxComponent()
l_ok pixClearAll(PIX *pix)
pixClearAll()
l_ok pixShiftAndTransferAlpha(PIX *pixd, PIX *pixs, l_float32 shiftx, l_float32 shifty)
pixShiftAndTransferAlpha()
l_ok pixGetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 *pval)
pixGetPixel()
l_ok pixClearInRect(PIX *pix, BOX *box)
pixClearInRect()
PIX * pixRemoveBorder(PIX *pixs, l_int32 npix)
pixRemoveBorder()
l_ok pixGetRGBLine(PIX *pixs, l_int32 row, l_uint8 *bufr, l_uint8 *bufg, l_uint8 *bufb)
pixGetRGBLine()
l_ok pixClearPixel(PIX *pix, l_int32 x, l_int32 y)
pixClearPixel()
l_ok pixInferResolution(PIX *pix, l_float32 longside, l_int32 *pres)
pixInferResolution()
PIX * pixEndianByteSwapNew(PIX *pixs)
pixEndianByteSwapNew()
PIX * pixAddBlackOrWhiteBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_int32 op)
pixAddBlackOrWhiteBorder()
void extractRGBAValues(l_uint32 pixel, l_int32 *prval, l_int32 *pgval, l_int32 *pbval, l_int32 *paval)
extractRGBAValues()
l_ok pixEndianTwoByteSwap(PIX *pixs)
pixEndianTwoByteSwap()
PIX * pixCopyBorder(PIX *pixd, PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot)
pixCopyBorder()
l_ok pixSetAllGray(PIX *pix, l_int32 grayval)
pixSetAllGray()
l_ok pixSetBorderVal(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_uint32 val)
pixSetBorderVal()
l_ok pixCopyRGBComponent(PIX *pixd, PIX *pixs, l_int32 comp)
pixCopyRGBComponent()
l_ok pixSetInRect(PIX *pix, BOX *box)
pixSetInRect()
void setPixelLow(l_uint32 *line, l_int32 x, l_int32 depth, l_uint32 val)
setPixelLow()
void l_setAlphaMaskBorder(l_float32 val1, l_float32 val2)
l_setAlphaMaskBorder()
PIX * pixAddMixedBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot)
pixAddMixedBorder()
l_ok pixGetRandomPixel(PIX *pix, l_uint32 *pval, l_int32 *px, l_int32 *py)
pixGetRandomPixel()
l_ok pixGetBlackOrWhiteVal(PIX *pixs, l_int32 op, l_uint32 *pval)
pixGetBlackOrWhiteVal()
PIX * pixRemoveBorderGeneral(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot)
pixRemoveBorderGeneral()
l_ok pixSetAll(PIX *pix)
pixSetAll()
l_ok pixSetPadBits(PIX *pix, l_int32 val)
pixSetPadBits()
l_ok pixSetOrClearBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_int32 op)
pixSetOrClearBorder()
PIX * pixGetRGBComponentCmap(PIX *pixs, l_int32 comp)
pixGetRGBComponentCmap()
l_ok pixSetCmapPixel(PIX *pix, l_int32 x, l_int32 y, l_int32 rval, l_int32 gval, l_int32 bval)
pixSetCmapPixel()
l_ok composeRGBAPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_int32 aval, l_uint32 *ppixel)
composeRGBAPixel()
l_ok pixFlipPixel(PIX *pix, l_int32 x, l_int32 y)
pixFlipPixel()
PIX * pixAddMirroredBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot)
pixAddMirroredBorder()
l_ok pixBlendInRect(PIX *pixs, BOX *box, l_uint32 val, l_float32 fract)
pixBlendInRect()
l_ok composeRGBPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *ppixel)
composeRGBPixel()
l_ok pixCleanupByteProcessing(PIX *pix, l_uint8 **lineptrs)
pixCleanupByteProcessing()
void extractRGBValues(l_uint32 pixel, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
extractRGBValues()
l_ok setLineDataVal(l_uint32 *line, l_int32 j, l_int32 d, l_uint32 val)
setLineDataVal()
PIX * pixEndianTwoByteSwapNew(PIX *pixs)
pixEndianTwoByteSwapNew()
l_ok pixGetRGBPixel(PIX *pix, l_int32 x, l_int32 y, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
pixGetRGBPixel()
l_ok pixSetMirroredBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot)
pixSetMirroredBorder()
l_ok pixSetPadBitsBand(PIX *pix, l_int32 by, l_int32 bh, l_int32 val)
pixSetPadBitsBand()
PIX * pixAddBorder(PIX *pixs, l_int32 npix, l_uint32 val)
pixAddBorder()
l_ok pixEndianByteSwap(PIX *pixs)
pixEndianByteSwap()
l_ok pixSetBlackOrWhite(PIX *pixs, l_int32 op)
pixSetBlackOrWhite()
PIX * pixGetRGBComponent(PIX *pixs, l_int32 comp)
pixGetRGBComponent()
PIX * pixAddBorderGeneral(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_uint32 val)
pixAddBorderGeneral()
l_ok pixSetRGBComponent(PIX *pixd, PIX *pixs, l_int32 comp)
pixSetRGBComponent()
l_ok pixSetRGBPixel(PIX *pix, l_int32 x, l_int32 y, l_int32 rval, l_int32 gval, l_int32 bval)
pixSetRGBPixel()
l_ok pixSetComponentArbitrary(PIX *pix, l_int32 comp, l_int32 val)
pixSetComponentArbitrary()
PIX * pixRemoveBorderToSize(PIX *pixs, l_int32 wd, l_int32 hd)
pixRemoveBorderToSize()
l_ok pixSetAllArbitrary(PIX *pix, l_uint32 val)
pixSetAllArbitrary()
l_ok pixGetRasterData(PIX *pixs, l_uint8 **pdata, size_t *pnbytes)
pixGetRasterData()
PIX * pixCreateRGBImage(PIX *pixr, PIX *pixg, PIX *pixb)
pixCreateRGBImage()