Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RGB( )
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: RGB( )
Miscellaneous
Thread ID:
00065722
Message ID:
00065731
Views:
36
Denis,

There may be an easy way to get it, but here's the hard way. The first thing you need to know is how the 12632256 is calculated. The formula is red*(256**0)+green*(256**1)+blue*(256**2). So to go back do this:

nRgbVal=12632256
nBlue=INT(nRgbVal/(256**2))
nRgbVal=nRgbVal % (256**2)
nGreen=INT(nRgbVal/(256**1))
nRed=nRgbVal % (256**1)

Of course, you can 256**0=1, 256**1=256 and 256**2=65536, but I use exponents to illustrate how the number you start with is really 3 appended base 256 numbers.

>Hello
>How can I get the red, green and blue components from the nColor represented as numeric value. For example: I have nColor variable. nColor=12632256. I want to get value: nRed=192,nGreen=192,nBlue=192
>Thanks.
>Denis Gavrikov.
Previous
Reply
Map
View

Click here to load this message in the networking platform