|
interpolation mode
| |
Description:
This mode somehow combines multiply and screen mode (looks very similar for very dark or bright colors).
A cosine function is used for calculation, similar to a cosine interpolation algorithm
(that's why I gave it this name).
This result is similar to average mode, but has a better contrast.
Formula:
f(a,b) = ½ - ¼cos(pi*a) - ¼cos(pi*b)
Advantage:
This mode is commutative (base and blend color can be swapped).
Code:
It is useful to precalculate a cosine table to increase speed.
Note that the result can become greater than 255. This is avoidable by using a factor of 63 instead of 64, but this way you cannot reach 0 and 255 with one formula.
|
|