At 11:31 PM +0100 13-03-00, Richard Hartman wrote:
>Couldn't this be optimized by computing the squares for each color
>table entry as it is set into the table?

I don't think so.  Well, anyway not much.  To compute distance, you have to
square the difference.  (a-b)^2 = a^2 - 2ab - b^2.  So, even if you had a^2
precomputed you'd still have to do a bunch of multiplications.

Also, in the normal course of using the OS, we don't actually do
WinRGBToIndex very often.  If you have an app that does it more frequently
or has custom needs, you're probably better of computing the indexes once
and caching them.

Beyond that.. well, there's API to get the current palette, so you could
always implement your own (better/faster) RGB to index routine!

                                --Bob



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to