Extract The Red, Green and Blue Values From a Long

Category:
Screen/Graphics
Type:
Snippets
Difficulty:
Intermediate
Author:
Kirk Siqveland

Version Compatibility: Visual Basic 6

More information:
The included snippet makes it easy to extract the RGB values from a value of data type long. Everything I found on the web seems to result in slightly inaccurate numbers, so I made my own version of an unRGB function that I think is more accurate and easier to understand. The source of the original function is unknown.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: