L_Resize

#include "l_bitmap.h"

L_LTKRN_API L_INT L_Resize(pBuffer, nRow, nBitsPerPixel, pXSize, pYSize, pResizeData)

Resizes a buffer to the new size specified with the L_StartResize function.

Parameters

L_UCHAR * pBuffer

Pointer to the buffer containing a line from the original image to be resized. Your code must allocate the buffer and copy the data into it before calling this function.

The same buffer holds the data before and after it is resized. Therefore, the buffer must be big enough to hold whichever is larger. (The original line is larger when reducing an image; the resulting line is larger when enlarging the image.)

L_INT nRow

Current row of the original bitmap.

L_INT nBitsPerPixel

Bits per pixel, which is the same for the original and the resized bitmap.

L_INT* pXSize

Address of an integer variable to be updated with the width of the resized line. This function updates the variable with number of pixels the new line was sized to.

L_INT* pYSize

Address of an integer variable to be updated with the required number of copy repetitions. This function updates the variable with the number of times needed to copy the new resized line buffer to the new image.

When an image is being enlarged, some lines must be copied more than once. When an image is being reduced, some lines must be eliminated (not copied at all). For example:

A value of 0 means that the line should not be copied. A value of 1 means that the line should be copied once. A value of 2 means that the line should be copied twice.

L_VOID* pResizeData

Pointer to the data packet used in L_StartResize. If L_Resize is called from within a callback procedure, then it is recommended that you pass pResizeData as part of your user data parameter in the callback procedure. This is required to prevent the loss of the address of pResizeData if the segment is changed in a 16-bit operating system.

Returns

Value Meaning
>= 0 The value of the pYSize parameter, indicating the number of times the line was copied.
< 0 An error occurred. Refer to Return Codes.

Comments

Before calling this function, you must do the following:

  1. Call the L_StartResize function.
  2. Declare and allocate a buffer pBuffer to hold each line. The same buffer holds the data before and after it is resized. Therefore, the buffer must be big enough to hold whichever is larger. (The original line is larger when reducing an image; the resulting line is larger when enlarging the image.)
  3. Declare two integer variables pXSize and pYSize, which this function will update with information about the compressed line of data.

When all lines have been processed, you must call L_StopResize.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

For an example, refer to L_StartResize.
For complete sample code, refer to the RESIZE
example.

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

LEADTOOLS Raster Imaging C API Help

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