virtual L_INT LBuffer::StartResize(nOldWidth, nOldHeight, nNewWidth, nNewHeight)
Sets up information for the LBuffer::Resize function.
The original width of the image.
The original height of the image.
The new width for the image.
The new height for the image.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Win32, x64.
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 < 1)
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;
}
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