Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
LBuffer::StartResize
#include "ltwrappr.h"
virtual L_INT LBuffer::StartResize(nOldWidth, nOldHeight, nNewWidth, nNewHeight)
L_INT nOldWidth; |
/* original width of the image */ |
L_INT nOldHeight; |
/* original height of the image */ |
L_INT nNewWidth; |
/* new width for the image */ |
L_INT nNewHeight; |
/* new height for the image */ |
Sets up information for the LBuffer::Resize function.
Parameter |
Description |
nOldWidth |
The original width of the image. |
nOldHeight |
The original height of the image. |
nNewWidth |
The new width for the image. |
nNewHeight |
The new height for the image. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Win32, x64.
See Also
Functions: |
|
Topics: |
|
|
Example
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName L_INT LBuffer__StartResizeExample() { L_INT nRet; LBitmapBase LeadBitmap, TmpBitmap ; LBuffer LeadBuffer; L_INT nNewHeight; L_INT nOldHeight; L_INT nNewWidth; L_INT nOldWidth; L_INT i,n,nDestRow ; L_INT CopyWidth, CopyHeight; nRet =TmpBitmap.Load (MAKE_IMAGE_PATH(TEXT("image1.cmp"))) ; if(nRet !=SUCCESS) return nRet; nOldHeight = TmpBitmap.GetHeight () ; nOldWidth = TmpBitmap.GetWidth (); nNewHeight = nOldHeight * 2; nNewWidth = nOldWidth * 2; L_INT nBufferSize = max( TmpBitmap.GetBytesPerLine (), nNewWidth* 3); nRet =LeadBuffer.Reallocate (nBufferSize); if(nRet !=SUCCESS) return nRet; nRet =LeadBitmap.Create (nNewWidth, nNewHeight,24, TmpBitmap.GetColorOrder (), NULL, TYPE_CONV) ; if(nRet !=SUCCESS) return nRet; // Initialize the resize process nRet =LeadBuffer.StartResize(nOldWidth,nOldHeight,nNewWidth,nNewHeight); if(nRet !=SUCCESS) return nRet; // Initialize the destination row number nDestRow = 0; // Use Resize to process each row in the bitmap nRet =LeadBitmap.Access (); if(nRet !=SUCCESS) return nRet; nRet =TmpBitmap.Access (); if(nRet !=SUCCESS) return nRet; for(i=0; i < TmpBitmap.GetHeight (); i++) { nRet =(L_INT)TmpBitmap.GetRow (&LeadBuffer, i); if(nRet < 1) return nRet; nRet =LeadBuffer.Resize (i, TmpBitmap.GetBitsPerPixel (), &CopyWidth, &CopyHeight); if(nRet !=SUCCESS) return nRet; // Output as many or as few rows as Resize supplies for(n=0; n < CopyHeight; n++) { nRet =(L_INT)LeadBitmap.PutRow (LeadBuffer, nDestRow); if(nRet < 1) return nRet; nDestRow++; } } nRet =LeadBitmap.Release (); if(nRet !=SUCCESS) return nRet; nRet =TmpBitmap.Release(); if(nRet !=SUCCESS) return nRet; // End the resize process nRet =LeadBuffer.StopResize (); if(nRet !=SUCCESS) return nRet; return SUCCESS; }