from RGB - Java 2D Graphics

Java examples for 2D Graphics:Color RGB

Description

from RGB

Demo Code


//package com.java2s;

public class Main {
    public static int fromRGB(int r, int g, int b) {
        return fromRGBA(r, g, b, 255);
    }//from w  w w.  j a  v a 2s . c o m

    public static int fromRGBA(int r, int g, int b, int a) {
        return (a & 255) << 24 | (r & 255) << 16 | (g & 255) << 8 | b & 255;
    }
}

Related Tutorials