L_HalfToneBitmap

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_HalfToneBitmap(pBitmap, uType, nAngle, uDim, hList)

pBITMAPHANDLE pBitmap;

/* Pointer to the bitmap handle */

L_UINT uType;

/* Type of halftoning to do */

L_INT32 nAngle;

/* Angle of rotation */

L_UINT uDim;

/* Size of the grain */

HBITMAPLIST hList;

/* Handle to the list of bitmaps */

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

pBitmap

Pointer to the bitmap handle referencing the bitmap to be converted.

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

hList

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

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 L_SetStatusCallback.

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.

Required DLLs and Libraries

LTIMG

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 95 / 98 / Me, Windows 2000 / XP.

See Also

Functions:

L_DefaultDithering, L_GrayScaleBitmap, L_GrayScaleBitmapExt, L_DlgHalftone, L_AutoColorLevelBitmap, L_ColorLevelBitmap, L_CorrelationBitmap, L_GrayScaleToDuotone, L_GrayScaleToMultitone, L_HolesRemovalBitmapRgn, L_SelectiveColorBitmap, L_SkeletonBitmap

Topics:

Raster Image Functions: Doing Color Expansion or Reduction

 

Color Halftone and Halftone Images

Example

BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the image */
HBITMAPLIST      hList;

/* Load a bitmap at its own bits per pixel */
L_LoadBitmap
 (TEXT("image3.cmp"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
/
* fill hList by at least 26 bitmaps*/
/* Halftone the bitmap */
L_HalfToneBitmap
(&LeadBitmap, HT_USERDEF,0, 5, hList);