
a question for smart people
Here's a post from the ng:
Subject: RGB function - getting original values?
Date: Thu, 23 Apr 1998 00:27:00 -0500
Org: The Zipsters
Hello, Once I've got the Long value returned from the RGB
function, is it possible
to convert back somehow and get the original R, G, and B values?
The RGB values are stored as 00BBGGRR. To extract them use the
following:
R = C And &hff
G = (C \ &h100) And &hff
B = (C \ &h10000) And &hff
C is the long value.
Regards
Stanley Peck
Quote:
> hey you VB guru,
> Here is a question:
> I am using the windows API to get
> the the color of a pixel:
> var123 = GetPixel(Pic1.hdc, x1, y1)
> the problem is that GetPixel return
> the color of the pixel as a long.
> I however need to change this long
> to a RBG value.
> the number I get for var123, are anywhere
> from 0 (black) to about 16,000,000. I need
> to change this number to red, green, blue.
> What is the algorithm for doing it?
> Many thanks,
> Tigran