L_ChangeBitmapViewPerspective

#include "l_bitmap.h"

L_LTKRN_API L_INT L_ChangeBitmapViewPerspective(pDstBitmap, pSrcBitmap, uStructSize, ViewPerspective)

Rotates and flips the bitmap data as necessary to achieve the desired view perspective.

Parameters

pBITMAPHANDLE pDstBitmap

Pointer to the bitmap handle referencing the converted bitmap data. Pass NULL to convert the source bitmap in place.

pBITMAPHANDLE pSrcBitmap

Pointer to the bitmap handle referencing the bitmap to convert.

L_UINT uStructSize

Size in bytes, of the structure pointed to by pDstBitmap, for versioning. Use sizeof(BITMAPHANDLE).

L_INT ViewPerspective

Desired view perspective. The following are possible values:

Constant Meaning
TOP_LEFT [0] Top-left of image is first in memory.
BOTTOM_LEFT180 [1] (Document and Medical Imaging toolkits) Same as TOP_RIGHT, which is BOTTOM_LEFT rotated clockwise by 180 degrees.
BOTTOM_LEFT [2] Bottom-left of image is first in memory.
TOP_LEFT180 [3] (Document and Medical Imaging toolkits) Same as BOTTOM_RIGHT, which is TOP_LEFT rotated clockwise by 180 degrees.
RIGHT_TOP [4] (Document and Medical Imaging toolkits) First row is the right side, first column is top side.
TOP_LEFT90 [4] (Document and Medical Imaging toolkits) Same as RIGHT_TOP, which is TOP_LEFT rotated clockwise by 90 degrees.
LEFT_TOP [5] (Document and Medical Imaging toolkits) First row is the left side, first column is the top side
BOTTOM_LEFT90 [5] (Document and Medical Imaging toolkits) Same as LEFT_TOP, which is BOTTOM_LEFT rotated clockwise by 90 degrees
RIGHT_BOTTOM [7] (Document and Medical Imaging toolkits) First row is the right side, first column is the bottom side
BOTTOM_LEFT270 [7] (Document and Medical Imaging toolkits) Same as RIGHT_BOTTOM, which is BOTTOM_LEFT rotated clockwise by 270 degrees
LEFT_BOTTOM [8] (Document and Medical Imaging toolkits) First row is the left side, first column is top side.
TOP_LEFT270 [8] (Document and Medical Imaging toolkits) Same as LEFT_BOTTOM, which is TOP_LEFT rotated clockwise by 270 degrees.

Returns

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

Comments

Use this function to change the data and the ViewPerspective field in the bitmap handle. The ViewPerspective field in the bitmap handle is changed, and thus, the display is unchanged. This function does not affect the image display. This can be used to simplify calculations that involve bitmap coordinates. For general information about view perspectives, refer to Accounting for View Perspective.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT ChangeBitmapViewPerspectiveExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap; 
 
   nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   if ( LeadBitmap.ViewPerspective != TOP_LEFT) 
   { 
      nRet = L_ChangeBitmapViewPerspective ( NULL, &LeadBitmap, sizeof(BITMAPHANDLE), TOP_LEFT ); 
      if(nRet != SUCCESS) 
         return nRet; 
   } 
 
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   L_FreeBitmap(&LeadBitmap); 
 
   return nRet; 
} 
Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help