HSV_HfromRGB example for Visual Basic
'Takes an RGB, displays the RGB components, and displays the HSV components
Private Sub RGBtoHSV(cr As OLE_COLOR)
Dim red As Integer
Dim green As Integer
Dim blue As Integer
Dim h As Integer
Dim s As Integer
Dim v As Integer
Dim RasterProc As New LEADRasterProcess
red = cr And &HFF
green = (cr \ &H100) And &HFF
blue = cr \ &H10000
h = RasterProc.HSV_HfromRGB (cr)
s = RasterProc.HSV_SfromRGB (cr)
v = RasterProc.HSV_VfromRGB (cr)
MsgBox "RGB (" & red & "," & green & "," & blue & ") is HSV(" & h & "," & s & "," & v & ")"
End Sub