 = ig1 * (1 - dX) + ig2 * dX: b =
             ib1 * (1 - dX) + ib2 * dX
            
            ' Set output:
            If (r &lt; 0) Then r = 0
            If (r &gt; 255) Then r = 255
            If (g &lt; 0) Then g = 0
            If (g &gt; 255) Then g = 255
            If (b &lt; 0) Then b = 0
            If (b &gt; 255) Then
                b = 255
            End If
            xOut = x * 3
            bDibTo(xOut, y) = b
            bDibTo(xOut + 1, y) = g
            bDibTo(xOut + 2, y) = r
  