88 #include <config_auto.h>
91 #include "allheaders.h"
131 l_int32 width, height;
134 PROCNAME(
"pixTilingCreate");
137 return (
PIXTILING *)ERROR_PTR(
"pixs not defined", procName, NULL);
139 return (
PIXTILING *)ERROR_PTR(
"invalid width spec", procName, NULL);
141 return (
PIXTILING *)ERROR_PTR(
"invalid height spec", procName, NULL);
149 nx = L_MAX(1, width / w);
152 ny = L_MAX(1, height / h);
154 if (xoverlap > w || yoverlap > h) {
155 L_INFO(
"tile width = %d, tile height = %d\n", procName, w, h);
156 return (
PIXTILING *)ERROR_PTR(
"overlap too large", procName, NULL);
183 PROCNAME(
"pixTilingDestroy");
186 L_WARNING(
"ptr address is null!\n", procName);
190 if ((pt = *ppt) == NULL)
212 PROCNAME(
"pixTilingGetCount");
215 return ERROR_INT(
"pt not defined", procName, 1);
216 if (pnx) *pnx = pt->
nx;
217 if (pny) *pny = pt->
ny;
235 PROCNAME(
"pixTilingGetSize");
238 return ERROR_INT(
"pt not defined", procName, 1);
259 l_int32 wpix, hpix, wt, ht, nx, ny;
260 l_int32 xoverlap, yoverlap, wtlast, htlast;
261 l_int32 left, top, xtraleft, xtraright, xtratop, xtrabot, width, height;
263 PIX *pixs, *pixt, *pixd;
265 PROCNAME(
"pixTilingGetTile");
268 return (
PIX *)ERROR_PTR(
"pt not defined", procName, NULL);
269 if ((pixs = pt->
pix) == NULL)
270 return (
PIX *)ERROR_PTR(
"pix not found", procName, NULL);
272 if (i < 0 || i >= ny)
273 return (
PIX *)ERROR_PTR(
"invalid row index i", procName, NULL);
274 if (j < 0 || j >= nx)
275 return (
PIX *)ERROR_PTR(
"invalid column index j", procName, NULL);
283 wtlast = wpix - wt * (nx - 1);
284 htlast = hpix - ht * (ny - 1);
285 left = L_MAX(0, j * wt - xoverlap);
286 top = L_MAX(0, i * ht - yoverlap);
293 width = wt + xoverlap;
294 else if (j == nx - 1)
295 width = wtlast + xoverlap;
297 width = wt + 2 * xoverlap;
302 height = ht + yoverlap;
303 else if (i == ny - 1)
304 height = htlast + yoverlap;
306 height = ht + 2 * yoverlap;
307 box =
boxCreate(left, top, width, height);
312 if (xoverlap == 0 && yoverlap == 0)
319 xtratop = xtrabot = xtraleft = xtraright = 0;
321 xtraleft = xtraright = xoverlap;
323 xtratop = xtrabot = yoverlap;
324 if (i == 0 && j == 0)
327 else if (i == 0 && j == nx - 1)
330 else if (i == ny - 1 && j == 0)
333 else if (i == ny - 1 && j == nx - 1)
338 else if (i == ny - 1)
342 else if (j == nx - 1)
370 PROCNAME(
"pixTilingNoStripOnPaint");
373 return ERROR_INT(
"pt not defined", procName, 1);
398 PROCNAME(
"pixTilingPaintTile");
401 return ERROR_INT(
"pixd not defined", procName, 1);
403 return ERROR_INT(
"pixs not defined", procName, 1);
405 return ERROR_INT(
"pt not defined", procName, 1);
406 if (i < 0 || i >= pt->
ny)
407 return ERROR_INT(
"invalid row index i", procName, 1);
408 if (j < 0 || j >= pt->
nx)
409 return ERROR_INT(
"invalid column index j", procName, 1);
413 if (pt->
strip == TRUE) {
void boxDestroy(BOX **pbox)
boxDestroy()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
void pixDestroy(PIX **ppix)
pixDestroy()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
PIX * pixClone(PIX *pixs)
pixClone()
PIX * pixAddMirroredBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot)
pixAddMirroredBorder()
PIX * pixClipRectangle(PIX *pixs, BOX *box, BOX **pboxc)
pixClipRectangle()
l_ok pixTilingNoStripOnPaint(PIXTILING *pt)
pixTilingNoStripOnPaint()
l_ok pixTilingGetCount(PIXTILING *pt, l_int32 *pnx, l_int32 *pny)
pixTilingGetCount()
l_ok pixTilingGetSize(PIXTILING *pt, l_int32 *pw, l_int32 *ph)
pixTilingGetSize()
PIX * pixTilingGetTile(PIXTILING *pt, l_int32 i, l_int32 j)
pixTilingGetTile()
void pixTilingDestroy(PIXTILING **ppt)
pixTilingDestroy()
l_ok pixTilingPaintTile(PIX *pixd, l_int32 i, l_int32 j, PIX *pixs, PIXTILING *pt)
pixTilingPaintTile()
PIXTILING * pixTilingCreate(PIX *pixs, l_int32 nx, l_int32 ny, l_int32 w, l_int32 h, l_int32 xoverlap, l_int32 yoverlap)
pixTilingCreate()
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()