Last Monday, I faced one color conversion issue in my RealBasic application. That is, how to convert from the signed integer to RGB color in REALBASIC?. There is no stright forward funtion available in Realbasic.
Luckly, I got one clue from the Realbasic forum. I am not too sure if this is absolutely correct; but I have tried this with some of the decimals and I am getting the correct RGB value.
Solution for decimal to RGB conversion :
Private Function Convert_Dec2RGB(ByVal myDECIMAL As Long) As String
Dim myRED As Long
Dim myGREEN As Long
Dim myBLUE As Long
myRED = myDECIMAL And &HFF
myGREEN = (myDECIMAL And &HFF00&) \ 256
myBLUE = myDECIMAL \ 65536
Convert_Dec2RGB = CStr(myRED) & "," & CStr(myGREEN) & "," & CStr(myBLUE)
Solution for signed integer to RGB conversion:
Private Function Convert_sInteger2RGB(ByVal myDECIMAL As Long) As Color
Dim newRGB as Variant
newRGB = myDECIMAL
Convert_sInteger2RGB = newRGB.ColorValue
Let me know if you have any comment or feedback on this.
I hope this ll help you. A 'Thank You' would be nice!