L_HighQualityRotateBitmap

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT EXT_FUNCTION L_HighQualityRotateBitmap(pBitmap, nAngle, uFlags, crFill)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_INT nAngle;

/* rotation degrees */

L_UINT uFlags;

/* rotation behavior */

L_COLORREF crFill;

/* background fill color */

Rotates 1-bit (bitonal) images with high quality.

Parameter

Description

pBitmap

Pointer to the bitmap handle that references the bitmap to rotate.

nAngle

Hundredths of degrees to rotate (+/-). This can be a number from 0 to 36,000. Positive values rotate the image in a clockwise direction, while negative values rotate the image in a counter-clockwise direction.

uFlags

Flag that specifies whether to keep the resulting image the same size as the original image or to resize according to the rotation direction specified. Possible values are:

 

Value

Meaning

 

ROTATE_RESIZE

[0x0001] Size the resulting image.

 

HIGHQUALITYROTATE_HIGH

[0x0000] Rotate the image with high quality.(this is faster than best quality)

 

HIGHQUALITYROTATE_BEST

[0x0010] Rotate the image the image with the best quality.

 

0

Do not resize the image. Crop it.

crFill

A COLORREF value representing the color of the backgrounds. You can specify the value, such as the return value of the Windows RGB macro, or use the PALETTEINDEX macro to specify a palette color.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function has the following features:

If ROTATE_RESIZE is set, then the image is resized. Otherwise, the image is cropped.

To update a status bar or detect a user interrupt during execution of this function, refer to the L_SetStatusCallback function.

Required DLLs and Libraries

LTIMGCOR

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_RotateBitmap, L_DeskewBitmap

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Raster Image Functions: Functions That Transform the Region and the Bitmap

 

Raster Image Functions: Processing an Image

 

Cleaning Up 1-Bit Images

 

Resizing Considerations

 

Detecting Registration Marks

 

Using Color Values in LEADTOOLS

Example

//#if defined (LEADTOOLS_V16_OR_LATER)
L_INT HighQualityRotateBitmapExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */

   /* Load the bitmap, keeping the bits per pixel of the file */
   nRet = L_LoadBitmap (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\OCR1.TIF"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
   if(nRet !=SUCCESS)
      return nRet;

   nRet = L_HighQualityRotateBitmap(&LeadBitmap, 2500,HIGHQUALITYROTATE_RESIZE | HIGHQUALITYROTATE_HIGH,RGB(255,255,255));
   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;
   //free bitmap 
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);  
   return SUCCESS;
}
//#endif // LEADTOOLS_V16_OR_LATER