src/fpix1.c
FPIXA *
fpixaCopy(FPIXA   *fpixa,
          l_int32  copyflag)
{
l_int32  i;
FPIX    *fpixc;
FPIXA   *fpixac;

    PROCNAME("fpixaCopy");

    if (!fpixa)
        return (FPIXA *)ERROR_PTR("fpixa not defined", procName, NULL);

    if (copyflag == L_CLONE) {
        fpixaChangeRefcount(fpixa, 1);
        return fpixa;
    }

    if (copyflag != L_COPY && copyflag != L_COPY_CLONE)
        return (FPIXA *)ERROR_PTR("invalid copyflag", procName, NULL);

    if ((fpixac = fpixaCreate(fpixa->n)) == NULL)
        return (FPIXA *)ERROR_PTR("fpixac not made", procName, NULL);
    for (i = 0; i < fpixa->n; i++) {
        if (copyflag == L_COPY)
            fpixc = fpixaGetFPix(fpixa, i, L_COPY);
        else  /* copy-clone */
            fpixc = fpixaGetFPix(fpixa, i, L_CLONE);
        fpixaAddFPix(fpixac, fpixc, L_INSERT);
    }

    return fpixac;
}
/*!
 *  fpixaCopy()
 *
 *      Input:  fpixas
 *              copyflag:
 *                L_COPY makes a new fpixa and copies each fpix
 *                L_CLONE gives a new ref-counted handle to the input fpixa
 *                L_COPY_CLONE makes a new fpixa with clones of all fpix
 *      Return: new fpixa, or null on error
 */
fpixaCopy()
Input:  fpixas
copyflag:
L_COPY makes a new fpixa and copies each fpix
L_CLONE gives a new ref-counted handle to the input fpixa
L_COPY_CLONE makes a new fpixa with clones of all fpix
Return: new fpixa, or null on error
fpixaCopy () Input : fpixas copyflag : L_COPY makes a new fpixa and copies each fpix L_CLONE gives a new ref - counted handle to the input fpixa L_COPY_CLONE makes a new fpixa with clones of all fpix Return : new fpixa or null on error
FPIXA *
fpixaCopy(FPIXA   *fpixa,
          l_int32  copyflag)
{
l_int32  i;
FPIX    *fpixc;
FPIXA   *fpixac;
    PROCNAME("fpixaCopy");
    if (!fpixa)
        return (FPIXA *)ERROR_PTR("fpixa not defined", procName, NULL);
    if (copyflag == L_CLONE) {
        fpixaChangeRefcount(fpixa, 1);
        return fpixa;
    }
    if (copyflag != L_COPY && copyflag != L_COPY_CLONE)
        return (FPIXA *)ERROR_PTR("invalid copyflag", procName, NULL);
    if ((fpixac = fpixaCreate(fpixa->n)) == NULL)
        return (FPIXA *)ERROR_PTR("fpixac not made", procName, NULL);
    for (i = 0; i < fpixa->n; i++) {
        if (copyflag == L_COPY)
            fpixc = fpixaGetFPix(fpixa, i, L_COPY);
        else  
            fpixc = fpixaGetFPix(fpixa, i, L_CLONE);
        fpixaAddFPix(fpixac, fpixc, L_INSERT);
    }
    return fpixac;
}
FPIXA * fpixaCopy ( FPIXA * fpixa , l_int32 copyflag ) { l_int32 i ; FPIX * fpixc ; FPIXA * fpixac ; PROCNAME ( " " ) ; if ( ! fpixa ) return ( FPIXA * ) ERROR_PTR ( " " , procName , NULL ) ; if ( copyflag == L_CLONE ) { fpixaChangeRefcount ( fpixa , 1 ) ; return fpixa ; } if ( copyflag != L_COPY && copyflag != L_COPY_CLONE ) return ( FPIXA * ) ERROR_PTR ( " " , procName , NULL ) ; if ( ( fpixac = fpixaCreate ( fpixa -> n ) ) == NULL ) return ( FPIXA * ) ERROR_PTR ( " " , procName , NULL ) ; for ( i = 0 ; i < fpixa -> n ; i ++ ) { if ( copyflag == L_COPY ) fpixc = fpixaGetFPix ( fpixa , i , L_COPY ) ; else fpixc = fpixaGetFPix ( fpixa , i , L_CLONE ) ; fpixaAddFPix ( fpixac , fpixc , L_INSERT ) ; } return fpixac ; }
fpixaCopy()
      Input:  fpixas
              copyflag:
                L_COPY makes a new fpixa and copies each fpix
                L_CLONE gives a new ref-counted handle to the input fpixa
                L_COPY_CLONE makes a new fpixa with clones of all fpix
      Return: new fpixa, or null on error
fpixaCopy () Input : fpixas copyflag : L_COPY makes a new fpixa and copies each fpix L_CLONE gives a new ref - counted handle to the input fpixa L_COPY_CLONE makes a new fpixa with clones of all fpix Return : new fpixa or null on error
/* copy-clone */