to RGBA - Java 2D Graphics

Java examples for 2D Graphics:Color RGB

Description

to RGBA

Demo Code


//package com.java2s;

public class Main {
    public static int[] toRGBA(int color) {
        int alpha = color >> 24 & 255;
        int red = color >> 16 & 255;
        int green = color >> 8 & 255;
        int blue = color & 255;

        return new int[] { red, green, blue, alpha };
    }/*from   w  w w  .j  a va 2s  .  c o  m*/
}

Related Tutorials