Phil Mobley and I (well, OK, mostly Phil to be honest) have been
working on a collection of methods that work with colors, pictures, etc.

   http://www.verex.com/opensource/

Your contrast routine (ContrastBW) is based on luminance, which gives
a good result, but requires three floating-point multiplications to
calculate (not to mention an extra function call). If for some reason
your contrast calculation ever needs blazing speed, it's faster and
just as pleasing to the eye to base it on the green component:

 Function Contrast(extends c as color) as color
   if c.Green < 170 then return &cFFFFFF // else returns &c000000
 End Function

Here's a little app that illustrates this nicely:

 http://ljensen.com/rb/ContrastTester.rbp.zip

lj
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to