Perfect split tone algorithm (hopefully??)

No seriously, this is the LAST TIME I'm messing with this dialog.  :P

I think I have finally arrived at the "ideal" implementation of this
algorithm.  After much additional research, I discovered that the key to
traditional split-toning is that the midtones are left relatively
untouched from the second toning pass.  In digital terms, this means
that the midtones should be *grayscale*, instead of a blend between the
shadow and highlight colors.  (Apologies to @audioglider, who probably
knew this with his initial implementation, which I then proceeded to
mangle.)

The math is a little sketchy, but this latest formula basically treats
the image as a 3-point gradient: shadow -> gray -> highlight, with the
user's Balance parameter controlling the position of the gray node.
This lends itself to very beautiful coloring, while naturally
emphasizing the regions of greatest contrast in the image.

It's hard to tell from YouTube videos, but to my eye, this version of
the tool also produces extremely close results to Adobe Lightroom's
split-toning algorithm.  So hopefully that means we're in good company.
:)