HSV_HfromRGB example for Delphi
//Takes an RGB, displays the RGB components, and displays the HSV components
Procedure RGBtoHSV(cr: OLE_COLOR);
var
red : Integer;
green: Integer;
blue: Integer;
h: Integer;
s: Integer;
v: Integer;
RasterProc: LEADRasterProcess;
begin
RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;
red := GetRvalue (cr);
green := GetGvalue(cr);
blue := GetBvalue(cr);
h := RasterProc.HSV_HfromRGB (cr);
s := RasterProc.HSV_SfromRGB (cr);
v := RasterProc.HSV_VfromRGB (cr);
ShowMessage( 'RGB (' + IntToStr(red) + ',' + IntToStr(green) + ',' + IntToStr(blue) + ') is HSV(' + IntToStr(h) + ',' + IntToStr(s) + ',' + IntToStr(v) + ')' );
end;