Subject Re: duflp rgbtohex()
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 17 Dec 2017 21:54:42 +0200
Newsgroups dbase.getting-started

On 2017-12-17 8:52 PM, Wayne wrote:
> I started using rgbtohex() in convert.cc in duflp.  Tho it has been around for awhile, the code seems very wrong.
>
> Feed 0,94,138 (red,green,blue) values into it, and it returns hex 8A5E00.  It should return 005E8A.
>
> The error is that it is flipping rgb values.  The code gets the hex for red (cRed) then for green (cGreen) then blue (cBlue).  BUT it adds these 3 strings incorrectly cBlue+cGreen+cRed.  It should be cRed+cGreen+cBlue to get the final hex value.
>
> Trouble is, this code has been used so long I keep thinking I missed something.
>
> Anyone else finding trouble with rgbtohex?
>
> Thanks,
> Wayne
>
>

Although the Windows standard is RGB dBASE has always used BGR.
rgbtohex() returns a hex value that dBASE can use.  0x8A5E00 will give
you a darkish blue in dBASE and a muddy brown in Windows.

Mervyn.