HSV_HfromRGB example for C++ 5.0 and later
//Takes an RGB, displays the RGB components, and displays the HSV components
void CRemapHueDlg::RGBtoHSV(OLE_COLOR color)
{
int nH, nS, nV;
CString strMsg;
ILEADRasterProcess *pRasterProc=NULL;
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
if (pRasterProc != NULL)
{
nH = pRasterProc->HSV_HfromRGB(color);
nS = pRasterProc->HSV_SfromRGB(color);
nV = pRasterProc->HSV_VfromRGB(color);
strMsg.Format(TEXT("RGB(%d,%d,%d) is HSV(%d,%d,%d)"),
GetRValue(color),
GetGValue(color),
GetBValue(color),
nH,
nS,
nV);
MessageBox(strMsg);
pRasterProc->Release();
}
}