question: private int calculateGraidentChannel ( int sourceChannel , int destChannel , int distance , int offset ) { if ( sourceChannel == destChannel ) { return sourceChannel ; } float ratio = ( ( float ) offset ) / ( ( float ) distance ) ; int pos = ( int ) ( Math . abs ( sourceChannel - destChannel ) * ratio ) ; if ( sourceChannel > destChannel ) { return sourceChannel - pos ; } else { return sourceChannel + pos ; } }
target:  Converts the color channel value according to the offest within the distance