Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug in RGB() function
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01621469
Message ID:
01621473
Vues:
88
String HEX presentation of the color is not the same of HEX presentation of RGB() function:
Color RED
?"RGB",RBG(255,0,0)
?"Decimal", 255
?"HEX of RGB()", TRANSFORM(RBG(255,0,0),"@0")
?"HEX of RED", "FF0000"
MartinaJ

>I am not sure I understand your answer. Forget about the hex for a minute. Set a background color to rgb(204,198,149). You get a dark yellow. The color is CCC695. Now at the command window display RGB(204,198,149) and you get the decimal of the backwards value.
>
>The VFP docs clearly state the function is as it seems, R then G then B. The docs give an example of RGB(0,0,255) as blue.
>
>>>Either I am missing something or there is a significant bug in the RGB function.
>>>
>>>The value of RGB((204,198,149) is returned as 9815756. In hex this is #95C6CC.
>>>
>>>That is completely wrong. The value of RGB(204,198,149) is 13420181. In hex that is #CCC695.
>>>
>>>I finally figured out the problem: any time the first number was > 99, the RGB() function is returning the number of the RGB in _opposite_ order! IOW the value of RGB(204,198,149) should be 13420181, yet VFP returns 9815756. However doing the RGB backwards, as in RGB(149,198,204) results in the correct decimal for the original order: 13420181.
>>>
>>>VFP is reversing the parameters, seemingly randomly, but I ran that RGB on 3 different PC's and it always came up the same wrong answer.
>>>
>>>Anybody know anything about this?
>>>
>>>TIA
>>
>>Really?!?
>>
>>?RGB(204,198,149) , TRANSFORM(RGB(204,198,149) ,"@0")
>>?204+198*256+149*256*256, TRANSFORM(204+198*256+149*256*256,"@0")
>>
>>
>>But hex string presentation of the color is:
>>
>>?RGB(149,198,204) , TRANSFORM(RGB(149,198,204) ,"@0")
>>
>>
>>
>>MartinaJ
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform