LBitmap::Perspective

#include "ltwrappr.h"

L_INT LBitmap::Perspective(pPoints, crBkgColor, uFlags)

Gives a bitmap a 3-D effect, as if it exists on a flat plane and has been skewed into a different shape.

Parameters

POINT * pPoints

Pointer to an array of points that determine the new locations of image corners. It should contain four points; points at indices 0, 1, 2 and 3 determine the new locations of left-top, right-top, left-bottom and right-bottom image corners respectively.

COLORREF crBkgColor

Background color.

L_UINT uFlags

Flag that indicates how to create the background. Possible values are:

Value Meaning
PERSPECTIVE_IMAGE [0x0001] Use the same image as the background.
PERSPECTIVE_COLOR [0x0002] Fill the back ground with crBkgColor.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

The new locations for the image corners should keep the relative relation between corners. For example, the point at index 1 should be to the right of point at index 0 and above the point at index 3. Also, the point at index 2 should be to the left of the point at index 3 and below the point at index 0 and so on. All new locations should remain inside the image.

To update a status bar or detect a user interrupt during execution of this function, refer to LBase::EnableStatusCallback.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

If the bitmap has a region, this function works only on the region. If the bitmap does not have a region, this function works on the entire bitmap.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmap__PerspectiveExample(LBitmapWindow m_LBitmapWnd) 
{ 
   L_INT nRet; 
   POINT pNewLocations [4]; 
 
   pNewLocations [0].x=m_LBitmapWnd.GetWidth()*3/9; 
   pNewLocations [0].y=m_LBitmapWnd.GetHeight()*1/12; 
   pNewLocations [1].x=m_LBitmapWnd.GetWidth()*3/4; 
   pNewLocations [1].y=m_LBitmapWnd.GetHeight()*2/12; 
   pNewLocations [2].x=m_LBitmapWnd.GetWidth()*2/10; 
   pNewLocations [2].y=m_LBitmapWnd.GetHeight()*8/10; 
   pNewLocations [3].x=m_LBitmapWnd.GetWidth()*10/11; 
   pNewLocations [3].y=m_LBitmapWnd.GetHeight()*7/10; 
 
   LBitmap LeadBitmap; 
 
   nRet =LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet =LeadBitmap.Perspective(pNewLocations,RGB(255,255,255), PERSPECTIVE_IMAGE); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 21.0.2020.8.25
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help