Java interpolate interpolateColors(int a, int b, float lerp)

Here you can find the source of interpolateColors(int a, int b, float lerp)

Description

interpolate Colors

License

Open Source License

Declaration

public static int interpolateColors(int a, int b, float lerp) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 Yancarlo Ramsey and CJ Bowman
 * Licensed as open source with restrictions. Please see attached LICENSE.txt.
 ******************************************************************************/

public class Main {
    public static int interpolateColors(int a, int b, float lerp) {
        final int MASK1 = 0xff00ff;
        final int MASK2 = 0x00ff00;

        int f2 = (int) (256 * lerp);
        int f1 = 256 - f2;

        return (((((a & MASK1) * f1) + ((b & MASK1) * f2)) >> 8) & MASK1)
                | (((((a & MASK2) * f1) + ((b & MASK2) * f2)) >> 8) & MASK2);
    }/*www.j  a v a  2 s.  c o m*/
}

Related

  1. interpolateClamp(final double position, final double startPosition, final double endPosition, final double startValue, final double endValue)
  2. interpolateColor(double x, double y, int c0, int c1, int c2, int c3)
  3. interpolateColor(int a, int b, float w)
  4. interpolateColor(int c1, int c2, int st, int sts)
  5. interpolateColor(int rgba1, int rgba2, float percent)
  6. interpolateColors(int c0, int c1, float w)
  7. interpolateCubic(int x0, int x1, int x2, int x3, double t)
  8. interpolatedNoise(int x, int z, int reciprocal)
  9. interpolatedSample(double xStart, double xVal, double xEnd, double yStart, double yEnd)