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

Function pixConvert1To4Cmap

deps/leptonica/src/pixconv.c:2201–2223  ·  view source on GitHub ↗

---------------------------------------------------------------------------* * 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

Source from the content-addressed store, hash-verified

2199 * </pre>
2200 */
2201PIX *
2202pixConvert1To4Cmap(PIX *pixs)
2203{
2204PIX *pixd;
2205PIXCMAP *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/*!

Callers 2

pixFindPageForegroundFunction · 0.85
pixDebugFlipDetectFunction · 0.85

Calls 6

pixGetDepthFunction · 0.85
pixConvert1To4Function · 0.85
pixcmapCreateFunction · 0.85
pixcmapAddColorFunction · 0.85
pixSetColormapFunction · 0.85
pixCopyInputFormatFunction · 0.85

Tested by

no test coverage detected