Quick, how do I convert VB's goofy hex color codes to (accruate) RGB? I had it written down someplace but I went and lost it...
~Zero the Inestimable
Printable View
Quick, how do I convert VB's goofy hex color codes to (accruate) RGB? I had it written down someplace but I went and lost it...
~Zero the Inestimable
I believe (was it kedaman ??) had a bunch of usermade functions that he compiled and put on the net... one of them was RGB2HEX.
The quickest way to do it in VB (I'm talking performance speed, not coding speed) is probably using CopyMemory to copy each byte out, but this is the easy way:
That's from memory so it might not be correct, but I'm pretty sure it is.Code:Dim Red As Byte, Green As Byte, Blue As Byte
Blue = RGBValue And 255
Green = (RGBValue \ 256) And 255
Red = (RGBValue \ 65536) And 255
Thank you. I'm not too concerned about performance speed for this application. I have a very detailed and accurate image map to test this on (with color deviations of just one bit from object to object) so I'll be able to tell if it's accurate.
~Zero the Inestimable