Color To Integer - Java 2D Graphics

Java examples for 2D Graphics:Color

Description

Color To Integer

Demo Code


//package com.java2s;
import java.awt.Color;

public class Main {
    /**/*from w  ww.  ja v a  2  s  .  c  o m*/
     * 
     * @param c
     * @return
     */
    public static Integer ColorToInteger(Color c) {
        int i = 0;
        int r = ((c.getRed()) & 0xff);
        i |= r;

        i |= (c.getGreen() << 8) | (c.getBlue() << 16);
        return i;
    }
}

Related Tutorials