[windows2000] Re: OT: Color picking application
- From: "V T" <vstim@xxxxxxxxxxxx>
- To: <windows2000@xxxxxxxxxxxxx>
- Date: Fri, 28 May 2004 15:58:17 -0700
----- Original Message -----
From: "Toby Bierly" <toby@xxxxxxxxxxxxx>
To: <windows2000@xxxxxxxxxxxxx>
Sent: Friday, May 28, 2004 3:47 PM
Subject: [windows2000] Re: OT: Color picking application
> Maybe I am missing something, but converting to hex shouldn't be too
> difficult (I'm not sure what language you are using). Please
forgive me if
> I over-explain this. I'm just not sure how much programming
background
> everyone has.
>
> To go from hex to dec, just multiply the "tens" column by 16 and add
the
> "ones" column for each color. Letters A - F corrspond to the
numbers 10-15,
> respectively. For example, F3 in hexadecimal (base 16) is 15 * 16 +
3 = 243
> in decimal (base 10). Or CC in hex is 12 * 16 + 12 = 204 in
decimal.
>
> To go from dec to hex, divide by 16. The result is your "tens"
column and
> the remainder your "ones" column. For example, 135 / 16 = 8
remainder 7 =
> 87 in hex. Or 142 / 16 = 8 remainder 14 = 8E in hex.
>
> It should be fairly simple to program the conversion. Many
languages
> already have a function to do it. For example, VB has a function
called
> Hex(<decimal_num>) that returns the number you feed it as a hex
number. You
> could program it from scratch using the following general method:
>
> /*** From hex to dec (for two digit hex numbers)***/
> hex_num = <number you want converted>
> hex_tens = get_dec_val(substring(hex_num, 0, 1))
> hex_ones = get_dec_val(substring(hex_num, 1, 1))
> dec_num = 16 * hex_tens + hex_ones
>
> int get_dec_val(string hex_digit){
> switch (hex_digit){
> case: A
> return 10; break;
> case: B
> return 11; break;
> . . . . .<cases C, D, & E> . . . . .
> case: F
> return 15; break;
> default
> return (int)(hex_digit)
> }
> }
>
> /*** From dec to hex ***/
> dec_num = <number you want converted>
> hex_tens = (int)(dec_num / 16)
> hex_ones = dec_num - (16 * hex_tens)
> hex_num = hex_tens <concatenate> hex_ones
>
> If you send me the source code, I could probably add this
functionality
> (depending on language) and send it back. Wouldn't want to deprive
you of
> the fun though. :)
>
> Thanks,
> Toby
:-)))
Thank you, but I know how to convert decimal into hex.
What I do not know is: how the three integer values RGB -- Red, Green,
Blue --
must be combined to obtain one hex value.
The language is C. Win 32 API is used.
I have tried to send the .exe files at the adress you indicated in
your previous
message, but got an answer: "Returned mail: user unknown". Probably
there was an error in the adress.
Regards
Vladislav
********************************************************
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.
http://thethin.net/win2000list.cfm
- Follow-Ups:
- [windows2000] Re: OT: Color picking application
- From: Toby Bierly
- References:
- [windows2000] Re: OT: Color picking application
- From: Ray at work
- [windows2000] Re: OT: Color picking application
- From: Toby Bierly
- [windows2000] Re: OT: Color picking application
- From: V T
- [windows2000] Re: OT: Color picking application
- From: Toby Bierly
Other related posts:
- » [windows2000] OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- » [windows2000] Re: OT: Color picking application
- [windows2000] Re: OT: Color picking application
- From: Toby Bierly
- [windows2000] Re: OT: Color picking application
- From: Ray at work
- [windows2000] Re: OT: Color picking application
- From: Toby Bierly
- [windows2000] Re: OT: Color picking application
- From: V T
- [windows2000] Re: OT: Color picking application
- From: Toby Bierly