Design Scripting Documentation
     
 
     
  Blend two colors directly (linear interpolation)  
     
     
  Inputs:  
     
two color vector
the color factor
     
  Outputs:  
     
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
 
     

Creative Commons License
The Design Scripting Library, including its sources, online documentation and graphics, are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

Online Documentation generated by { vbdoclib } version 1.0
Color-Coding generated by { vbcc } version 2.0
Page timestamp: { Feb. 2, 2006 }





 
     
     
 
Documentation
Cover Page
Expand
Collapse
 
Array
 
Bitmap File
 
Bounding Box
 
Color
 
Container
 
Doclet
 
Ellipse
 
Intersection
 
Language
 
Map
 
Matrix
 
Number
 
Nurbs
 
Range
 
STL File
 
Streams
 
String
 
Surface
 
Text File
 
Triangle
 
Vector
 
Vertex
 
Wave File