Android Int to Color Convert RGBArray(Resources resources, int colorId)

Here you can find the source of RGBArray(Resources resources, int colorId)

Description

RGB Array

Declaration

public static float[] RGBArray(Resources resources, int colorId) 

Method Source Code

//package com.java2s;
import android.content.res.Resources;

public class Main {
    public static float[] RGBArray(Resources resources, int colorId) {
        int color = resources.getColor(colorId);

        float red = (color >> 16) & 0xFF;
        float green = (color >> 8) & 0xFF;
        float blue = (color >> 0) & 0xFF;
        float alpha = (color >> 24) & 0xFF;
        return new float[] { red / 255f, green / 255f, blue / 255f,
                alpha / 255f };/*from   w  w  w.j  a  v  a  2 s . c  o m*/
    }
}

Related

  1. GetColorString(int ColorInt)