PEGTOP
 pegtop.net  >  delphi section  >  articles  >  blend modes  >  interpolation mode 

 delphi section 

 articles 
 blend modes 
 introduction 
 normal mode 
 average mode 
 multiply mode 
 screen mode 
 darken mode 
 lighten mode 
 difference modes 
 overlay mode 
 hard light mode 
 soft light mode 
 dodge modes 
 burn modes 
 quadratic modes 
 additive modes 
 interpolation mode 
 logical modes 
 RGB modes 
 HSL modes 
 opacity 
 dark modes 
 bright modes 
 final words 

 components 

 about me 

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.
index | previous page | next page
 
© Copyright 2006 by PEGTOP Software