Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.graphics.Color;

public class Main {
    /**
     * Alters the alpha of a given color and spits out the new color.
     * @param color the color to change the alpha of.
     * @param value the new value of the alpha field.
     * @return the new color with the new alpha level.
     */
    public static int getNewColorAlpha(int color, float value) {
        int alpha = Math.round(Color.alpha(color) * value);
        int r = Color.red(color);
        int g = Color.green(color);
        int b = Color.blue(color);
        return Color.argb(alpha, r, g, b);
    }
}