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 the given color without multiplying the current value.
     * The current alpha value is replaced by the new one. See {#getNewColorAlpha} to see
     * how to get a new alpha color by multiplying the current value by the new value.
     * @param color the color to alter.
     * @param value the new alpha value.
     * @return the new color.
     */
    public static int getNewColorAlphaNoMult(int color, float value) {
        int alpha = Math.round(value);
        int r = Color.red(color);
        int g = Color.green(color);
        int b = Color.blue(color);
        return Color.argb(alpha, r, g, b);
    }
}