Here you can find the source of rgbComponents(int argb)
Parameter | Description |
---|---|
argb | a Processing color as a 32-bit integer |
public static int[] rgbComponents(int argb)
//package com.java2s; //License from project: Open Source License public class Main { /**//from www .jav a 2 s . co m * Breaks a Processing color into R, G and B values in an array. * @param argb a Processing color as a 32-bit integer * @return an array of integers in the intRange 0..255 for 3 primary color components: {R, G, B} */ public static int[] rgbComponents(int argb) { int[] comp = new int[3]; comp[0] = (argb >> 16) & 0xFF; // Faster way of getting red(argb) comp[1] = (argb >> 8) & 0xFF; // Faster way of getting green(argb) comp[2] = argb & 0xFF; // Faster way of getting blue(argb) return comp; } }