RGB conversion

RGB conversion

You can use the RGB function to convert the red, green, blue colours to a rgb value.

I want to the the reverse.
There is an integertorgb function but it is for QuickWin and I want it for Win32 API.
There are also GetBvalue, GetGvalue & GetBvalue functions, are these the ones that I should use? If so, I am having trouble getting it to work.

Thanks,

David

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

RGB value in Win32 is defined as #00BBGGRR. GetRValue, RGB, MAKEINTRESOURCE and some more functions are
not "real" Win32 API functions; those are actually C macros which
are, AFAIK, expanded to real functions by Compaq/Digital and placed in dfwin.lib.

GetRValue, GetBValue and GetGValue are supposed to work, though I think (don't know if it's fixed in newer versions) Compaq forgot to include them in dfwin.lib. You can write them yourself (as real or statement functions ):

GetRVAlue(iRGB) = IAND(iRGB, #FF)

GetGValue(iRGB) = ISHL(IAND(iRGB,#FF00), -8)

GetBValue(iRGB) = ISHL(IAND(iRGB,#FF0000), -16)

RGB() macro/function does the inverse thing in Win32 (that one
is implemented in dfwin.lib). I prefer to use hex notation
when working with colors (i.e. #FF00FF means light pink) instead
of RGB macro -- but that's a matter of taste.

Regards

Jugoslav

Jugoslav
www.xeffort.com

Thanks, that worked.

It is strange that GetRvalue, GetGvalue & GetBvalue are all missing from CVF v6.5.

David

Leave a Comment

Please sign in to add a comment. Not a member? Join today