---------------------------------------------------------------------------* * Conversion from 1 bpp to 4 bpp * *---------------------------------------------------------------------------*/ ! * \brief pixConvert1To4Cmap() * * \param[in] pixs 1 bpp * \return pixd 4 bpp, cmapped * * * Notes: * (1) Input 0 is mapped to (255, 25
| 2199 | * </pre> |
| 2200 | */ |
| 2201 | PIX * |
| 2202 | pixConvert1To4Cmap(PIX *pixs) |
| 2203 | { |
| 2204 | PIX *pixd; |
| 2205 | PIXCMAP *cmap; |
| 2206 | |
| 2207 | PROCNAME("pixConvert1To4Cmap"); |
| 2208 | |
| 2209 | if (!pixs) |
| 2210 | return (PIX *)ERROR_PTR("pixs not defined", procName, NULL); |
| 2211 | if (pixGetDepth(pixs) != 1) |
| 2212 | return (PIX *)ERROR_PTR("pixs not 1 bpp", procName, NULL); |
| 2213 | |
| 2214 | if ((pixd = pixConvert1To4(NULL, pixs, 0, 1)) == NULL) |
| 2215 | return (PIX *)ERROR_PTR("pixd not made", procName, NULL); |
| 2216 | cmap = pixcmapCreate(4); |
| 2217 | pixcmapAddColor(cmap, 255, 255, 255); |
| 2218 | pixcmapAddColor(cmap, 0, 0, 0); |
| 2219 | pixSetColormap(pixd, cmap); |
| 2220 | pixCopyInputFormat(pixd, pixs); |
| 2221 | |
| 2222 | return pixd; |
| 2223 | } |
| 2224 | |
| 2225 | |
| 2226 | /*! |
no test coverage detected