Here you can find the source of getColorFromArgb(int[] argb)
Parameter | Description |
---|---|
argb | a parameter |
public static int getColorFromArgb(int[] argb)
//package com.java2s; public class Main { /**// www . jav a 2s . com * Gets an int color from an int[4] containing argb values. * @param argb * @return an int containing the result color */ public static int getColorFromArgb(int[] argb) { if (argb.length != 4) { throw new IllegalArgumentException( "ARGB int array must have a length of 4."); } return (ClippedColorPart(argb[0]) << 24) + (ClippedColorPart(argb[1]) << 16) + (ClippedColorPart(argb[2]) << 8) + (ClippedColorPart(argb[3])); } public static int ClippedColorPart(int color) { if (color < 0) { return 0; } else if (color > 0xFF) { return 0xFF; } return color; } }