LBitmap::HalfTone

#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)

L_UINT uType;

/* the type of halftoning */

L_INT32 nAngle;

/* angle of rotation */

L_UINT uDim;

/* size of the grain */

HBITMAPLIST hBitmapList;

/* handle to the list of bitmaps */

LBitmapList * pBitmapList;

/* pointer to LBitmapList object that will be used in halftoning if the HT_USERDEF option is selected */

L_UINT32 uFlags;

/* flags */

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.

Parameter

Description

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

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.

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

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

pBitmapList

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

uFlags

Reserved for future use. Must be 0.

Returns

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.

Required DLLs and Libraries

LTDIS
LTFIL
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

Win32, x64.

See Also

Functions:

LDialogColor::DoModalHalfTone, Class Members

Topics:

Raster Image Functions: Doing Color Expansion or Reduction

 

Color Halftones and Halftone Images

 

Raster Image Functions: Working with Color Halftones, Halftones, and Grayscale Images

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;
}