Results 1 to 4 of 4

Thread: RGB Color Conversion

  1. #1

    Thread Starter
    Lively Member Zero's Avatar
    Join Date
    Feb 2000
    Posts
    101

    RGB Color Conversion

    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

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I believe (was it kedaman ??) had a bunch of usermade functions that he compiled and put on the net... one of them was RGB2HEX.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    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:

    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
    That's from memory so it might not be correct, but I'm pretty sure it is.
    Last edited by HarryW; May 4th, 2001 at 11:18 PM.
    Harry.

    "From one thing, know ten thousand things."

  4. #4

    Thread Starter
    Lively Member Zero's Avatar
    Join Date
    Feb 2000
    Posts
    101

    Thanks.

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width