L_TrimBitmap

Summary

Crops 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 cropped if necessary.

Syntax

#include "l_bitmap.h"

L_LTKRN_API L_INT L_TrimBitmap(pBitmap, nCol, nRow, uWidth, uHeight)

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap to trim.

L_INT nCol

The X coordinate of the pixel within the bitmap that is the origin of the rectangle to keep.

L_INT nRow

The Y coordinate of the pixel within the bitmap that is the origin of the rectangle to keep.

L_UINT uWidth

Width of the rectangle to keep (in pixels).

L_UINT uHeight

Height of the rectangle to keep (in pixels).

Returns

Value Meaning
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 cropping.

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

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT TrimBitmapExample(pBITMAPHANDLE pBitmap) 
{ 
   L_INT nRet; 
   L_INT nCol    = 10; 
   L_INT nRow    = 10; 
   L_UINT nWidth  = pBitmap->Width - nCol - 10; 
   L_UINT nHeight = pBitmap->Height - nRow - 10; 
 
   nRet = L_TrimBitmap (pBitmap, nCol, nRow, nWidth, nHeight); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 22.0.2023.7.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help

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