Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_PutPixelColor
#include "l_bitmap.h"
L_LTKRN_API L_INT L_PutPixelColor(pBitmap, nRow, nCol, crColor)
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
L_INT nRow; |
/* row number of the pixel */ |
L_INT nCol; |
/* column number of the pixel */ |
L_COLORREF crColor; |
/* color to assign to the pixel */ |
Changes the color value of the specified pixel.
Parameter |
Description |
pBitmap |
Pointer to the bitmap handle referencing the bitmap. |
nRow |
The row number of the pixel. This is a zero-based value. |
nCol |
The column number of the pixel. This is a zero-based value. |
crColor |
The color to assign to the pixel. The standard Windows values for COLORREF represent either red, green, and blue color values, or an index into the bitmap's palette. A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value. If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value. These COLORREF values can be used with any Windows function and macro that takes a COLORREF parameter. |
|
In the Document and Medical Imaging toolkits the COLORREF value may represent a 16 bit grayscale value if pBitmap is a 12 or 16-bit grayscale bitmap, or a 32-bit grayscale value if pBitmap is a 32-bit grayscale bitmap. So that the value is not confused with an RGB value, the COLORREF_GRAY16 mask (0x04000000) is set. In this case (0x0400YYYY), the lower 16 bits (0xYYYY) of the COLORREF value represent the 16-bit grayscale value. (0x0400FFFF is 16-bit white and 0x04000000is 16-bit black.) This is not a standard Windows value. Therefore, LEADTOOLS functions will recognize a COLORREF having this format, but Windows functions will not. For information on how to use a 16-bit grayscale COLORREF in a non-LEADTOOLS function, refer to L_GetPixelColor. If pBitmap is a 32-bit grayscale bitmap, the value of this crColor parameter will be treated as a 32-bit grayscale value. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
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 uses bitmap coordinates to specify the pixel. Therefore, you must account for the view perspective of the bitmap. For more information, refer to Accounting for View Perspective.
If you specify a pixel that is outside the bitmap or outside the region (if the bitmap has one), this function returns an error.
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
Win32, x64, Mobile.
See Also
Example
For an example, refer to L_GetPixelColor.