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 *pval = (d == 32) ? 0xffffff00 : (1 << d) - 1;
745 pixcmapAddBlackOrWhite(cmap, 0, &index);
747 pixcmapAddBlackOrWhite(cmap, 1, &index);
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;
1169l_uint32 *data, *line;
1174 return ERROR_INT(
"pix not defined", __func__, 1);
1176 return ERROR_INT(
"box not defined", __func__, 1);
1177 pixGetDimensions(pix, &w, &h, &d);
1178 if (d != 1 && d != 2 && d != 4 && d !=8 && d != 16 && d != 32)
1179 return ERROR_INT(
"depth must be in {1,2,4,8,16,32} bpp", __func__, 1);
1180 if ((cmap = pixGetColormap(pix)) != NULL) {
1181 n = pixcmapGetCount(cmap);
1183 L_WARNING(
"index not in colormap; using last color\n", __func__);
1188 maxval = (d == 32) ? 0xffffff00 : (1 << d) - 1;
1189 if (val > maxval) val = maxval;
1197 (d == 2 && val == 3) ||
1198 (d == 4 && val == 0xf) ||
1199 (d == 8 && val == 0xff) ||
1200 (d == 16 && val == 0xffff) ||
1201 (d == 32 && ((val ^ 0xffffff00) >> 8 == 0))) {
1207 if ((boxc = boxClipToRectangle(box, w, h)) == NULL)
1208 return ERROR_INT(
"no overlap of box with image", __func__, 1);
1209 boxGetGeometry(boxc, &xstart, &ystart, &bw, &bh);
1210 xend = xstart + bw - 1;
1211 yend = ystart + bh - 1;
1214 wpl = pixGetWpl(pix);
1215 data = pixGetData(pix);
1216 for (y = ystart; y <= yend; y++) {
1217 line = data + y * wpl;
1218 for (x = xstart; x <= xend; x++) {
1237 return ERROR_INT(
"depth not 2|4|8|16|32 bpp", __func__, 1);
1268l_int32 i, j, bx, by, bw, bh, w, h, wpls;
1269l_int32 prval, pgval, pbval, rval, gval, bval;
1271l_uint32 *datas, *lines;
1273 if (!pixs || pixGetDepth(pixs) != 32)
1274 return ERROR_INT(
"pixs not defined or not 32 bpp", __func__, 1);
1277 pixGetDimensions(pixs, &w, &h, NULL);
1278 datas = pixGetData(pixs);
1279 wpls = pixGetWpl(pixs);
1281 for (i = 0; i < h; i++) {
1282 lines = datas + i * wpls;
1283 for (j = 0; j < w; j++) {
1284 val32 = *(lines + j);
1286 prval = (l_int32)((1. - fract) * prval + fract * rval);
1287 pgval = (l_int32)((1. - fract) * pgval + fract * gval);
1288 pbval = (l_int32)((1. - fract) * pbval + fract * bval);
1290 *(lines + j) = val32;
1296 boxGetGeometry(box, &bx, &by, &bw, &bh);
1297 for (i = 0; i < bh; i++) {
1298 if (by + i < 0 || by + i >= h)
continue;
1299 lines = datas + (by + i) * wpls;
1300 for (j = 0; j < bw; j++) {
1301 if (bx + j < 0 || bx + j >= w)
continue;
1302 val32 = *(lines + bx + j);
1304 prval = (l_int32)((1. - fract) * prval + fract * rval);
1305 pgval = (l_int32)((1. - fract) * pgval + fract * gval);
1306 pbval = (l_int32)((1. - fract) * pbval + fract * bval);
1308 *(lines + bx + j) = val32;
1353l_int32 i, w, h, d, wpl, endbits, fullwords;
1355l_uint32 *data, *pword;
1358 return ERROR_INT(
"pix not defined", __func__, 1);
1360 pixGetDimensions(pix, &w, &h, &d);
1364 L_INFO(
"pix is 24 bpp\n", __func__);
1368 data = pixGetData(pix);
1369 wpl = pixGetWpl(pix);
1370 endbits = 32 - (((l_int64)w * d) % 32);
1373 fullwords = (1LL * w * d) / 32;
1374 mask = rmask32[endbits];
1378 for (i = 0; i < h; i++) {
1379 pword = data + i * wpl + fullwords;
1381 *pword = *pword & mask;
1383 *pword = *pword | mask;
1418l_int32 i, w, h, d, wpl, endbits, fullwords;
1420l_uint32 *data, *pword;
1423 return ERROR_INT(
"pix not defined", __func__, 1);
1425 pixGetDimensions(pix, &w, &h, &d);
1429 L_INFO(
"pix is 24 bpp\n", __func__);
1436 return ERROR_INT(
"start y not in image", __func__, 1);
1440 data = pixGetData(pix);
1441 wpl = pixGetWpl(pix);
1442 endbits = 32 - (((l_int64)w * d) % 32);
1445 fullwords = (l_int64)w * d / 32;
1447 mask = rmask32[endbits];
1451 for (i = by; i < by + bh; i++) {
1452 pword = data + i * wpl + fullwords;
1454 *pword = *pword & mask;
1456 *pword = *pword | mask;
1497 return ERROR_INT(
"pixs not defined", __func__, 1);
1499 return ERROR_INT(
"op must be PIX_SET or PIX_CLR", __func__, 1);
1501 pixGetDimensions(pixs, &w, &h, NULL);
1502 pixRasterop(pixs, 0, 0, left, h, op, NULL, 0, 0);
1503 pixRasterop(pixs, w - right, 0, right, h, op, NULL, 0, 0);
1504 pixRasterop(pixs, 0, 0, w, top, op, NULL, 0, 0);
1505 pixRasterop(pixs, 0, h - bot, w, bot, op, NULL, 0, 0);
1541l_int32 w, h, d, wpls, i, j, bstart, rstart;
1542l_uint32 *datas, *lines;
1545 return ERROR_INT(
"pixs not defined", __func__, 1);
1546 pixGetDimensions(pixs, &w, &h, &d);
1547 if (d != 8 && d != 16 && d != 32)
1548 return ERROR_INT(
"depth must be 8, 16 or 32 bpp", __func__, 1);
1550 datas = pixGetData(pixs);
1551 wpls = pixGetWpl(pixs);
1554 for (i = 0; i < top; i++) {
1555 lines = datas + i * wpls;
1556 for (j = 0; j < w; j++)
1561 for (i = top; i < bstart; i++) {
1562 lines = datas + i * wpls;
1563 for (j = 0; j < left; j++)
1565 for (j = rstart; j < w; j++)
1568 for (i = bstart; i < h; i++) {
1569 lines = datas + i * wpls;
1570 for (j = 0; j < w; j++)
1573 }
else if (d == 16) {
1575 for (i = 0; i < top; i++) {
1576 lines = datas + i * wpls;
1577 for (j = 0; j < w; j++)
1582 for (i = top; i < bstart; i++) {
1583 lines = datas + i * wpls;
1584 for (j = 0; j < left; j++)
1586 for (j = rstart; j < w; j++)
1589 for (i = bstart; i < h; i++) {
1590 lines = datas + i * wpls;
1591 for (j = 0; j < w; j++)
1595 for (i = 0; i < top; i++) {
1596 lines = datas + i * wpls;
1597 for (j = 0; j < w; j++)
1602 for (i = top; i < bstart; i++) {
1603 lines = datas + i * wpls;
1604 for (j = 0; j < left; j++)
1606 for (j = rstart; j < w; j++)
1609 for (i = bstart; i < h; i++) {
1610 lines = datas + i * wpls;
1611 for (j = 0; j < w; j++)
1640l_int32 w, h, d, i, j, xend, yend;
1643 return ERROR_INT(
"pixs not defined", __func__, 1);
1645 return ERROR_INT(
"dist must be > 0", __func__, 1);
1646 pixGetDimensions(pixs, &w, &h, &d);
1647 if (w < 2 * dist + 1 || h < 2 * dist + 1)
1648 return ERROR_INT(
"ring doesn't exist", __func__, 1);
1649 if (d < 32 && (val >= (1 << d)))
1650 return ERROR_INT(
"invalid pixel value", __func__, 1);
1654 for (j = dist - 1; j <= xend; j++)
1656 for (j = dist - 1; j <= xend; j++)
1658 for (i = dist - 1; i <= yend; i++)
1660 for (i = dist - 1; i <= yend; i++)
1694 return ERROR_INT(
"pixs not defined", __func__, 1);
1696 pixGetDimensions(pixs, &w, &h, NULL);
1697 for (j = 0; j < left; j++)
1698 pixRasterop(pixs, left - 1 - j, top, 1, h - top - bot,
PIX_SRC,
1699 pixs, left + j, top);
1700 for (j = 0; j < right; j++)
1701 pixRasterop(pixs, w - right + j, top, 1, h - top - bot,
PIX_SRC,
1702 pixs, w - right - 1 - j, top);
1703 for (i = 0; i < top; i++)
1704 pixRasterop(pixs, 0, top - 1 - i, w, 1,
PIX_SRC,
1706 for (i = 0; i < bot; i++)
1707 pixRasterop(pixs, 0, h - bot + i, w, 1,
PIX_SRC,
1708 pixs, 0, h - bot - 1 - i);
1744 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, pixd);
1748 L_WARNING(
"same: nothing to do\n", __func__);
1750 }
else if (!pixSizesEqual(pixs, pixd)) {
1751 return (
PIX *)ERROR_PTR(
"pixs and pixd sizes differ",
1755 if ((pixd = pixCreateTemplate(pixs)) == NULL)
1756 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, pixd);
1759 pixGetDimensions(pixs, &w, &h, NULL);
1760 pixRasterop(pixd, 0, 0, left, h,
PIX_SRC, pixs, 0, 0);
1761 pixRasterop(pixd, w - right, 0, right, h,
PIX_SRC, pixs, w - right, 0);
1762 pixRasterop(pixd, 0, 0, w, top,
PIX_SRC, pixs, 0, 0);
1763 pixRasterop(pixd, 0, h - bot, w, bot,
PIX_SRC, pixs, 0, h - bot);
1791 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1793 return pixClone(pixs);
1834 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1836 return (
PIX *)ERROR_PTR(
"invalid op", __func__, NULL);
1883l_int32 ws, hs, wd, hd, d, op;
1888 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1889 if (left < 0 || right < 0 || top < 0 || bot < 0)
1890 return (
PIX *)ERROR_PTR(
"negative border added!", __func__, NULL);
1892 pixGetDimensions(pixs, &ws, &hs, &d);
1893 wd = ws + left + right;
1894 hd = hs + top + bot;
1895 if ((pixd = pixCreate(wd, hd, d)) == NULL)
1896 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
1897 pixCopyResolution(pixd, pixs);
1898 pixCopyColormap(pixd, pixs);
1901 maxval = (d == 32) ? 0xffffff00 : (1 << d) - 1;
1905 else if (val >= maxval)
1910 pixRasterop(pixd, 0, 0, left, hd, op, NULL, 0, 0);
1911 pixRasterop(pixd, wd - right, 0, right, hd, op, NULL, 0, 0);
1912 pixRasterop(pixd, 0, 0, wd, top, op, NULL, 0, 0);
1913 pixRasterop(pixd, 0, hd - bot, wd, bot, op, NULL, 0, 0);
1917 pixRasterop(pixd, left, top, ws, hs,
PIX_SRC, pixs, 0, 0);
1958 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1966 pixd = pixClone(pixs);
1967 for (i = 0; i < 6; i++) {
1969 L_WARNING(
"w = %d > 500; skipping\n", __func__, w[i]);
1970 if (w[i] > 0 && w[i] <= 500) {
1995 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1997 return pixClone(pixs);
2016l_int32 ws, hs, wd, hd, d;
2020 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2021 if (left < 0 || right < 0 || top < 0 || bot < 0)
2022 return (
PIX *)ERROR_PTR(
"negative border removed!", __func__, NULL);
2024 pixGetDimensions(pixs, &ws, &hs, &d);
2025 wd = ws - left - right;
2026 hd = hs - top - bot;
2028 return (
PIX *)ERROR_PTR(
"width must be > 0", __func__, NULL);
2030 return (
PIX *)ERROR_PTR(
"height must be > 0", __func__, NULL);
2031 if ((pixd = pixCreate(wd, hd, d)) == NULL)
2032 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2033 pixCopyResolution(pixd, pixs);
2034 pixCopySpp(pixd, pixs);
2035 pixCopyColormap(pixd, pixs);
2037 pixRasterop(pixd, 0, 0, wd, hd,
PIX_SRC, pixs, left, top);
2038 if (pixGetDepth(pixs) == 32 && pixGetSpp(pixs) == 4)
2065l_int32 w, h, top, bot, left, right, delta;
2068 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2070 pixGetDimensions(pixs, &w, &h, NULL);
2071 if ((wd <= 0 || wd >= w) && (hd <= 0 || hd >= h))
2072 return pixClone(pixs);
2074 left = right = (w - wd) / 2;
2075 delta = w - 2 * left - wd;
2077 top = bot = (h - hd) / 2;
2078 delta = h - hd - 2 * top;
2080 if (wd <= 0 || wd > w)
2082 else if (hd <= 0 || hd > h)
2124 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2125 pixGetDimensions(pixs, &w, &h, NULL);
2126 if (left > w || right > w || top > h || bot > h)
2127 return (
PIX *)ERROR_PTR(
"border too large", __func__, NULL);
2131 for (j = 0; j < left; j++)
2132 pixRasterop(pixd, left - 1 - j, top, 1, h,
PIX_SRC,
2133 pixd, left + j, top);
2134 for (j = 0; j < right; j++)
2135 pixRasterop(pixd, left + w + j, top, 1, h,
PIX_SRC,
2136 pixd, left + w - 1 - j, top);
2137 for (i = 0; i < top; i++)
2138 pixRasterop(pixd, 0, top - 1 - i, left + w + right, 1,
PIX_SRC,
2140 for (i = 0; i < bot; i++)
2141 pixRasterop(pixd, 0, top + h + i, left + w + right, 1,
PIX_SRC,
2142 pixd, 0, top + h - 1 - i);
2175 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2176 pixGetDimensions(pixs, &w, &h, NULL);
2177 if (left > w || right > w || top > h || bot > h)
2178 return (
PIX *)ERROR_PTR(
"border too large", __func__, NULL);
2183 pixRasterop(pixd, 0, top, left, h,
PIX_SRC, pixd, w, top);
2184 pixRasterop(pixd, left + w, top, right, h,
PIX_SRC, pixd, left, top);
2185 pixRasterop(pixd, 0, 0, left + w + right, top,
PIX_SRC, pixd, 0, h);
2186 pixRasterop(pixd, 0, top + h, left + w + right, bot,
PIX_SRC, pixd, 0, top);
2229 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2230 pixGetDimensions(pixs, &w, &h, NULL);
2231 if (left > w || right > w || top > h || bot > h)
2232 return (
PIX *)ERROR_PTR(
"border too large", __func__, NULL);
2237 for (j = 0; j < left; j++)
2238 pixRasterop(pixd, left - 1 - j, top, 1, h,
PIX_SRC,
2239 pixd, left + j, top);
2240 for (j = 0; j < right; j++)
2241 pixRasterop(pixd, left + w + j, top, 1, h,
PIX_SRC,
2242 pixd, left + w - 1 - j, top);
2243 pixRasterop(pixd, 0, 0, left + w + right, top,
PIX_SRC, pixd, 0, h);
2244 pixRasterop(pixd, 0, top + h, left + w + right, bot,
PIX_SRC, pixd, 0, top);
2274 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2277 pixGetDimensions(pixs, &w, &h, NULL);
2278 for (j = 0; j < left; j++)
2279 pixRasterop(pixd, j, top, 1, h,
PIX_SRC, pixd, left, top);
2280 for (j = 0; j < right; j++)
2281 pixRasterop(pixd, left + w + j, top, 1, h,
2282 PIX_SRC, pixd, left + w - 1, top);
2283 for (i = 0; i < top; i++)
2284 pixRasterop(pixd, 0, i, left + w + right, 1,
PIX_SRC, pixd, 0, top);
2285 for (i = 0; i < bot; i++)
2286 pixRasterop(pixd, 0, top + h + i, left + w + right, 1,
2287 PIX_SRC, pixd, 0, top + h - 1);
2314 return ERROR_INT(
"pixs and pixd not both defined", __func__, 1);
2315 if (pixGetDepth(pixs) != 32 || pixGetSpp(pixs) != 4)
2316 return ERROR_INT(
"pixs not 32 bpp and 4 spp", __func__, 1);
2317 if (pixGetDepth(pixd) != 32)
2318 return ERROR_INT(
"pixd not 32 bpp", __func__, 1);
2320 if (shiftx == 0 && shifty == 0) {
2326 pixGetDimensions(pixd, &w, &h, NULL);
2327 pix2 = pixCreate(w, h, 8);
2328 pixRasterop(pix2, 0, 0, w, h,
PIX_SRC, pix1, -shiftx, -shifty);
2360PIX *pix1, *pix2, *pixd;
2365 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2366 cmap = pixGetColormap(pixs);
2367 if (!cmap && !(pixGetDepth(pixs) == 32 && pixGetSpp(pixs) == 4))
2368 return (
PIX *)ERROR_PTR(
"pixs not cmap and not 32 bpp rgba",
2370 if ((w = pixGetWidth(pixs)) == 0)
2371 return (
PIX *)ERROR_PTR(
"pixs width 0 !!", __func__, NULL);
2376 pix1 = pixCopy(NULL, pixs);
2379 scalefact = (maxw == 0) ? 1.0f : L_MIN(1.0f, (l_float32)(maxw) / w);
2380 width = (l_int32)(scalefact * w);
2382 pixa = pixaCreate(3);
2386 pix2 = pixConvertTo32(pix1);
2389 pix1 = pixAlphaBlendUniform(pixs, (val & 0xffffff00));
2391 pixd = pixaDisplayTiledInRows(pixa, 32, width, scalefact, 0, 25, 2);
2428l_int32 wr, wg, wb, hr, hg, hb, dr, dg, db;
2432 return (
PIX *)ERROR_PTR(
"pixr not defined", __func__, NULL);
2434 return (
PIX *)ERROR_PTR(
"pixg not defined", __func__, NULL);
2436 return (
PIX *)ERROR_PTR(
"pixb not defined", __func__, NULL);
2437 pixGetDimensions(pixr, &wr, &hr, &dr);
2438 pixGetDimensions(pixg, &wg, &hg, &dg);
2439 pixGetDimensions(pixb, &wb, &hb, &db);
2440 if (dr != 8 || dg != 8 || db != 8)
2441 return (
PIX *)ERROR_PTR(
"input pix not all 8 bpp", __func__, NULL);
2442 if (wr != wg || wr != wb)
2443 return (
PIX *)ERROR_PTR(
"widths not the same", __func__, NULL);
2444 if (hr != hg || hr != hb)
2445 return (
PIX *)ERROR_PTR(
"heights not the same", __func__, NULL);
2447 if ((pixd = pixCreate(wr, hr, 32)) == NULL)
2448 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2449 pixCopyResolution(pixd, pixr);
2481l_int32 i, j, w, h, wpls, wpld, val;
2482l_uint32 *lines, *lined;
2483l_uint32 *datas, *datad;
2487 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2488 if (pixGetColormap(pixs))
2490 if (pixGetDepth(pixs) != 32)
2491 return (
PIX *)ERROR_PTR(
"pixs not 32 bpp", __func__, NULL);
2494 return (
PIX *)ERROR_PTR(
"invalid comp", __func__, NULL);
2496 pixGetDimensions(pixs, &w, &h, NULL);
2497 if ((pixd = pixCreate(w, h, 8)) == NULL)
2498 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2499 pixCopyResolution(pixd, pixs);
2500 wpls = pixGetWpl(pixs);
2501 wpld = pixGetWpl(pixd);
2502 datas = pixGetData(pixs);
2503 datad = pixGetData(pixd);
2504 for (i = 0; i < h; i++) {
2505 lines = datas + i * wpls;
2506 lined = datad + i * wpld;
2507 for (j = 0; j < w; j++) {
2540l_int32 i, j, w, h, ws, hs, wd, hd;
2542l_uint32 *lines, *lined;
2543l_uint32 *datas, *datad;
2546 return ERROR_INT(
"pixd not defined", __func__, 1);
2548 return ERROR_INT(
"pixs not defined", __func__, 1);
2549 if (pixGetDepth(pixd) != 32)
2550 return ERROR_INT(
"pixd not 32 bpp", __func__, 1);
2551 if (pixGetDepth(pixs) != 8)
2552 return ERROR_INT(
"pixs not 8 bpp", __func__, 1);
2555 return ERROR_INT(
"invalid comp", __func__, 1);
2556 pixGetDimensions(pixs, &ws, &hs, NULL);
2557 pixGetDimensions(pixd, &wd, &hd, NULL);
2558 if (ws != wd || hs != hd)
2559 L_WARNING(
"images sizes not equal\n", __func__);
2564 datas = pixGetData(pixs);
2565 datad = pixGetData(pixd);
2566 wpls = pixGetWpl(pixs);
2567 wpld = pixGetWpl(pixd);
2568 for (i = 0; i < h; i++) {
2569 lines = datas + i * wpls;
2570 lined = datad + i * wpld;
2571 for (j = 0; j < w; j++) {
2598l_int32 i, j, w, h, val, index, valid;
2600l_uint32 *linec, *lined;
2601l_uint32 *datac, *datad;
2607 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2608 if ((cmap = pixGetColormap(pixs)) == NULL)
2609 return (
PIX *)ERROR_PTR(
"pixs not cmapped", __func__, NULL);
2611 return (
PIX *)ERROR_PTR(
"alpha in cmaps not supported", __func__, NULL);
2613 return (
PIX *)ERROR_PTR(
"invalid comp", __func__, NULL);
2616 if (pixGetDepth(pixs) == 8)
2617 pixc = pixClone(pixs);
2619 pixc = pixConvertTo8(pixs, TRUE);
2620 pixcmapIsValid(cmap, pixc, &valid);
2623 return (
PIX *)ERROR_PTR(
"invalid colormap", __func__, NULL);
2626 pixGetDimensions(pixs, &w, &h, NULL);
2627 if ((pixd = pixCreate(w, h, 8)) == NULL) {
2629 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2631 pixCopyResolution(pixd, pixs);
2632 wplc = pixGetWpl(pixc);
2633 wpld = pixGetWpl(pixd);
2634 datac = pixGetData(pixc);
2635 datad = pixGetData(pixd);
2638 for (i = 0; i < h; i++) {
2639 linec = datac + i * wplc;
2640 lined = datad + i * wpld;
2642 for (j = 0; j < w; j++) {
2644 val = cta[index].
red;
2648 for (j = 0; j < w; j++) {
2650 val = cta[index].
green;
2654 for (j = 0; j < w; j++) {
2656 val = cta[index].
blue;
2687l_int32 i, j, w, h, ws, hs, wd, hd, val;
2689l_uint32 *lines, *lined;
2690l_uint32 *datas, *datad;
2692 if (!pixd && pixGetDepth(pixd) != 32)
2693 return ERROR_INT(
"pixd not defined or not 32 bpp", __func__, 1);
2694 if (!pixs && pixGetDepth(pixs) != 32)
2695 return ERROR_INT(
"pixs not defined or not 32 bpp", __func__, 1);
2698 return ERROR_INT(
"invalid component", __func__, 1);
2699 pixGetDimensions(pixs, &ws, &hs, NULL);
2700 pixGetDimensions(pixd, &wd, &hd, NULL);
2701 if (ws != wd || hs != hd)
2702 L_WARNING(
"images sizes not equal\n", __func__);
2707 wpls = pixGetWpl(pixs);
2708 wpld = pixGetWpl(pixd);
2709 datas = pixGetData(pixs);
2710 datad = pixGetData(pixd);
2711 for (i = 0; i < h; i++) {
2712 lines = datas + i * wpls;
2713 lined = datad + i * wpld;
2714 for (j = 0; j < w; j++) {
2748 return ERROR_INT(
"&pixel not defined", __func__, 1);
2750 *ppixel = ((l_uint32)rval << L_RED_SHIFT) |
2751 ((l_uint32)gval << L_GREEN_SHIFT) |
2752 ((l_uint32)bval << L_BLUE_SHIFT);
2779 return ERROR_INT(
"&pixel not defined", __func__, 1);
2781 *ppixel = ((l_uint32)rval << L_RED_SHIFT) |
2782 ((l_uint32)gval << L_GREEN_SHIFT) |
2783 ((l_uint32)bval << L_BLUE_SHIFT) |
2812 if (prval) *prval = (pixel >> L_RED_SHIFT) & 0xff;
2813 if (pgval) *pgval = (pixel >> L_GREEN_SHIFT) & 0xff;
2814 if (pbval) *pbval = (pixel >> L_BLUE_SHIFT) & 0xff;
2835 if (prval) *prval = (pixel >> L_RED_SHIFT) & 0xff;
2836 if (pgval) *pgval = (pixel >> L_GREEN_SHIFT) & 0xff;
2837 if (pbval) *pbval = (pixel >> L_BLUE_SHIFT) & 0xff;
2838 if (paval) *paval = (pixel >> L_ALPHA_SHIFT) & 0xff;
2853l_int32 rval, gval, bval, val;
2856 if (type == L_CHOOSE_MIN) {
2857 val = L_MIN(rval, gval);
2858 val = L_MIN(val, bval);
2860 val = L_MAX(rval, gval);
2861 val = L_MAX(val, bval);
2895 return ERROR_INT(
"pixs not defined", __func__, 1);
2896 if (pixGetDepth(pixs) != 32)
2897 return ERROR_INT(
"pixs not 32 bpp", __func__, 1);
2898 if (!bufr || !bufg || !bufb)
2899 return ERROR_INT(
"buffer not defined", __func__, 1);
2901 pixGetDimensions(pixs, &w, &h, NULL);
2902 if (row < 0 || row >= h)
2903 return ERROR_INT(
"row out of bounds", __func__, 1);
2904 wpls = pixGetWpl(pixs);
2905 lines = pixGetData(pixs) + row * wpls;
2907 for (j = 0; j < w; j++) {
2943 return ERROR_INT(
"line not defined", __func__, 1);
2945 return ERROR_INT(
"j must be >= 0", __func__, 1);
2946 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 32)
2947 return ERROR_INT(
"invalid d", __func__, 1);
2995l_uint32 *datas, *datad;
2996l_int32 i, j, h, wpl;
3002 return pixClone(pixs);
3007 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
3009 datas = pixGetData(pixs);
3010 wpl = pixGetWpl(pixs);
3011 h = pixGetHeight(pixs);
3012 if ((pixd = pixCreateTemplate(pixs)) == NULL)
3013 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
3014 datad = pixGetData(pixd);
3015 for (i = 0; i < h; i++) {
3016 for (j = 0; j < wpl; j++, datas++, datad++) {
3018 *datad = (word >> 24) |
3019 ((word >> 8) & 0x0000ff00) |
3020 ((word << 8) & 0x00ff0000) |
3058l_int32 i, j, h, wpl;
3068 return ERROR_INT(
"pixs not defined", __func__, 1);
3070 data = pixGetData(pixs);
3071 wpl = pixGetWpl(pixs);
3072 h = pixGetHeight(pixs);
3073 for (i = 0; i < h; i++) {
3074 for (j = 0; j < wpl; j++, data++) {
3076 *data = (word >> 24) |
3077 ((word >> 8) & 0x0000ff00) |
3078 ((word << 8) & 0x00ff0000) |
3118 if (!datad || !datas)
3119 return ERROR_INT(
"datad and datas not both defined", __func__, 1);
3123 memcpy(datad, datas, 4 * wpl);
3128 for (j = 0; j < wpl; j++, datas++, datad++) {
3130 *datad = (word >> 24) |
3131 ((word >> 8) & 0x0000ff00) |
3132 ((word << 8) & 0x00ff0000) |
3164l_uint32 *datas, *datad;
3165l_int32 i, j, h, wpl;
3171 return pixClone(pixs);
3176 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
3178 datas = pixGetData(pixs);
3179 wpl = pixGetWpl(pixs);
3180 h = pixGetHeight(pixs);
3181 if ((pixd = pixCreateTemplate(pixs)) == NULL)
3182 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
3183 datad = pixGetData(pixd);
3184 for (i = 0; i < h; i++) {
3185 for (j = 0; j < wpl; j++, datas++, datad++) {
3187 *datad = (word << 16) | (word >> 16);
3217l_int32 i, j, h, wpl;
3227 return ERROR_INT(
"pixs not defined", __func__, 1);
3229 data = pixGetData(pixs);
3230 wpl = pixGetWpl(pixs);
3231 h = pixGetHeight(pixs);
3232 for (i = 0; i < h; i++) {
3233 for (j = 0; j < wpl; j++, data++) {
3235 *data = (word << 16) | (word >> 16);
3270l_int32 w, h, d, wpl, i, j, rval, gval, bval;
3272l_uint8 *line, *data;
3273l_uint32 *rline, *rdata;
3275 if (pdata) *pdata = NULL;
3276 if (pnbytes) *pnbytes = 0;
3277 if (!pdata || !pnbytes)
3278 return ERROR_INT(
"&data and &nbytes not both defined", __func__, 1);
3280 return ERROR_INT(
"pixs not defined", __func__, 1);
3281 pixGetDimensions(pixs, &w, &h, &d);
3282 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 32)
3283 return ERROR_INT(
"depth not in {1,2,4,8,16,32}", __func__, 1);
3286 rdata = pixGetData(pixs);
3287 wpl = pixGetWpl(pixs);
3289 databpl = (w + 7) / 8;
3291 databpl = (w + 3) / 4;
3293 databpl = (w + 1) / 2;
3294 else if (d == 8 || d == 16)
3295 databpl = w * (d / 8);
3298 if ((data = (l_uint8 *)LEPT_CALLOC((
size_t)databpl * h,
sizeof(l_uint8)))
3300 return ERROR_INT(
"data not allocated", __func__, 1);
3302 *pnbytes = (size_t)databpl * h;
3304 for (i = 0; i < h; i++) {
3305 rline = rdata + i * wpl;
3306 line = data + i * databpl;
3308 for (j = 0; j < databpl; j++)
3310 }
else if (d == 16) {
3311 for (j = 0; j < w; j++)
3314 for (j = 0; j < w; j++) {
3316 *(line + 3 * j) = rval;
3317 *(line + 3 * j + 1) = gval;
3318 *(line + 3 * j + 2) = bval;
3352l_int32 w, h, maxdim, res;
3355 return ERROR_INT(
"&res not defined", __func__, 1);
3358 return ERROR_INT(
"pix not defined", __func__, 1);
3359 if (longside <= 0.0)
3360 return ERROR_INT(
"longside not > 0", __func__, 1);
3362 pixGetDimensions(pix, &w, &h, NULL);
3363 maxdim = L_MAX(w, h);
3364 res = (l_int32)(maxdim / longside + 0.5);
3365 res = L_MAX(res, 1);
3367 L_WARNING(
"low inferred resolution: %d ppi\n", __func__, res);
3369 L_WARNING(
"high inferred resolution: %d ppi\n", __func__, res);
3395l_int32 w, h, wpl, i, j, alpha;
3396l_uint32 *data, *line;
3399 return ERROR_INT(
"&opaque not defined", __func__, 1);
3402 return ERROR_INT(
"&pix not defined", __func__, 1);
3403 if (pixGetDepth(pix) != 32)
3404 return ERROR_INT(
"&pix not 32 bpp", __func__, 1);
3405 if (pixGetSpp(pix) != 4)
3406 return ERROR_INT(
"&pix not 4 spp", __func__, 1);
3408 data = pixGetData(pix);
3409 wpl = pixGetWpl(pix);
3410 pixGetDimensions(pix, &w, &h, NULL);
3411 for (i = 0; i < h; i++) {
3412 line = data + i * wpl;
3413 for (j = 0; j < w; j++) {
3463 if (!pix || pixGetDepth(pix) != 8)
3464 return (l_uint8 **)ERROR_PTR(
"pix not defined or not 8 bpp",
3466 pixGetDimensions(pix, &w, &h, NULL);
3469 if (pixGetColormap(pix))
3470 return (l_uint8 **)ERROR_PTR(
"pix has colormap", __func__, NULL);
3473 return (l_uint8 **)pixGetLinePtrs(pix, NULL);
3495 return ERROR_INT(
"pix not defined", __func__, 1);
3497 return ERROR_INT(
"lineptrs not defined", __func__, 1);
3500 LEPT_FREE(lineptrs);
3534 val1 = L_MAX(0.0f, L_MIN(1.0f, val1));
3535 val2 = L_MAX(0.0f, L_MIN(1.0f, val2));
3536 AlphaMaskBorderVals[0] = val1;
3537 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()