! * \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 * \
| 2412 | * </pre> |
| 2413 | */ |
| 2414 | PIX * |
| 2415 | pixDisplayPtaaPattern(PIX *pixd, |
| 2416 | PIX *pixs, |
| 2417 | PTAA *ptaa, |
| 2418 | PIX *pixp, |
| 2419 | l_int32 cx, |
| 2420 | l_int32 cy) |
| 2421 | { |
| 2422 | l_int32 i, n; |
| 2423 | l_uint32 color; |
| 2424 | PIXCMAP *cmap; |
| 2425 | PTA *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 | /*! |
no test coverage detected