LBitmapBase::Trim

#include "ltwrappr.h"

virtual L_INT LBitmapBase::Trim(nCol, nRow, uWidth, uHeight)

virtual L_INT LBitmapBase::Trim(prcTrim)

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)

LPRECT prcTrim;

pointer to a RECT structure

Crops the class object's bitmap, resulting in a new bitmap that is the size of the specified rectangle. If a region is defined for the bitmap, the region is also cropped if necessary.

Parameter

Description

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

prcTrim

Pointer to a RECT structure that contains information about the rectangle to keep.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this function instead of LBitmapBase::CopyRect 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

LTDIS
LTFIL

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

Win32, x64.

See Also

Functions:

Class Members

Topics:

Raster Image Functions: Doing Geometric Transformations

Example

This is an example for LBitmapBase::Trim(nCol, nRow, uWidth, uHeight):

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT LBitmapBase__TrimExample() 
{ 
   L_INT nRet; 
   LBitmapBase MyBitmap; 
   MyBitmap.SetFileName(MAKE_IMAGE_PATH(TEXT("image1.cmp"))); 
   nRet =MyBitmap.Load(24); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =MyBitmap.Trim(10,15,100,200); 
   if(nRet !=SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help