L_TrimBitmap
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_TrimBitmap(pBitmap, nCol, nRow, uWidth, uHeight)
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
L_INT nCol; |
/* x coordinate origin of the rectangle to keep */ |
L_INT nRow; |
/* y coordinate origin of the rectangle to copy */ |
L_UINT uWidth; |
/* width of the rectangle to keep (in pixels) */ |
L_UINT uHeight; |
/* height of the rectangle to keep (in pixels) */ |
Trims the bitmap, resulting in a bitmap that is the size of the specified rectangle. If a region is defined for the bitmap, the region is also trimmed if necessary.
Parameter |
Description |
pBitmap |
Pointer to the bitmap handle referencing the bitmap to trim. |
nCol |
The X coordinate of the pixel within the bitmap that is the origin of the rectangle to keep. |
nRow |
The Y coordinate of the pixel within the bitmap that is the origin of the rectangle to keep. |
uWidth |
Width of the rectangle to keep (in pixels). |
uHeight |
Height of the rectangle to keep (in pixels). |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Use this function instead of L_CopyBitmapRect when the original bitmap is not needed after the trim.
This function uses bitmap coordinates to specify the area to be copied. Therefore, you must account for the view perspective of the bitmap. For information about bitmap coordinates, refer to Accounting for View Perspective.
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: |
|
Topics: |
Example
/* This example trims 10 pixels off of each side of the image */
BITMAPHANDLE LeadBitmap; /* Bitmap handle that holds the bitmap */
L_INT nCol, nRow;
L_UINT uWidth, uHeight;
L_LoadBitmap (TEXT("IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
nCol = 10;
nRow = 10;
uWidth = LeadBitmap.Width - nCol - 10;
uHeight = LeadBitmap.Height - nRow - 10;
L_TrimBitmap ( &LeadBitmap, nCol, nRow, uWidth, uHeight );