LBitmap::Aging

#include "ltwrappr.h"

virtual L_INT LBitmap::Aging (uHScratchCount, uVScratchCount,uMaxScratchLen, uDustDensity, uPitsDensity, uMaxPitSize, crScratch, crDust,crPits, uFlags)

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.

Parameter

Description

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 pixels 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 pixels 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 pixels 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 LBase::EnableStatusCallback.

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

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTIMGSFX

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:

LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::Clouds, LBitmap::ColoredBalls, LBitmap::DiffuseGlow, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::HalfTonePattern, LBitmap::MaskConvolution, LBitmap::MosaicTiles, LBitmap::Offset, LBitmap::Perspective, LBitmap::PlasmaFilter, LBitmap::Pointillist, LBitmap::RomanMosaic, LBitmap::Vignette, LBitmap::ZigZag, LBitmap::Sharpen, LBitmap::Posterize, LBitmap::Emboss, LBitmap::AverageFilter, LBitmap::MedianFilter, LBitmap::AddNoise, LBitmap::IntensityDetect, LBitmap::SpatialFilter, LBitmap::BinaryFilter, LBitmap::MaxFilter, LBitmap::MinFilter, LBitmap::Oilify, LBitmap::Solarize, LBitmap::WindowLevel, LBitmap::WindowLevelExt, LBitmap::Mosaic.

Topics:

Applying Artistic Effects

 

Raster Image Functions: Modifying Intensity Values

 

Raster Image Functions: Artistic Effects

 

Using Color Values in LEADTOOLS

Example

L_INT LBitmap__AgingExample(LBitmap *pLeadBitmap) 
{
   /* This example applies aging effect */
   /* apply aging effect */
   return pLeadBitmap->Aging (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); 
}