LBitmapBase::GrayScale
#include "ltwrappr.h"
virtual L_INT LBitmapBase::GrayScale(nBitsPerPixel=8)
L_INT nBitsPerPixel; |
/* number of bits per pixel */ |
Converts a 1-, 4-, 8-, 16-, 24-, or 32-bit bitmap to an 8-bit, 12-bit, or 16-bit grayscale bitmap. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.
Parameter |
Description |
nBitsPerPixel |
Value indicating the number of bits in the destination bitmap. Valid values are 8, 12, or 16. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
The resulting bitmap can be an 8-bit, 12-bit, or 16-bit grayscale bitmap.
When converting to 12-bit or 16-bit grayscale, a Lookup table is not used. When converting to 8-bit grayscale, a Lookup table is used to get the RGB for each input pixel. The grayscale value corresponding to that RGB triple is used in the destination bitmap.
To update a status bar or detect a user interrupt during execution of this function, refer to LBase::EnableStatusCallBack.
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
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Element: |
|
Topics: |
|
|
|
|
Raster Image Functions: Working with Color Halftones, Halftones, and Grayscale Images |
Example
LBitmapBase MyBitmap;
MyBitmap.SetFileName(TEXT("image1.cmp"));
MyBitmap.Load(24);
if(MyBitmap.IsGrayScale()==GRAY_NO)
MyBitmap.GrayScale(8);