src/fpix1.c
l_int32
fpixResizeImageData(FPIX  *fpixd,
                    FPIX  *fpixs)
{
l_int32     ws, hs, wd, hd, bytes;
l_float32  *data;

    PROCNAME("fpixResizeImageData");

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

    fpixGetDimensions(fpixs, &ws, &hs);
    fpixGetDimensions(fpixd, &wd, &hd);
    if (ws == wd && hs == hd)  /* nothing to do */
        return 0;

    fpixSetDimensions(fpixd, ws, hs);
    fpixSetWpl(fpixd, ws);
    bytes = 4 * ws * hs;
    data = fpixGetData(fpixd);
    if (data) FREE(data);
    if ((data = (l_float32 *)MALLOC(bytes)) == NULL)
        return ERROR_INT("MALLOC fail for data", procName, 1);
    fpixSetData(fpixd, data);
    return 0;
}
/*!
 *  fpixResizeImageData()
 *
 *      Input:  fpixd, fpixs
 *      Return: 0 if OK, 1 on error
 *
 *  Notes:
 *      (1) If the data sizes differ, this destroys the existing
 *          data in fpixd and allocates a new, uninitialized, data array
 *          of the same size as the data in fpixs.  Otherwise, this
 *          doesn't do anything.
 */
fpixResizeImageData()
Input:  fpixd, fpixs
Return: 0 if OK, 1 on error

(1) If the data sizes differ, this destroys the existing
data in fpixd and allocates a new, uninitialized, data array
of the same size as the data in fpixs.  Otherwise, this
doesn't do anything.
fpixResizeImageData () Input : fpixd fpixs Return : 0 if OK 1 on error ( 1 ) If the data sizes differ this destroys the existing data in fpixd and allocates a new uninitialized data array of the same size as the data in fpixs . Otherwise this doesn ' t do anything .
l_int32
fpixResizeImageData(FPIX  *fpixd,
                    FPIX  *fpixs)
{
l_int32     ws, hs, wd, hd, bytes;
l_float32  *data;
    PROCNAME("fpixResizeImageData");
    if (!fpixs)
        return ERROR_INT("fpixs not defined", procName, 1);
    if (!fpixd)
        return ERROR_INT("fpixd not defined", procName, 1);
    fpixGetDimensions(fpixs, &ws, &hs);
    fpixGetDimensions(fpixd, &wd, &hd);
    if (ws == wd && hs == hd)  
        return 0;
    fpixSetDimensions(fpixd, ws, hs);
    fpixSetWpl(fpixd, ws);
    bytes = 4 * ws * hs;
    data = fpixGetData(fpixd);
    if (data) FREE(data);
    if ((data = (l_float32 *)MALLOC(bytes)) == NULL)
        return ERROR_INT("MALLOC fail for data", procName, 1);
    fpixSetData(fpixd, data);
    return 0;
}
l_int32 fpixResizeImageData ( FPIX * fpixd , FPIX * fpixs ) { l_int32 ws , hs , wd , hd , bytes ; l_float32 * data ; PROCNAME ( " " ) ; if ( ! fpixs ) return ERROR_INT ( " " , procName , 1 ) ; if ( ! fpixd ) return ERROR_INT ( " " , procName , 1 ) ; fpixGetDimensions ( fpixs , & ws , & hs ) ; fpixGetDimensions ( fpixd , & wd , & hd ) ; if ( ws == wd && hs == hd ) return 0 ; fpixSetDimensions ( fpixd , ws , hs ) ; fpixSetWpl ( fpixd , ws ) ; bytes = 4 * ws * hs ; data = fpixGetData ( fpixd ) ; if ( data ) FREE ( data ) ; if ( ( data = ( l_float32 * ) MALLOC ( bytes ) ) == NULL ) return ERROR_INT ( " " , procName , 1 ) ; fpixSetData ( fpixd , data ) ; return 0 ; }
fpixResizeImageData()
      Input:  fpixd, fpixs
      Return: 0 if OK, 1 on error
fpixResizeImageData () Input : fpixd fpixs Return : 0 if OK 1 on error
/* nothing to do */