src/pix1.c
l_int32
pixResizeImageData(PIX  *pixd,
                   PIX  *pixs)
{
l_int32    w, h, d, wpl, bytes;
l_uint32  *data;

    PROCNAME("pixResizeImageData");

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

    if (pixSizesEqual(pixs, pixd))  /* nothing to do */
        return 0;

    pixGetDimensions(pixs, &w, &h, &d);
    wpl = pixGetWpl(pixs);
    pixSetWidth(pixd, w);
    pixSetHeight(pixd, h);
    pixSetDepth(pixd, d);
    pixSetWpl(pixd, wpl);
    bytes = 4 * wpl * h;
    pixFreeData(pixd);  /* free any existing image data */
    if ((data = (l_uint32 *)pix_malloc(bytes)) == NULL)
        return ERROR_INT("pix_malloc fail for data", procName, 1);
    pixSetData(pixd, data);
    return 0;
}
/*!
 *  pixResizeImageData()
 *
 *      Input:  pixd (gets new uninitialized buffer for image data)
 *              pixs (determines the size of the buffer; not changed)
 *      Return: 0 if OK, 1 on error
 *
 *  Notes:
 *      (1) This removes any existing image data from pixd and
 *          allocates an uninitialized buffer that will hold the
 *          amount of image data that is in pixs.
 */
pixResizeImageData()
Input:  pixd (gets new uninitialized buffer for image data)
pixs (determines the size of the buffer; not changed)
Return: 0 if OK, 1 on error

(1) This removes any existing image data from pixd and
allocates an uninitialized buffer that will hold the
amount of image data that is in pixs.
pixResizeImageData () Input : pixd ( gets new uninitialized buffer for image data ) pixs ( determines the size of the buffer ; not changed ) Return : 0 if OK 1 on error ( 1 ) This removes any existing image data from pixd and allocates an uninitialized buffer that will hold the amount of image data that is in pixs .
l_int32
pixResizeImageData(PIX  *pixd,
                   PIX  *pixs)
{
l_int32    w, h, d, wpl, bytes;
l_uint32  *data;
    PROCNAME("pixResizeImageData");
    if (!pixs)
        return ERROR_INT("pixs not defined", procName, 1);
    if (!pixd)
        return ERROR_INT("pixd not defined", procName, 1);
    if (pixSizesEqual(pixs, pixd))  
        return 0;
    pixGetDimensions(pixs, &w, &h, &d);
    wpl = pixGetWpl(pixs);
    pixSetWidth(pixd, w);
    pixSetHeight(pixd, h);
    pixSetDepth(pixd, d);
    pixSetWpl(pixd, wpl);
    bytes = 4 * wpl * h;
    pixFreeData(pixd);  
    if ((data = (l_uint32 *)pix_malloc(bytes)) == NULL)
        return ERROR_INT("pix_malloc fail for data", procName, 1);
    pixSetData(pixd, data);
    return 0;
}
l_int32 pixResizeImageData ( PIX * pixd , PIX * pixs ) { l_int32 w , h , d , wpl , bytes ; l_uint32 * data ; PROCNAME ( " " ) ; if ( ! pixs ) return ERROR_INT ( " " , procName , 1 ) ; if ( ! pixd ) return ERROR_INT ( " " , procName , 1 ) ; if ( pixSizesEqual ( pixs , pixd ) ) return 0 ; pixGetDimensions ( pixs , & w , & h , & d ) ; wpl = pixGetWpl ( pixs ) ; pixSetWidth ( pixd , w ) ; pixSetHeight ( pixd , h ) ; pixSetDepth ( pixd , d ) ; pixSetWpl ( pixd , wpl ) ; bytes = 4 * wpl * h ; pixFreeData ( pixd ) ; if ( ( data = ( l_uint32 * ) pix_malloc ( bytes ) ) == NULL ) return ERROR_INT ( " " , procName , 1 ) ; pixSetData ( pixd , data ) ; return 0 ; }
pixResizeImageData()
      Input:  pixd (gets new uninitialized buffer for image data)
              pixs (determines the size of the buffer; not changed)
      Return: 0 if OK, 1 on error
pixResizeImageData () Input : pixd ( gets new uninitialized buffer for image data ) pixs ( determines the size of the buffer ; not changed ) Return : 0 if OK 1 on error
/* nothing to do */ /* free any existing image data */