L_AgingBitmap

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_AgingBitmap (pBitmap, uHScratchCount, uVScratchCount,uMaxScratchLen, uDustDensity, uPitsDensity, uMaxPitSize, crScratch, crDust,crPits, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_UINT uHScratchCount;

/* number of horizontal scratch lines */

L_UINT uVScratchCount;

/* number of vertical scratch lines */

L_UINT uMaxScratchLen;

/* maximum scratch line length */

L_UINT uDustDensity;

/* dust density */

L_UINT uPitsDensity;

/* density of pits */

L_UINT uMaxPitSize;

/* maximum pit size */

COLORREF crScratch;

/* color of the scratch lines */

COLORREF crDust;

/* dust color */

COLORREF crPits;

/* color of pits */

L_UINT uFlags;

/* flags */

Adds effects that simulate random color changes, scratches, dust and pits, making a bitmap look like it was made from an old film. This function is available in the Raster Pro and above toolkits.

Parameter

Description

pBitmap

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

uHScratchCount

Number of horizontal scratch lines.

uVScratchCount

Number of vertical scratch lines.

uMaxScratchLen

Maximum scratch line length, in pixels. Its minimum value is 2.

uDustDensity

Dust density, expressed in tenths of percent of the bitmap area. Valid values range between 0 and 1000. This value is divided internally by 10. If uDustDen = 1000 then dust density = 100% (that is, the number of dust points = the entire bitmap area.)

uPitsDensity

Density of the pits, expressed in tenths of percent of the bitmap area. Valid values range between 0 and 1000. This value is divided internally by 10. If uPitsDen = 1000 then the density of the pits = 100% (that is, the number of pits = the entire bitmap area.)

uMaxPitSize

Maximum pit size, in pixels. The size of the pits will be selected at random between 1 and uMaxPitSize.

crScratch

A COLORREF value representing the color of the scratch lines.

crDust

A COLORREF value representing the color of the dust.

crPits

A COLORREF value representing the color of the pits.

uFlags

Flags that indicate the distortion type and the distortion color. You can use a bitwise OR (|) to specify one or more flags from each group.

 

The following flags indicate the distortion type:

 

Value

Meaning

 

AGING_ADD_NOTHING

[0x0000] Do not add any distortion type. In this case, the bitmap will be changed by random changes in the color intensity.

 

AGING_ADD_VSCRATCH

[0x0001] Add vertical scratch lines.

 

AGING_ADD_HSCRATCH

[0x0002] Add horizontal scratch lines.

 

AGING_ADD_DUST

[0x0004] Add dust.

 

AGING_ADD_PITS

[0x0008] Add pits.

 

The following flags indicate the distortion color:

 

Value

Meaning

 

AGING_SCRATCH_INV

[0x0000] Use pixel’s color inverse as scratch line color. If this flag is set, crScratch will be ignored.

 

AGING_SCRATCH_CLR

[0x0010] Use the crScratch as scratch line color.

 

AGING_DUST_INV

[0x0000] Use pixel’s color inverse as dust color. If this flag is set, crDust will be ignored.

 

AGING_DUST_CLR

[0x0020] Use the crDust as dust color.

 

AGING_PITS_INV

[0x0000] Use pixel’s color inverse as the color of the pits. If this flag is set, crPits will be ignored.

 

AGING_PITS_CLR

[0x0040] Use the crPits as the color of the pits.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

The width of the scratches is 1 pixel. The length of the scratches is random (between 2 and uMaxScratchLen).

The size of dust particles is 1 pixel (1x1).

The size and shape of pits is selected at random. The pit shapes are random and will be between 1x1 and uMaxPitSize x uMaxPitSize.

The function will also make random changes to the pixel’s intensities.

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_SharpenBitmap, L_PosterizeBitmap, L_EmbossBitmap, L_AddBitmapNoise, L_IntensityDetectBitmap, L_SpatialFilterBitmap, L_BinaryFilterBitmap, L_MaxFilterBitmap, L_MinFilterBitmap, L_OilifyBitmap, L_SolarizeBitmap, L_WindowLevel, L_MosaicBitmap, L_BricksTextureBitmap, L_CanvasBitmap, L_CloudsBitmap, L_ColoredBallsBitmap, L_DiffuseGlowBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_HalfTonePatternBitmap, L_MaskConvolutionBitmap, L_MosaicTilesBitmap, L_OffsetBitmap, L_PerspectiveBitmap, L_PlasmaFilterBitmap, L_PointillistBitmap, L_RomanMosaicBitmap, L_VignetteBitmap, L_ZigZagBitmap

Topics:

Applying Artistic Effects

 

Raster Image Functions: Modifying Intensity Values

 

Raster Image Functions: Artistic Effects

 

Using Color Values in LEADTOOLS

Example

/* This example loads a bitmap and applies aging effect */
BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */
/* Load the bitmap, keeping the bits per pixel of the file */
L_LoadBitmap
 (TEXT("IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
/* apply aging effect */
L_AgingBitmap
 (&LeadBitmap, 10, 2, 50,2,5,6, RGB(255,255,0), RGB(0,0,0), RGB(0,0,255), AGING_ADD_VSCRATCH | AGING_ADD_PITS | AGING_SCRATCH_INV | AGING_PITS_CLR);