LBuffer::StartResize

#include "ltwrappr.h"

virtual L_INT LBuffer::StartResize(nOldWidth, nOldHeight, nNewWidth, nNewHeight)

Sets up information for the LBuffer::Resize function.

Parameters

L_INT nOldWidth

The original width of the image.

L_INT nOldHeight

The original height of the image.

L_INT nNewWidth

The new width for the image.

L_INT nNewHeight

The new height for the image.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

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 Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.