Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.graphics.Color;

public class Main {
    public static int blendColors(int color1, int color2, float percent) {
        float inverseRation = 1 - percent;
        float r = Color.red(color1) * percent + Color.red(color2) * inverseRation;
        float g = Color.green(color1) * percent + Color.green(color2) * inverseRation;
        float b = Color.blue(color1) * percent + Color.blue(color2) * inverseRation;
        return Color.rgb((int) r, (int) g, (int) b);
    }
}