Adds effects that simulate random color changes, scratches, dust and pits, making a bitmap look like it was made from an old film.
L_LTIMGSFX_API L_INT L_AgingBitmap (pBitmap, uHScratchCount, uVScratchCount, uMaxScratchLen, uDustDensity, uPitsDensity, uMaxPitSize, crScratch, crDust, crPits, uFlags)
Pointer to the bitmap handle referencing the bitmap to be changed.
Number of horizontal scratch lines.
Number of vertical scratch lines.
Maximum scratch line length, in pixels. Its minimum value is 2.
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.)
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.)
Maximum pit size, in pixels. The size of the pits will be selected at random between 1 and uMaxPitSize.
A COLORREF value representing the color of the scratch lines.
A COLORREF value representing the color of the dust.
A COLORREF value representing the color of the pits.
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.
|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.|
|AGING_SCRATCH_INV||[0x0000] Use pixels color inverse as scratch line color. If this flag is set,
|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,
|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,
|AGING_PITS_CLR||[0x0040] Use the crPits as the color of the pits.|
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
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.
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 in the Document and Medical Imaging toolkits.
The width of the scratches is 1 pixel. The length of the scratches is random (between 2 and
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 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.
This example loads a bitmap and applies the aging effect.
BITMAPHANDLE LeadBitmap; /* Bitmap handle to hold the loaded image. */
/* Load the bitmap, keeping the bits per pixel of the file */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
/* apply aging effect */
nRet = 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);
nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL);
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries