Sets up information for the L_Resize function.
#include "l_bitmap.h"
L_LTKRN_API L_INT L_StartResize(nOldWidth, nOldHeight, nNewWidth, nNewHeight, ppResizeData)
Specifies the original width of the image.
Specifies the original height of the image.
Specifies the new width for the image.
Specifies the new height for the image.
Address of a pointer for a resize data packet. This specifies the area to be filled in with data for the L_Resize function. L_StartResize allocates the memory, and L_StopResize frees it. Note that you will pass the address of a pointer variable.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Win32, x64, Linux.
For complete sample code, refer to the RESIZE
example.
This example resizes each line in one bitmap and writes it to another bitmap.
L_INT StartResizeExample(pBITMAPHANDLE pLeadBitmap)
{
L_INT nRet;
L_VOID* pResizeData;
L_INT CopyWidth, CopyHeight;
L_UCHAR* pBuf; /* Buffer to hold the input row */
HGLOBAL hBuf; /* Handle to the input buffer */
BITMAPHANDLE TmpBitmap; /* Bitmap containing input data */
L_INT DestRow; /* Row counter for the output */
L_INT i, n; /* Loop counters */
/* Load the input bitmap, at 24 bits per pixel */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &TmpBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);
if(nRet != SUCCESS)
return nRet;
/* Allocate the buffer the size of one line of 24-bit input data */
hBuf = GlobalAlloc(GMEM_MOVEABLE, TmpBitmap.Width * 3);
pBuf = (L_UCHAR*)GlobalLock( hBuf );
/* Create the new bitmap */
if(pLeadBitmap->Flags.Allocated)
L_FreeBitmap(pLeadBitmap);
nRet = L_CreateBitmap(pLeadBitmap,
sizeof(BITMAPHANDLE),
TYPE_CONV,
TmpBitmap.Width / 2,
TmpBitmap.Height / 2,
24,
TmpBitmap.Order,
NULL,
TmpBitmap.ViewPerspective, NULL, 0);
if(nRet != SUCCESS)
return nRet;
/* Initialize the resize process */
nRet = L_StartResize (TmpBitmap.Width,
TmpBitmap.Height,
TmpBitmap.Width / 2,
TmpBitmap.Height / 2,
&pResizeData);
if(nRet != SUCCESS)
return nRet;
/* Initialize the destination row number */
DestRow = 0;
/* Use L_Resize to process each row in the bitmap */
L_AccessBitmap(pLeadBitmap);
L_AccessBitmap(&TmpBitmap);
for(i=0; i < TmpBitmap.Height; i++)
{
nRet = (L_INT)L_GetBitmapRow(&TmpBitmap, pBuf, i, TmpBitmap.BytesPerLine);
if(nRet < 1)
return nRet;
nRet = L_Resize (pBuf, i, TmpBitmap.BitsPerPixel, &CopyWidth, &CopyHeight, pResizeData);
if(nRet != SUCCESS)
{
if(nRet != 0)// 0 means line was not needed for the resize
return nRet;
}
/* Output as many or as few rows as nRet = L_Resize supplies */
for(n=0; n < CopyHeight; n++)
{
nRet =(L_INT )L_PutBitmapRow(pLeadBitmap, pBuf, DestRow, CopyWidth * 3);
if(nRet < 1)
return nRet;
DestRow++;
}
}
L_ReleaseBitmap(&TmpBitmap);
L_ReleaseBitmap(pLeadBitmap);
L_FreeBitmap(&TmpBitmap);
/* End the resize process */
nRet = L_StopResize (pResizeData);
if(nRet != SUCCESS)
return nRet;
/* Free memory that we no longer need */
GlobalFree(hBuf);
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.