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.

See Also

Functions:

Class Members

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Resizing Considerations

Example

L_VOID TestResize()
{
   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;

   TmpBitmap.Load (TEXT("image1.cmp")) ;

   nOldHeight = TmpBitmap.GetHeight () ;
   nOldWidth  = TmpBitmap.GetWidth ();
   nNewHeight = nOldHeight * 2;
   nNewWidth  = nOldWidth  * 2;

   L_INT nBufferSize = max( TmpBitmap.GetBytesPerLine (), nNewWidth* 3);
   LeadBuffer.Reallocate (nBufferSize);

   LeadBitmap.Create (nNewWidth, nNewHeight,24, TmpBitmap.GetColorOrder (), NULL, TYPE_CONV) ;

   // Initialize the resize process

   LeadBuffer.StartResize(nOldWidth,nOldHeight,nNewWidth,nNewHeight);


   // Initialize the destination row number
   nDestRow = 0;

   // Use Resize to process each row in the bitmap
   LeadBitmap.Access ();
   TmpBitmap.Access ();

   for(i=0; i < TmpBitmap.GetHeight (); i++)
   {

      TmpBitmap.GetRow (&LeadBuffer, i);

      LeadBuffer.Resize (i, TmpBitmap.GetBitsPerPixel (), &CopyWidth, &CopyHeight);

      // Output as many or as few rows as Resize supplies
      for(n=0; n < CopyHeight; n++)
      {
         LeadBitmap.PutRow (LeadBuffer, nDestRow);
         nDestRow++;
      }
   }

   LeadBitmap.Release ();
   TmpBitmap.Release();

   // End the resize process
   LeadBuffer.StopResize ();
}