L_Resize

#include "l_bitmap.h"

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

L_UCHAR * pBuffer;

/* pointer to the buffer with a line to be resized */

L_INT nRow;

/* current row of the original bitmap */

L_INT nBitsPerPixel;

/* bits per pixel of both bitmaps */

L_INT* pXSize;

/* address of a variable for the resized width */

L_INT* pYSize;

/* address of a variable for the required repetitions */

L_VOID* pResizeData;

/* pointer to the data packet */

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

Parameter

Description

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.)

nRow

Current row of the original bitmap.

nBitsPerPixel

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

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.

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:

 

image\sqrblit.gif A value of 0 means that the line should not be copied.

 

image\sqrblit.gif A value of 1 means that the line should be copied once.

 

image\sqrblit.gif A value of 2 means that the line should be copied twice.

 

image\sqrblit.gif And so on ....

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

>= 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

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 2000 / XP/Vista, Windows CE.

See Also

Functions:

L_ResizeBitmap, L_SizeBitmap, L_StartResize, L_StopResize, L_DlgResize, L_SizeBitmapInterpolate

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Resizing Considerations

Example

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