[comp.windows.x.motif] alternative 3D color generation algorithm?

bob@odi.com (Bob Miner) (07/25/90)

     I've need to do something similar.  I create some PushButtons which
     change color dynamically during the program's execution and I wish
     to retain the 3-D look, so I explicitly set the armColor, topShadowColor,
     bottomShadowColor, and background colors during program execution.

     Since JPL is still not a OSF/Motif source licensee (but only for 3 more
     weeks - YAH!), I tried to copy the "default" behavior.  I have no idea
     if this is the algorithm they use, so if it is then please ignore ...

     Please post/e-mail if you find a better algorithm.  One thing to note
     about this method is that it doesn't work very well for pure colors.

     -Enjoy

                                      Basil Hashem
                                  basil@thyme.jpl.nasa.gov
                 Jet Propulsion Laboratory     La Canada Flintridge, CA


Thanks for your algorithm.  It's essentially the same as that used by Motif,
except that the percentages are different, although not by more than a few
percentage points.  I'd tell you the percentages, but I'm not sure if OSF's
lawyers would then jump me.

BTW, I just received a bunch of stuff from OSF about Motif 1.1 and one of
the items listed as improved is:

       Improved colors - Better handling of very saturated, very light and
			 dark colors.  Ability for users to plug in automatic
			 color generation.

So it sounds like their algorithm has improved in 1.1.

Bob Miner

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      OOOOOOO			    ~ Bob Miner
   OOOO     OOOO		    ~ Object Design, Inc.
  OOOOO     OOOOO		    ~ 1 New England Executive Park
  OOOOO     OOOOO 		    ~ Burlington, MA 01803   USA
   OOOO     OOOO		    ~ bob@odi.com or uunet!odi!bob
      OOOOOOO    bject Design Inc.  ~ voice: (617) 270-9797 FAX: (617) 270-3509
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   "From there to here, from here to there, funny things are everywhere."
								- Dr. Seuss
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~