HSV_HfromRGB example for C++ Builder
//Takes an RGB, displays the RGB components, and displays the HSV components
void RGBtoHSV(::OLE_COLOR cr)
{
int red;
int green;
int blue;
int h;
int s;
int v;
LEADRasterProcess* pRasterProc= NULL;
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
red = GetRValue (cr);
green = GetGValue(cr);
blue = GetBValue(cr);
h = pRasterProc->HSV_HfromRGB (cr);
s = pRasterProc->HSV_SfromRGB (cr);
v = pRasterProc->HSV_VfromRGB (cr);
ShowMessage( "RGB (" + IntToStr(red) + "," + IntToStr(green) + "," + IntToStr(blue) + ") is HSV(" + IntToStr(h) + "," + IntToStr(s) + "," + IntToStr(v) + ")" );
pRasterProc-> Release( );
}