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

Function boxaaWriteStream

deps/leptonica/src/boxbasic.c:1998–2029  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1996 * \return 0 if OK, 1 on error
1997 */
1998l_int32
1999boxaaWriteStream(FILE *fp,
2000 BOXAA *baa)
2001{
2002l_int32 n, i, x, y, w, h;
2003BOX *box;
2004BOXA *boxa;
2005
2006 PROCNAME("boxaaWriteStream");
2007
2008 if (!fp)
2009 return ERROR_INT("stream not defined", procName, 1);
2010 if (!baa)
2011 return ERROR_INT("baa not defined", procName, 1);
2012
2013 n = boxaaGetCount(baa);
2014 fprintf(fp, "\nBoxaa Version %d\n", BOXAA_VERSION_NUMBER);
2015 fprintf(fp, "Number of boxa = %d\n", n);
2016
2017 for (i = 0; i < n; i++) {
2018 if ((boxa = boxaaGetBoxa(baa, i, L_CLONE)) == NULL)
2019 return ERROR_INT("boxa not found", procName, 1);
2020 boxaGetExtent(boxa, NULL, NULL, &box);
2021 boxGetGeometry(box, &x, &y, &w, &h);
2022 fprintf(fp, "\nBoxa[%d] extent: x = %d, y = %d, w = %d, h = %d",
2023 i, x, y, w, h);
2024 boxaWriteStream(fp, boxa);
2025 boxDestroy(&box);
2026 boxaDestroy(&boxa);
2027 }
2028 return 0;
2029}
2030
2031
2032/*!

Callers 2

boxaaWriteFunction · 0.85
boxaaWriteMemFunction · 0.85

Calls 7

boxaaGetCountFunction · 0.85
boxaaGetBoxaFunction · 0.85
boxaGetExtentFunction · 0.85
boxGetGeometryFunction · 0.85
boxaWriteStreamFunction · 0.85
boxDestroyFunction · 0.85
boxaDestroyFunction · 0.85

Tested by

no test coverage detected