Here you can find the source of combine(int r, int g, int b, int a)
Parameter | Description |
---|---|
r | the red value |
g | the green value |
b | the blue value |
a | the alpha value |
public static int combine(int r, int g, int b, int a)
//package com.java2s; /*//from w w w .j a va2s . c o m * This program 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. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Combines the R,G,B,A values back into single integer. * * @param rgba the RGBA values * @return the combined integer */ public static int combine(int[] rgba) { return combine(rgba[0], rgba[1], rgba[2], rgba[3]); } /** * Combines the R,G,B,A values back into single integer. * * @param r the red value * @param g the green value * @param b the blue value * @param a the alpha value * @return the combined integer */ public static int combine(int r, int g, int b, int a) { return (r << 16) + (g << 8) + (b << 0) + (a << 24); } }