L_StartResize

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_StartResize(nOldWidth, nOldHeight, nNewWidth, nNewHeight, ppResizeData)

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 */

L_VOID L_FAR * L_FAR * ppResizeData;

/* address of a pointer for resize data */

Sets up information for the L_Resize function.

Parameter

Description

nOldWidth

Specifies the original width of the image.

nOldHeight

Specifies the original height of the image.

nNewWidth

Specifies the new width for the image.

nNewHeight

Specifies the new height for the image.

ppResizeData

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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTKRN

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

Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.

See Also

Functions:

L_ResampleBitmap, L_ResizeBitmap, L_SizeBitmap, L_Resize, L_StopResize, L_DlgResize

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Resizing Considerations

Example

For complete sample code, refer to the RESIZE example.

/* This example resizes each line in one bitmap and writes it to another bitmap */
BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image */
void TestFunction(void)
{
   L_VOID L_FAR *pResizeData;
   L_INT CopyWidth, CopyHeight;
   L_UCHAR L_FAR *pBuf; /* Buffer to hold the input row */
   HGLOBAL hBuf; /* Handle to the input buffer */
   BITMAPHANDLE TmpBitmap; /* Bitmap containing input data */
   int DestRow; /* Row counter for the output */
   int i, n; /* Loop counters */
   /* Load the input bitmap, at 24 bits per pixel */
   L_LoadBitmap (TEXT("IMAGE3.CMP"), &TmpBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);
   /* Allocate the buffer the size of one line of 24-bit input data */
   hBuf = GlobalAlloc(GMEM_MOVEABLE, TmpBitmap.Width * 3);
   pBuf = (L_UCHAR L_FAR *)GlobalLock( hBuf );
   /* Create the new bitmap */
   L_CreateBitmap(&LeadBitmap, sizeof(BITMAPHANDLE), TYPE_CONV,
                  TmpBitmap.Width / 2,
                  TmpBitmap.Height / 2,
                  24,
                  TmpBitmap.Order,
                  NULL,
                  TmpBitmap.ViewPerspective, NULL, 0);
   /* Initialize the resize process */
   L_StartResize (TmpBitmap.Width, TmpBitmap.Height,
                  TmpBitmap.Width / 2, TmpBitmap.Height / 2,
                  &pResizeData);
   /* Initialize the destination row number */
   DestRow = 0;
   /* Use L_Resize to process each row in the bitmap */
   L_AccessBitmap(&LeadBitmap);
   L_AccessBitmap(&TmpBitmap);
   for(i=0; i < TmpBitmap.Height; i++)
   {
      L_GetBitmapRow(&TmpBitmap, pBuf, i, TmpBitmap.BytesPerLine);
      L_Resize (pBuf, i, TmpBitmap.BitsPerPixel,
                &CopyWidth, &CopyHeight, pResizeData);
      /* Output as many or as few rows as L_Resize supplies */
      for(n=0; n < CopyHeight; n++)
      {
         L_PutBitmapRow(&LeadBitmap, pBuf, DestRow, CopyWidth * 3);
         DestRow++;
      }
   }
   L_ReleaseBitmap(&TmpBitmap);
   L_ReleaseBitmap(&LeadBitmap);
   /* End the resize process */
   L_StopResize (pResizeData);
   /* Free memory that we no longer need */
   GlobalFree(hBuf);
   return;
}