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

Function pixacompWriteStream

deps/leptonica/src/pixcomp.c:1829–1861  ·  view source on GitHub ↗

! * \brief pixacompWriteStream() * * \param[in] fp file stream * \param[in] pixac * \return 0 if OK, 1 on error */

Source from the content-addressed store, hash-verified

1827 * \return 0 if OK, 1 on error
1828 */
1829l_int32
1830pixacompWriteStream(FILE *fp,
1831 PIXAC *pixac)
1832{
1833l_int32 n, i;
1834PIXC *pixc;
1835
1836 PROCNAME("pixacompWriteStream");
1837
1838 if (!fp)
1839 return ERROR_INT("stream not defined", procName, 1);
1840 if (!pixac)
1841 return ERROR_INT("pixac not defined", procName, 1);
1842
1843 n = pixacompGetCount(pixac);
1844 fprintf(fp, "\nPixacomp Version %d\n", PIXACOMP_VERSION_NUMBER);
1845 fprintf(fp, "Number of pixcomp = %d\n", n);
1846 fprintf(fp, "Offset of index into array = %d", pixac->offset);
1847 boxaWriteStream(fp, pixac->boxa);
1848 for (i = 0; i < n; i++) {
1849 if ((pixc = pixacompGetPixcomp(pixac, pixac->offset + i, L_NOCOPY))
1850 == NULL)
1851 return ERROR_INT("pixc not found", procName, 1);
1852 fprintf(fp, "\nPixcomp[%d]: w = %d, h = %d, d = %d\n",
1853 i, pixc->w, pixc->h, pixc->d);
1854 fprintf(fp, " comptype = %d, size = %lu, cmapflag = %d\n",
1855 pixc->comptype, (unsigned long)pixc->size, pixc->cmapflag);
1856 fprintf(fp, " xres = %d, yres = %d\n", pixc->xres, pixc->yres);
1857 fwrite(pixc->data, 1, pixc->size, fp);
1858 fprintf(fp, "\n");
1859 }
1860 return 0;
1861}
1862
1863
1864/*!

Callers 2

pixacompWriteFunction · 0.85
pixacompWriteMemFunction · 0.85

Calls 3

pixacompGetCountFunction · 0.85
boxaWriteStreamFunction · 0.85
pixacompGetPixcompFunction · 0.85

Tested by

no test coverage detected