L_GrayScaleBitmap
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_GrayScaleBitmap(pBitmap, nBitsPerPixel)
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
L_INT nBitsPerPixel; |
/* number of bits */ |
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 Imaging editions .
Parameter |
Description |
pBitmap |
Pointer to the bitmap handle referencing the bitmap to be converted. |
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. Once the function is complete, the GrayScale flag of the bitmap handle is set to TRUE.
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 L_SetStatusCallback.
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
LTKRN 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, Windows CE.
See Also
Functions: |
|
Topics: |
|
|
Example
For complete sample code, refer to the FEATURE2 example.
/* This example loads a bitmap and changes it to 8-bit grayscale. */
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);
/* Change the bitmap to grayscale */
L_GrayScaleBitmap(&LeadBitmap, 8 );