1. converting (Neil's) rgb formt
- Posted by Talvitie <smtoa at SAUNALAHTI.FI>
Oct 10, 1999
-
Last edited Oct 11, 1999
I now have texture mapping somewhat done, but I'd need to load 24-bit =
images for testing purposes.
I use Neil for this, but how may I change the neil's #RRGGBB format into =
mine {#RR,#GG,#BB}
backwards it goes like this:
rgb=3D {100,100,100}
neilrgb=3D rgb[1]*65536+rgb[2]*256+rgb[3]
but what should I do here:
neilrgb=3D6579300
rgb=3D ?????
--Talvitie
2. Re: converting (Neil's) rgb formt
but what should I do here:
neilrgb=6579300
rgb = repeat(neilrgb, 3)
rgb[1] = floor(rgb[1]/65536)
rgb[3] = remainder(rgb[3], 256)
rgb[2] = (remainder(rgb[3], 65536) - rgb[3]) / 256
That is one way. You should be able to devise another 5 by now. :)
Lucius L. Hilley III
lhilley at cdc.net lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow | ICQ: 9638898 | AIM: LLHIII | Computer |
| Horse +--------------+--------------+ Cafe' |
| Software | http://www.cdc.net/~lhilley | USA |
+----------+-------+---------------------+----------+
| http://www.ComputerCafeUSA.com |
+--------------------------------+
----- Original Message -----
From: Talvitie <smtoa at SAUNALAHTI.FI>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, October 10, 1999 1:27 PM
Subject: converting (Neil's) rgb formt
> ---------------------- Information from the mail
header -----------------------
> Sender: Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster: Talvitie <smtoa at SAUNALAHTI.FI>
> Subject: converting (Neil's) rgb formt
> --------------------------------------------------------------------------
-----
>
> I now have texture mapping somewhat done, but I'd need to load 24-bit =
> images for testing purposes.
> I use Neil for this, but how may I change the neil's #RRGGBB format into =
> mine {#RR,#GG,#BB}
>
> backwards it goes like this:
> rgb= {100,100,100}
> neilrgb= rgb[1]*65536+rgb[2]*256+rgb[3]
>
> but what should I do here:
> neilrgb=6579300
> rgb= ?????
>
> --Talvitie
>
3. Re: converting (Neil's) rgb formt
On Sun, 10 Oct 1999 20:27:28 +0300, Talvitie <smtoa at SAUNALAHTI.FI> wrote:
>I now have texture mapping somewhat done, but I'd need to load 24-bit
images for testing purposes.
>I use Neil for this, but how may I change the neil's #RRGGBB format into
mine {#RR,#GG,#BB}
>
>backwards it goes like this:
>rgb= {100,100,100}
>neilrgb= rgb[1]*65536+rgb[2]*256+rgb[3]
>
>but what should I do here:
>neilrgb=6579300
>rgb= ?????
>
>--Talvitie
Produce a hex string and it drops right out.
Everett L.(Rett) Williams
rett at gvtc.com
4. Re: converting (Neil's) rgb formt
- Posted by Talvitie <smtoa at SAUNALAHTI.FI>
Oct 10, 1999
-
Last edited Oct 11, 1999
Lucius L. Hilley III wrote:
> neilrgb=3D6579300
> rgb =3D repeat(neilrgb, 3)
> rgb[1] =3D floor(rgb[1]/65536)
> rgb[3] =3D remainder(rgb[3], 256)
> rgb[2] =3D (remainder(rgb[3], 65536) - rgb[3]) / 256
Thanks :)
btw, there's a little error in the last line. It should go like this:
rgb[2] =3D (remainder(rgb[2], 65536) - rgb[3]) / 256
--Talvitie
5. Re: converting (Neil's) rgb formt
Actually I got the 3rd and 2nd reversed. It should be as below.
The green and blue would have been mixed up. :(
rgb[1] = floor(rgb[1]/65536)
rgb[2] = remainder(rgb[2], 256)
rgb[3] = (remainder(rgb[3], 65536) - rgb[2]) / 256
Lucius L. Hilley III
lhilley at cdc.net lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow | ICQ: 9638898 | AIM: LLHIII | Computer |
| Horse +--------------+--------------+ Cafe' |
| Software | http://www.cdc.net/~lhilley | USA |
+----------+-------+---------------------+----------+
| http://www.ComputerCafeUSA.com |
+--------------------------------+
----- Original Message -----
From: Talvitie <smtoa at SAUNALAHTI.FI>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, October 10, 1999 3:45 PM
Subject: Re: converting (Neil's) rgb formt
> ---------------------- Information from the mail
header -----------------------
> Sender: Euphoria Programming for MS-DOS
<EUPHORIA at LISTSERV.MUOHIO.EDU>
> Poster: Talvitie <smtoa at SAUNALAHTI.FI>
> Subject: Re: converting (Neil's) rgb formt
> --------------------------------------------------------------------------
-----
>
> Lucius L. Hilley III wrote:
> > neilrgb=3D6579300
> > rgb =3D repeat(neilrgb, 3)
> > rgb[1] =3D floor(rgb[1]/65536)
> > rgb[3] =3D remainder(rgb[3], 256)
> > rgb[2] =3D (remainder(rgb[3], 65536) - rgb[3]) / 256
>
>
> Thanks :)
> btw, there's a little error in the last line. It should go like this:
> rgb[2] =3D (remainder(rgb[2], 65536) - rgb[3]) / 256
>
> --Talvitie
>