Very Slightly OT: Help Recaclulating HEX color codes?
Oldbitcollector (Jeff)
Posts: 8,091
I'm working with a spin program which reads .XPM files which contain color entries that
look like this: #000080800000", #0000FFFF0000", #000080808080" (Hex RGB)
I'm failing to come up with a reducer calculation which would lump all shades of
white as #FFFFFFFFFFFF.
Without letting too much out of the bag, I have 64 colors to get to.
Has any done other work with RGB colors to have a decent solution I
could implement in spin?
Thanks
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with the Protoboard? - Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card? - PropDOS
A Living Propeller FAQ - The Propeller Wiki
(Got the Knowledge? Got a Moment? Add something today!)
look like this: #000080800000", #0000FFFF0000", #000080808080" (Hex RGB)
I'm failing to come up with a reducer calculation which would lump all shades of
white as #FFFFFFFFFFFF.
Without letting too much out of the bag, I have 64 colors to get to.
Has any done other work with RGB colors to have a decent solution I
could implement in spin?
Thanks
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with the Protoboard? - Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card? - PropDOS
A Living Propeller FAQ - The Propeller Wiki
(Got the Knowledge? Got a Moment? Add something today!)
Comments
This will give you a six-bit value for your RGB colour and it assumes that your palette is set to match it (e.g. 0x00110000 gives full red, and 0x00111100 gives yellow, etc)
If you must keep your 'two-bytes-per-component' structure, then instead of shifting and OR'ing your results do the following :
Hope this helps
Edit : Since you are reducing from over 281 trillion colours to just 64, expect some loss of detail!
Post Edited (big_mark) : 3/20/2008 3:53:03 PM GMT
I've managed to reduce the source codes to three hex digits,
which should help. white is now #FFFFFF instead of #FFFFFFFFFFFF.
Thank should help... Just looking for a big glass of watch to
swallow that explanation with.. [noparse]:)[/noparse]
Thanks!
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with the Protoboard? - Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card? - PropDOS
A Living Propeller FAQ - The Propeller Wiki
(Got the Knowledge? Got a Moment? Add something today!)
Post Edited (Oldbitcollector) : 3/20/2008 8:36:41 PM GMT