Creates a halftone screen effect for an image while keeping its continuous range of tones.
#include "ltwrappr.h"
L_INT LBitmap::HalfTonePattern(uContrast, uRipple, uAngleContrast, uAngleRipple, nAngleOffset, crForGround, crBackGround, uFlags)
Halftone pattern contrast. Increasing this value increases the pattern brightness, making it more visible.
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.
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.
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.
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.
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.
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.
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 circular pattern. |
HTPATTERN_ELLIPSE | [0x0004] Use an elliptical pattern. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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 LBitmap::ColorHalfTone 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 that it is replacing.
Use the LBitmap::HalfTone 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 LBitmap::GrayScaleExt function to convert any bitmap to a gray scale bitmap without changing its resolution.
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.
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.
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.
Halftone Pattern Function - Before
Halftone Pattern Function - After
View additional platform support for this Halftone Pattern function.
Win32, x64.
L_INT LBitmap__HalfTonePatternExample()
{
L_INT nRet;
LBitmap LeadBitmap;
nRet =LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), 0,ORDER_BGR);
if(nRet !=SUCCESS)
return nRet;
nRet =LeadBitmap.HalfTonePattern(100, 200, 12, 2, 4500, RGB(255,255,255), RGB(255,0,0), HTPATTERN_LINE);
if(nRet !=SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document