! * \brief boxaaWriteStream() * * \param[in] fp file stream * \param[in] baa * \return 0 if OK, 1 on error */
| 1996 | * \return 0 if OK, 1 on error |
| 1997 | */ |
| 1998 | l_int32 |
| 1999 | boxaaWriteStream(FILE *fp, |
| 2000 | BOXAA *baa) |
| 2001 | { |
| 2002 | l_int32 n, i, x, y, w, h; |
| 2003 | BOX *box; |
| 2004 | BOXA *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 | /*! |
no test coverage detected