L_HalfTonePatternBitmap

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_HalfTonePatternBitmap(pBitmap, uContrast, uRipple, uAngleContrast, uAngleRipple, nAngleOffset, crForeGround, crBackGround, uFlag)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_UINT uContrast;

/* pattern contrast */

L_UINT uRipple;

/* pattern frequency */

L_UINT uAngleContrast;

/* angular pattern contrast */

L_UINT uAngleRipple;

/* angular pattern frequency */

L_INT nAngleOffset;

/* angular pattern offset */

COLORREF crForeGround;

/* forground color */

COLORREF crBackGround;

/* background color */

L_UINT uFlag;

/* flag */

Creates a halftone screen effect for an image while keeping its continuous range of tones. This function is available only in the Document/Medical Toolkits.

Parameter

Description

pBitmap

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

uContrast

Halftone pattern contrast. Increasing this value increases the pattern brightness, making it more visible.

uRipple

Halftone pattern frequency. Internally, this value is divided by 100. For example, if uRipple = 200 the actual frequency is 2. Increasing this value increases the number of dots, lines, etc. in the pattern.

uAngleContrast

Angular pattern contrast. Angular pattern only occurs if either HTPATTERN_CIRCLE or HTPATTERN_ELLIPSE option is selected. Increasing this value increases brightness of the "spokes" in the image.

uAngleRipple

Angular pattern frequency. This parameter is used when either HTPATTERN_CIRCLE or HTPATTERN_ELLIPSE option is selected. This value determines how many "spokes" appear in the image.

uAngleOffset

Angular pattern offset in a hundredths of degrees (+/-). A positive value will rotate the screen clockwise, while a negative value will rotate the screen counter-clockwise. This parameter is used when either the HTPATTERN_CIRCLE or HTPATTERN_ELLIPSE option is selected.

crForeGround

The COLORREF value that specifies the foreground color for any exposed areas. You can specify a COLORREF value, such as the return value of the Windows RGB macro, or you can use the PALETTEINDEX macro to specify a palette color.

crBackGround

The COLORREF value that specifies the background color for any exposed areas. You can specify a COLORREF value, such as the return value of the Windows RGB macro, or you can use the PALETTEINDEX macro to specify a palette color.

uFlag

Flag that indicates which halftone pattern type to use. Possible values are:

 

Value

Meaning

 

HTPATTERN_DOT

[0x0001] Use a Dot pattern.

 

HTPATTERN_LINE

[0x0002] Use a Line pattern.

 

HTPATTERN_CIRCLE

[0x0003] Use a Circle pattern.

 

HTPATTERN_ELLIPSE

[0x0004] Use an Ellipse pattern.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this function to create a halftone screen effect for an image while keeping its continuous range of tones. Use the uContrast parameter to control the amount of the midtones in the image.

Use the L_ColorHalfToneBitmap to create an enlarged halftone screen for each image channel. The filter divides the image into rectangles and replaces each rectangle with circles, one for each channel. The size of each circle is proportional to the brightness of the rectangle which it is replacing.

Use the L_HalfToneBitmap function to convert 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.

Use the L_GrayScaleBitmapExt function to convert any bitmap to a gray scale bitmap without changing its resolution.

As an example, if you use the following image:

image\diffuseglowbefore.gif

And you were to call the L_HalfTonePatternBitmap function using the following settings:

Parameter

Value

uContrast

1

uRipple

20000

uAngleContrast

na

uAngleRipple

na

uAngleOffset

na

crForeGround

Black

crBackGround

White

uFlag

HTPATTERN_DOT

The following figure results:

image\halftonepatterndot.gif

As another example, if you were to use the same original bitmap but call L_HalfTonePatternBitmap using the following settings:

Parameter

Value

uContrast

75

uRipple

20000

uAngleContrast

85

uAngleRipple

4

uAngleOffset

54

crForeGround

White

crBackGround

Brown

uFlag

HTPATTERN_CIRCLE

The following figure results:

image\halftonepatterncircle.gif

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

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

If the bitmap has a region, this function works only on the region. If the bitmap does not have a region, this function works on the entire bitmap.

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_AutoColorLevelBitmap, L_ColorLevelBitmap, L_CorrelationBitmap, L_GrayScaleToDuotone, L_GrayScaleToMultitone, L_HolesRemovalBitmapRgn, L_SelectiveColorBitmap, L_SkeletonBitmap, L_HalfToneBitmap, L_PointillistBitmap, L_ColorHalfToneBitmap, L_ColorSeparateBitmap, L_ColorMergeBitmap, L_DesaturateBitmap, L_GetBitmapStatisticsInfo, L_GetBitmapHistogram, L_GetBitmapColorCount, L_GetBitmapColors, L_GetMinMaxBits, L_GetMinMaxVal, L_ConvertToColoredGray, L_ColorizeGrayBitmap, L_GetBitmapAlpha, L_ShiftBitmapData, L_SelectBitmapData, L_AnnSetAutoHilightPen, L_AnnSetAutoCursor, L_GetBitmapHistogramGray, L_IsGrayScaleBitmap, L_WindowLevel, L_WindowLevelBitmap, L_WindowLevelFillLUT

Topics:

Raster Image Functions: Doing Color Expansion or Reduction

 

Raster Image Functions: Filtering Images

 

Applying Artistic Effects

Example

/* The following example loads a bitmap and applies the halftone pattern filter */
BITMAPHANDLE LeadBitmap;

/* Load the bitmap, keeping the bits per pixel of the file */
L_LoadBitmap
 (TEXT("Sample1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);

/*Apply the filter*/
L_HalfTonePatternBitmap
(&LeadBitmap, 100, 200, 12, 2, 4500, RGB(255,255,255), RGB(255,0,0), HTPATTERN_LINE);