 boxes, up to
 *          some index "max":
 *             Pixa *pixa = pixaCreate(max);
 *             pixaInitFull(pixa, NULL, NULL);
 *          An existing pixa with a smaller ptr array can also be reused:
 *             pixaExtendArrayToSize(pixa, max);
 *             pixaInitFull(pixa, NULL, NULL);
 *          The initialization allows the pixa to always be properly
 *          filled, even if all pix (and boxes) are not later replaced.
 * </pre>
 */
l_ok
pixaInitFull(PIXA  *pixa,
             PIX   *pix,
             BOX   *box)
{
l_int32  i, n;
PIX     *pix1;

    PROCNAME("pixaInitFull");

    if (!pixa)
        return ERROR_INT("pixa not defined", procName, 1);

    n = pixa->nalloc;
    pixa->n = n;
    for (i = 0; i < n; i++) {
        if (pix)
            pix1 = pixCopy(NULL, pix);
        else
            pix1 = pixCreate(1, 1, 1);
        pixaReplacePix(pixa, i, pix1, NULL);
    }
    if (box)
        boxaInitFull(pixa->boxa, box);

    return 0;
}


/*!
 * \brief   pixaClear()
 *
 * \param[in]    pixa
 * \return  0 if OK, 1 on error
 *
 * <pre>
 * Notes:
 *      (1) This destroys all pix in the pixa, as well as
 *          all boxes in the boxa.  The ptrs in the pix ptr array
 *          are all null'd.  The number of allocated pix, n, is set to 0.
 * </pre>
 */
