L_ChangeBitmapViewPerspective

#include "l_bitmap.h"

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

pBITMAPHANDLE pDstBitmap;

/* pointer to the destination bitmap handle */

pBITMAPHANDLE pSrcBitmap;

/* pointer to the source bitmap handle */

L_UINT uStructSize;

/* size in bytes, of the structure pointed to by pDstBitmap */

L_INT ViewPerspective;

/* desired view perspective */

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

Parameter

Description

pDstBitmap

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

pSrcBitmap

Pointer to the bitmap handle referencing the bitmap to convert.

uStructSize

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

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

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

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 2000 / XP/Vista, Windows CE.

See Also

Functions:

L_PointFromBitmap, L_PointToBitmap,

 

L_RectFromBitmap, L_RectToBitmap,

 

L_RotateBitmapViewPerspective

Topics:

Accounting for View Perspective

Example

L_INT ChangeBitmapViewPerspectiveExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap;

   nRet = L_LoadBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\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(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Result.BMP"), &LeadBitmap, FILE_BMP, 24, 0, NULL);
   if(nRet != SUCCESS)
      return nRet;

   L_FreeBitmap(&LeadBitmap);

   return nRet;
}