Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_ChangeHueSatIntBitmap
#include "l_bitmap.h"
L_LTIMGCLR_API L_INT L_ChangeHueSatIntBitmap(pBitmap, nHue, nSaturation, nIntensity, pHsiData, uHsiDataCount, uFlags)
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
L_INT nHue; |
/* angular amount to change the hue */ |
L_INT nSaturation; |
/* amount to change saturation */ |
L_INT nIntensity; |
/* amount to change the intensity */ |
pHSIDATA pHsiData; |
/* pointer to array of HSIDATA structures */ |
L_UINT uHsiDataCount; |
/* number of structures in pHsiData array */ |
L_UINT32 uFlags; |
/* flags*/ |
Changes the hue, saturation and brightness of all or specified colors in the image.
Parameter |
Description |
pBitmap |
Pointer to the bitmap handle that references the bitmap on which to apply the effect. |
nHue |
Angular amount to change the hue, in hundredths of degrees. Valid values range from 18000 through 18000. This value is divided internally by 100. |
nSaturation |
Percentage amount to change saturation, in tenths of percent. Valid values range from 1000 through 1000. This value is divided internally by 10. Negative values decrease the saturation of colors. Positive values increase the saturation. The saturation level is increased or decreased by a percentage of its present saturation level. For example, an increase of 20% of the current saturation level "L" will raise the new saturation level "L1" to a value L = 0.20 * L. Likewise, increasing the saturation level 100% doubles the saturation level (L1 = L + 1.0 * L). Decreasing the saturation level 100% will set the new saturation level to 0. This process is carried out for every pixel. The saturation is set to 1000 (maximum value) if the new value exceeds 1000). |
nIntensity |
Percentage amount to change the intensity , in tenths of percent. Valid values range from 1000 (black) through 1000 (white). This value is divided internally by 10. Positive values increase (or lighten) the brightness of the bitmap image. Negative values decrease (or darken) the brightness of the bitmap image. |
pHsiData |
Pointer to array of HSIDATA structures for each color range to be changed. |
uHsiDataCount |
Count of structures in the pHsiData array. |
uFlags |
Reserved for future use. Must be 0. |
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 combines the basic functionality found in the L_ChangeBitmapHue, L_ChangeBitmapSaturation, and L_ChangeBitmapIntensity functions. In addition, special options can be specified in the LPHSIDATA structure.
The pHsiData ->uStructSize must be set to sizeof(HSIDATA) before calling this function. For an array of structures, only the first structure in the array needs to have uStructSize member set.
To change the overall hue, saturation and intensity all at one time, pass NULL for the pHsiData and 0 for the uHsiDataCount in the main function. To adjust the parameters separately, or to make adjustments in successive passes, use the structures and pass 0 for the nHue, nSaturation, and nIntensity parameters in the main function.
For detailed information about using the ranges in the HSIDATA structure, refer to HSIDATA.
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.
To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.
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.
Required DLLs and Libraries
LTIMGCLR 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 2000 / XP/Vista.
See Also
Example
#if defined (LEADTOOLS_V16_OR_LATER) L_INT ChangeHueSatIntBitmapExample(L_VOID) { L_INT nRet; BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */ HSIDATA HsiData; /*Color Range Information structure*/ /* Load a bitmap at 24 bits per pixel */ nRet = L_LoadBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL); if(nRet !=SUCCESS) return nRet; /*Change bitmap hue, saturation, and brightness */ HsiData.uStructSize = sizeof(HSIDATA); HsiData.nHue =18000; HsiData.nSaturation = 0; HsiData. nIntensity = 0; HsiData.nOuterLow =315; HsiData.nOuterHigh = 45; HsiData.nInnerLow = 345; HsiData.nInnerHigh = 15; /* change the red color to green */ nRet = L_ChangeHueSatIntBitmap (&LeadBitmap, 0, 0, 0, &HsiData, 1, 0); if(nRet !=SUCCESS) return nRet; nRet = L_SaveBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Result.BMP"), &LeadBitmap, FILE_BMP, 24, 0, NULL); if(nRet !=SUCCESS) return nRet; //free bitmap if(LeadBitmap.Flags.Allocated) L_FreeBitmap(&LeadBitmap); return SUCCESS; } #else L_INT ChangeHueSatIntBitmapExample(L_VOID) { L_INT nRet; BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */ HSIDATA HsiData; /*Color Range Information structure*/ /* Load a bitmap at 24 bits per pixel */ nRet = L_LoadBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL); if(nRet !=SUCCESS) return nRet; /*Change bitmap hue, saturation, and brightness */ HsiData.uStructSize = sizeof(HSIDATA); HsiData.nHue =18000; HsiData.nSaturation = 0; HsiData. nIntensity = 0; HsiData.nOuterLow =315; HsiData.nOuterHigh = 45; HsiData.nInnerLow = 345; HsiData.nInnerHigh = 15; /* change the red color to green */ nRet = L_ChangeHueSatIntBitmap (&LeadBitmap, 0, 0, 0, &HsiData, 1); if(nRet !=SUCCESS) return nRet; nRet = L_SaveBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Result.BMP"), &LeadBitmap, FILE_BMP, 24, 0, NULL); if(nRet !=SUCCESS) return nRet; //free bitmap if(LeadBitmap.Flags.Allocated) L_FreeBitmap(&LeadBitmap); return SUCCESS; } #endif // LEADTOOLS_V16_OR_LATER