MCPcopy Create free account
hub / github.com/creatale/node-dv / pixDisplayPtaaPattern

Function pixDisplayPtaaPattern

deps/leptonica/src/ptafunc1.c:2414–2453  ·  view source on GitHub ↗

! * \brief pixDisplayPtaaPattern() * * \param[in] pixd 32 bpp * \param[in] pixs 1, 2, 4, 8, 16 or 32 bpp; 32 bpp if in place * \param[in] ptaa giving locations at which the pattern is displayed * \param[in] pixp 1 bpp pattern to be placed such that its reference * point co-locates with each point in pta * \param[in] cx, cy reference point in pattern * \

Source from the content-addressed store, hash-verified

2412 * </pre>
2413 */
2414PIX *
2415pixDisplayPtaaPattern(PIX *pixd,
2416 PIX *pixs,
2417 PTAA *ptaa,
2418 PIX *pixp,
2419 l_int32 cx,
2420 l_int32 cy)
2421{
2422l_int32 i, n;
2423l_uint32 color;
2424PIXCMAP *cmap;
2425PTA *pta;
2426
2427 PROCNAME("pixDisplayPtaaPattern");
2428
2429 if (!pixs)
2430 return (PIX *)ERROR_PTR("pixs not defined", procName, pixd);
2431 if (!ptaa)
2432 return (PIX *)ERROR_PTR("ptaa not defined", procName, pixd);
2433 if (pixd && (pixd != pixs || pixGetDepth(pixd) != 32))
2434 return (PIX *)ERROR_PTR("invalid pixd", procName, pixd);
2435 if (!pixp)
2436 return (PIX *)ERROR_PTR("pixp not defined", procName, pixd);
2437
2438 if (!pixd)
2439 pixd = pixConvertTo32(pixs);
2440
2441 /* Use 256 random colors */
2442 cmap = pixcmapCreateRandom(8, 0, 0);
2443 n = ptaaGetCount(ptaa);
2444 for (i = 0; i < n; i++) {
2445 pixcmapGetColor32(cmap, i % 256, &color);
2446 pta = ptaaGetPta(ptaa, i, L_CLONE);
2447 pixDisplayPtaPattern(pixd, pixd, pta, pixp, cx, cy, color);
2448 ptaDestroy(&pta);
2449 }
2450
2451 pixcmapDestroy(&cmap);
2452 return pixd;
2453}
2454
2455
2456/*!

Callers 2

dewarpBuildPageModelFunction · 0.85
dewarpFindVertDisparityFunction · 0.85

Calls 9

pixGetDepthFunction · 0.85
pixConvertTo32Function · 0.85
pixcmapCreateRandomFunction · 0.85
ptaaGetCountFunction · 0.85
pixcmapGetColor32Function · 0.85
ptaaGetPtaFunction · 0.85
pixDisplayPtaPatternFunction · 0.85
ptaDestroyFunction · 0.85
pixcmapDestroyFunction · 0.85

Tested by

no test coverage detected