[windows2000] Re: OT: Color picking application
- From: "Toby Bierly" <toby@xxxxxxxxxxxxx>
- To: <windows2000@xxxxxxxxxxxxx>
- Date: Fri, 28 May 2004 15:47:55 -0700
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
----- Original Message -----
From: "V T" <vstim@xxxxxxxxxxxx>
To: <windows2000@xxxxxxxxxxxxx>
Sent: Friday, May 28, 2004 2:25 PM
Subject: [windows2000] Re: OT: Color picking application
> Of course.
>
> But there is one thing which I have overlooked in Ray's message.
>
> He asked about hex color code.
> Now the application I wrote about (this is in fact an example from
> Charles
> Petzold's book on Windows programming) gives only the RGB values.
> If I knew how to calculate the hex code from these values
> (:- ))), I would be able to re-compile the app. and add that code too
> as output.
>
> Regards
> Vladislav
>
>
> ----- Original Message -----
> From: "Toby Bierly" <toby@xxxxxxxxxxxxx>
> To: <windows2000@xxxxxxxxxxxxx>
> Sent: Friday, May 28, 2004 2:03 PM
> Subject: [windows2000] Re: OT: Color picking application
>
>
> > > > If only I understood your question correctly.. I can send you a
> tiny
> > > > application with wich you can get a color which you like (by
> using
> > > > Red, Green and Blue scroll controls) and see the corresponding
> > > > value of color code.
> >
> > Could I get that tiny color application too? bierly@xxxxxxxxxx
> Thanks so
> > much.
> >
> > Toby
> >
> > ----- Original Message -----
> > From: "Ray at work" <listray@xxxxxxxxxx>
> > To: <windows2000@xxxxxxxxxxxxx>
> > Sent: Friday, May 28, 2004 12:16 PM
> > Subject: [windows2000] Re: OT: Color picking application
> >
> >
> > >
> > >
> > > > -----Original Message-----
> > > > From: windows2000-bounce@xxxxxxxxxxxxx
> > > > [mailto:windows2000-bounce@xxxxxxxxxxxxx] On Behalf Of V T
> > > >
> > > >
> > > > If only I understood your question correctly.. I can send you a
> tiny
> > > > application with wich you can get a color which you like (by
> using
> > > > Red, Green and Blue scroll controls) and see the corresponding
> > > > value of color code.
> > >
> > > Yes, that! Please! mailto:listray@xxxxxxxxxx
> > >
> > > Thank you V T.
> > >
> > > Ray at work
> > >
> > >
> > > ********************************************************
> > > 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
> > >
> > >
> > > BEGIN-CLEANMESSAGE-VOTING-LINKS
> > > ------------------------------------------------------
> > > Teach CleanMessage if this mail (ID 1088551) is spam:
> > > Spam:
> > http://sts4.cleanmessage.com/b.php?c=s&i=1088551&m=fff2b27dae4b
> > > Not spam:
> > http://sts4.cleanmessage.com/b.php?c=n&i=1088551&m=fff2b27dae4b
> > > Forget vote:
> > http://sts4.cleanmessage.com/b.php?c=f&i=1088551&m=fff2b27dae4b
> > > ------------------------------------------------------
> > > END-CLEANMESSAGE-VOTING-LINKS
> > >
> > >
> >
> > ********************************************************
> > 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
> >
> >
>
>
> ********************************************************
> 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
>
>
> BEGIN-CLEANMESSAGE-VOTING-LINKS
> ------------------------------------------------------
> Teach CleanMessage if this mail (ID 1092568) is spam:
> Spam:
http://sts4.cleanmessage.com/b.php?c=s&i=1092568&m=a26fa0b9d11d
> Not spam: http://sts4.cleanmessage.com/b.php?c=n&i=1092568&m=a26fa0b9d1
1d
> Forget vote:
http://sts4.cleanmessage.com/b.php?c=f&i=1092568&m=a26fa0b9d11d
> ------------------------------------------------------
> END-CLEANMESSAGE-VOTING-LINKS
>
>
********************************************************
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:
- 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
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: Ray at work
- [windows2000] Re: OT: Color picking application
- From: Toby Bierly
- [windows2000] Re: OT: Color picking application
- From: V T