LBitmap::HalfTone

Summary

Converts a 1-, 4-, 8-, 16-, 24-, or 32-bit bitmap to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

Syntax

#include "ltwrappr.h"

virtual L_INT LBitmap::HalfTone(uType, nAngle, uDim, hBitmapList, uFlags = 0)

virtual L_INT LBitmap::HalfTone(uType, nAngle, uDim, pBitmapList, uFlags = 0)

Parameters

L_UINT uType

Value that indicates the type of halftoning to perform. Possible values are:

Value Meaning
HT_PRINT [0x0000] Halftone for printing
HT_VIEW [0x0001] Halftone for display
HT_RECT [0x0002] Rectangular halftone
HT_CIRC [0x0003] Circular halftone
HT_ELLIPS [0x0004] Elliptical halftone
HT_RAND [0x0005] Random halftone
HT_LINEAR [0x0006] Linear halftone
HT_USERDEF [0x0007] User-defined halftone

L_INT32 nAngle

The angle of rotation, expressed in hundredths of degrees. A value of 0 produces a horizontal halftone pattern. This parameter specifies the number of degrees to change the pattern. Positive values rotate the pattern clockwise; negative values rotate the pattern counterclockwise. This value is ignored if the selected halftone pattern is HT_RECT, HT_CIRC or HT_RAND or HT_USERDEF.

L_UINT uDim

Value that indicates the size of the grain. This value is ignored if the selected halftone pattern is HT_VIEW or HT_PRINT. If the pattern is not HT_VIEW or HT_PRINT, uDim should be >= 1. If this parameter is < 1 this function will return ERROR_INV_PARAMETER (-13).

HBITMAPLIST hBitmapList

Handle to the list of bitmaps that will be used in halftoning if the HT_USERDEF option is selected.

LBitmapList * pBitmapList

Pointer to LBitmapList object that will be used in halftoning if the HT_USERDEF option is selected.

L_UINT32 uFlags

Reserved for future use. Must be 0.

Returns

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

Comments

For the HT_USERDEF option, the number of bitmaps in the list must be at least equal to (uDim * uDim + 1). Bitmaps with higher indexes correspond to higher intensity values.

This function can process the whole image or a region of the image.

This function does not support 12 and 16-bit grayscale and 48 and 64-bit color images.

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

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 supports 32-bit grayscale images.

Halftone Function - Before

Halftone Function - Before

Halftone Function - After

Halftone Function - After

View additional platform support for this Halftone function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmap__HalfToneExample(LBitmap & Bitmap, L_TCHAR * pszFile) 
{ 
   L_INT nRet; 
 
   nRet =Bitmap.Load(pszFile); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =Bitmap.HalfTone(HT_ELLIPS, 4500, 5, (LBitmapList*)NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.