| |
|
|
| |
Blend two colors directly (linear interpolation) |
|
| |
|
|
two color vector the color factor
the blended color vector
| |
|
|
| |
Implementation
01 function color_blend( ca, cb, factor )
02 dim rmin: rmin = ca( COLOR_R )
03 dim rmax: rmax = cb( COLOR_R )
04
05 dim gmin: gmin = ca( COLOR_G )
06 dim gmax: gmax = cb( COLOR_G )
07
08 dim bmin: bmin = ca( COLOR_B )
09 dim bmax: bmax = cb( COLOR_B )
10
11 dim temp
12 if( rmin > rmax ) then temp = rmin: rmin = rmax: rmax = temp
13 if( gmin > gmax ) then temp = gmin: gmin = gmax: gmax = temp
14 if( bmin > bmax ) then temp = bmin: bmin = bmax: bmax = temp
15
16 dim r: r = int( ( rmax - rmin ) * factor + rmin )
17 dim g: g = int( ( gmax - gmin ) * factor + gmin )
18 dim b: b = int( ( bmax - bmin ) * factor + bmin )
19
20 color_blend = array( r, g, b )
21 end function
|
|
| |
|
|
|