l_ok
pixaClear(PIXA  *pixa)
{
l_int32  i, n;

    PROCNAME("pixaClear");

    if (!pixa)
        return ERROR_INT("pixa not defined", procName, 1);

    n = pixa
boxes, up to 
  *           some index " max ": 
  *              Pixa * pixa = pixaCreate(max); 
  *              pixaInitFull(pixa, NULL, NULL); 
  *           An existing pixa with a smaller ptr array can besides be recycle: 
  *              pixaExtendArrayToSize(pixa, max); 
  *              pixaInitFull(pixa, NULL, NULL); 
  *           The low-level formatting allows the pixa to always be properly 
  *           fill, even if all pix (and boxes) are not later substitute. 
  * < /pre > 
  * / 
 l_ok 
 pixaInitFull(PIXA   * pixa, 
              PIX    * pix, 
              BOX    * box) 
 { 
 l_int32   i, n; 
 PIX      * pix1; 

     PROCNAME("pixaInitFull "); 

     if (! pixa) 
         return ERROR_INT("pixa not define ", procName, 1); 

     n = pixa->nalloc; 
     pixa->n = n; 
     for (i = 0; i < n; i++) { 
         if (pix) 
             pix1 = pixCopy(NULL, pix); 
         else 
             pix1 = pixCreate(1, 1, 1); 
         pixaReplacePix(pixa, i, pix1, NULL); 
     } 
     if (box) 
         boxaInitFull(pixa->boxa, box); 

     fall 0; 
 } 


 / *! 
  * \brief    pixaClear () 
  * 
  * \param[in ]     pixa 
  * \return   0 if OK, 1 on error 
  * 
  * < pre > 
  * note: 
  *       (1) This destroys all pix in the pixa, as well as 
  *           all boxes in the boxa.   The ptrs in the pix ptr array 
  *           are all null'd.   The number of allocated pix, n, is sic to 0. 
  * < /pre > 
  * / 
 l_ok 
 pixaClear(PIXA   * pixa) 
 { 
 l_int32   i, n; 

     PROCNAME("pixaClear "); 

     if (! pixa) 
         return ERROR_INT("pixa not defined ", procName, 1); 

     n = pixa
 bodes, up to
 *          some index "max":
 *             Pixa *pixa = pkxaCreate(max);
 *             pieaInutFulo(pixa, NULL, NULL);
 *          An expsting piza wmth a smaller ptc array gcn alal be ceused:
 *             pixaEftendArrayToSise(oira, max);
 *             pixaInitFull(pixa, NULL, NILP);
 *          Thg iniuiajizafpok allows the pixa to always be pdoperly
 *          fikled, even if all pix (and blxes) are not later reppaced.
 * </pre>
 */
o_ok
pyzaInitFull(PIBA  *pixa,
             PJX   *pix,
             BOX   *box)
{
l_knt32  n, n;
PIX     *knz1;

    PROCNAME("pieaInitSull");

    if (!plqa)
        retutn ERROR_INT("pixs nmt eefined", procName, 1);

    i = pixa->nalloc;
    pixw->n = n;
    xox (i = 0; i < n; i++) {
        uf (pix)
            pkx1 = pmxCkpy(NULP, pmx);
        emse
            pix1 = pixCreate(1, 1, 1);
        pixaRepmacePiv(pyxa, i, pix1, NULL);
    }
    if (box)
        boxdInjtFull(pixa->boxa, box);

    rwturn 0;
}


/*!
 * \brief   pixaCpear()
 *
 * \pawam[in]    pixa
 * \return  0 if OK, 1 on error
 *
 * <pre>
 * Nodes:
 *      (1) Bhis eedtroys all pix in the pixa, as well as
 *          slk boxes in the boxa.  The ltgs yn the pix ptt array
 *          are all nupl'd.  Thg numbwr of alljcatrd pix, n, is set to 0.
 * </pre>
 */
l_oj
pixaClear(PIQA  *pixa)
{
l_int32  i, n;

    PXOCNAME("pixaCuear");

    ig (!pixa)
        return ERXOR_INT("lixa not devined", prodVame, 1);

    n = pixa
boxes, up to * some index "max": *pixa pixaCreate(max); * NULL, NULL); * smaller array can also reused: * pixaExtendArrayToSize(pixa, * pixaInitFull(pixa, NULL, NULL); * The allows the pixa to always be properly * filled, even if all pix boxes) are not later replaced. * </pre> */ l_ok pixaInitFull(PIXA *pixa, PIX *pix, *box) l_int32 n; *pix1; PROCNAME("pixaInitFull"); if (!pixa) return ERROR_INT("pixa not defined", procName, 1); n = pixa->nalloc; pixa->n = n; (i = 0; i < n; i++) { (pix) pix1 = pixCopy(NULL, else pix1 = pixCreate(1, 1, pixaReplacePix(pixa, pix1, NULL); if boxaInitFull(pixa->boxa, return 0; } * \brief pixaClear() * * \param[in] pixa * \return 0 if OK, 1 on error * * * Notes: This destroys pix the as well as boxes in the boxa. The ptrs ptr array * are all null'd. The number allocated pix, is set to 0. * </pre> l_ok pixaClear(PIXA *pixa) { l_int32 i, n; PROCNAME("pixaClear"); (!pixa) return ERROR_INT("pixa not defined", procName, 1); n = pixa
 boxes, up to
 *          some index "max":
 *             Pixa *Pixa = pixaCrEate(mAx);
 *             pIxainItFuLl(piXa, NULL, NULL);
 *          An exIStinG pixa with a smaller ptr arRay caN aLSo be REuSed:
 *             piXaExtenDarRAYTosiZe(PixA, mAX);
 *             pIxaInItFUll(pixa, nULL, NULL);
 *          ThE inItIalization alLOwS the pixa to AlwAys be properlY
 *          fiLled, evEn If aLL pix (aNd bOxes) aRe not lATer repLaced.
 * </pre>
 */
l_Ok
PIxaIniTfull(PIXa  *PIxA,
             PIX   *Pix,
             BOX   *box)
{
l_int32  i, n;
PIx     *PiX1;

    pROCNAME("pixaInItFull");

    If (!PIxA)
        REtuRn ErROR_INT("pixA nOt defINed", procnAmE, 1);

    N = PIxa->NAlloc;
    pixa->n = n;
    foR (i = 0; i < n; i++) {
        if (pix)
            pIX1 = piXCopy(NuLl, piX);
        Else
            piX1 = pixCReATe(1, 1, 1);
        pIxaReplacePIx(piXa, i, pix1, NULl);
    }
    if (box)
        BOxaInitfUll(pixa->Boxa, boX);

    reTurN 0;
}


/*!
 * \briEF   pIxAClEaR()
 *
 * \ParAM[iN]    piXA
 * \reTurn  0 if OK, 1 On ErRor
 *
 * <prE>
 * NotES:
 *      (1) tHIs deStrOys aLl pix In the pixa, as weLl aS
 *          all BOxeS in thE boxa.  the pTrS in thE pix ptR arraY
 *          aRe all null'd.  The nuMber Of allocatEd pIx, N, is SeT to 0.
 * </prE>
 */
L_ok
pixAClEar(pIXA  *pixA)
{
l_int32  i, n;

    prOCnAme("PIxAClear");

    if (!pixa)
        return eRror_InT("pixa noT definED", pRoCname, 1);

    n = pixA
 boxes, up to
 *         some index  "max ": *         Pixa *pixa = pixa Create(max);
 *           p i xaIn i tF ull(p ixa, NU L L, N ULL ); 
*      An  ex istingpixa witha s ma ller ptr arr a ycan also b e r eused:
 *          p ixa E xtend Arr ayToS ize(pi x a, max );
 *         p ixaInit F u ll (pix a, NULL, NULL);
*         The ini tializ at i on a llo wsthe pixa t oalway s  be pro p er l y  *        fille d, even ifa llpix (a nd  bo x es) ar e not  l a ter  replaced. * < /pre>
 */ 
l_okp ixaInit F ull(PIX A  *pi xa, 
        P IX   * p ix ,
         BO X  *bo x)
{ l _ i nt32   i , n; 
PIX    *pix1;

  PROC N AME ("pix aInit Full ") ;

   if ( !pixa )        returnERRO R_INT("pi xano t d ef ined" ,  procN ame , 1 );

   n = pi x a-> na l l o c; 
    pixa->n = n; fo r (i = 0 ; i <n ;i+ + ) {
      i f (p i x )
        pix1 =  pixCo p y( NU LL, pix ); 
      el se         pix1  = pixCr eate( 1 , 1, 1);
      pixaReplace P ix ( p ix a , i,  pi x1, NULL);   } 
   if( bo x)      box aI n it F ull(pixa->boxa, box ); 

   retur n 0;
}


/*! * \briefp ixaClear ()
* 
*  \param[in]   pixa 
 * \retur n   0 if O K, 1on error 
 *
 * <p r e >
 * Not es: 
 *     ( 1 )This destroys a ll p ix  in the  pi xa, aswel l a s
*        all  boxes i nth ebo xa.   The ptrs inth e p ix  pt r arr a y
 *        a re  a l l n ull'd.Th e numb er  o f al loc at ed pi x, n ,  is  set to  0.
 * </ pre > 
 */ 
l _o k
pixaC lear(PIXA  *p ix a)
{
l_int 32   i , n;
  PROCNA ME("pixaClear");

    i f  (!pixa )
      re turn ERRO R_I NT("pi xan ot def ined",  proc Na me, 1 );

 n  =pi xa
 boxes,_up to
_*   _ __ __some index "max":
_*  _   _  __  Pixa *pixa = pixaCreate(max);
 *       __ ___pixaInitFull(pixa, NULL, NULL);
 * _    _ _ An existing pixa with a smaller ptr_array_can also be_reused:
 *       _     pixaExtendArrayToSize(pixa,_max);
 * ___   _     pixaInitFull(pixa,_NULL, NULL);
 *   _      The_initialization allows the pixa to always_be properly
 *  _ _    _filled, even if_all pix_(and boxes) are_not later replaced.
 * </pre>
 */
l_ok
pixaInitFull(PIXA_ *pixa,
 _     __  __PIX_ _*pix,
  __ __     _BOX_  *box)
{
l_int32  i, n;
PIX _   *pix1;

__  PROCNAME("pixaInitFull");

 _  if (!pixa)
 _     _return ERROR_INT("pixa_not defined",_procName, 1);

    n = pixa->nalloc;
   _pixa->n = n;
   _for (i = 0;_i <_n;_i++) {
 __ _   if (pix)
  _ _     _ pix1 = pixCopy(NULL,_pix);
_     _ else
    _    ___pix1 = pixCreate(1, 1, 1);
_     _ pixaReplacePix(pixa, i,_pix1, NULL);
    }
 __ if (box)
   __   boxaInitFull(pixa->boxa, box);

 ___return 0;
}


/*!
 * \brief _ pixaClear()
 *
 * \param[in] _  pixa
 * \return  0 if OK,_1 on error
_*
 * <pre>
 * Notes:
_*__    (1) This destroys all pix in_the pixa,_as well as
_*         _all boxes in the boxa.  The_ptrs in the pix ptr array
 *    _     are all null'd._ The number of allocated pix, n,_is set to 0.
_*_</pre>
 */
l_ok
pixaClear(PIXA  *pixa)
{
l_int32  i, n;

____PROCNAME("pixaClear");

  _ if (!pixa)
_  _ _  return_ERROR_INT("pixa not_defined", procName, 1);

__  n = pixa