Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug in RGB() function
Message
From
26/06/2015 14:21:22
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
26/06/2015 13:42:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01621469
Message ID:
01621492
Views:
61
Infact, the docs implies nothing. Or BGR, as you can see in BACKCOLOR. It just says color value.

For your translation to RGB <> BGR. You need to swap the two bytes. There is no need to go via string. This is pure maths. :)
lnColor = RGB(32,64,128)
lnColor = BITRSHIFT(lnColor,16)+BITLSHIFT(BITAND(lnColor,0xFF),16)+BITAND(lnColor,0xFF00)
HTH
>My (incorrect) assumptions were based on :
>1. In the world today color numbers are standardized
>2. The docs say as you quote, but if you read further it gives an example of setting blue using RGB(0,0,255). Implies normal order, not BGR order.
>3. Nowhere does it mention in the docs the critical point that the RGB function returns BGR order, a pretty big omission. In fact all the docs seem to imply all numbers will be in RGB order.
>
>After all these years, it just goes to show there is always something new to learn.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Reply
Map
View

Click here to load this message in the networking platform