Here you can find the source of colorFromRGBA(int red, int green, int blue, int alpha)
Parameter | Description |
---|---|
alpha | a parameter |
red | a parameter |
green | a parameter |
blue | a parameter |
public static int colorFromRGBA(int red, int green, int blue, int alpha)
//package com.java2s; /*/*from w w w . j a v a2 s. com*/ This file is part of Cuber. Cuber is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Cuber is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Cuber. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Convert R, G, B, Alpha to standard 8 bit * * @param alpha * @param red * @param green * @param blue * @return standard 8 bit * @since 21/06/2013 * @author wonka */ public static int colorFromRGBA(int red, int green, int blue, int alpha) { int newPixel = 0; newPixel += alpha; newPixel = newPixel << 8; newPixel += red; newPixel = newPixel << 8; newPixel += green; newPixel = newPixel << 8; newPixel += blue; return newPixel; } }