Java Integer From IntFromRGB(int r, int g, int b)

Here you can find the source of IntFromRGB(int r, int g, int b)

Description

Int From RGB

License

Open Source License

Parameter

Parameter Description
r red part of color (up to 255)
g green part of color (up to 255)
b blue part of color (up to 255)

Return

a color integer value.

Declaration


public static int IntFromRGB(int r, int g, int b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  w w  w .ja v  a2 s . c o  m*/
     * @param r red part of color (up to 255)
     * @param g green part of color (up to 255)
     * @param b blue part of color (up to 255)
     * @return a color integer value.
     */

    public static int IntFromRGB(int r, int g, int b) {

        /*
         *  Blue =    1 -> 255;      add 1      per 1 rgb;
         *    Green = 256 -> 65280;    add 255      per 1 rgb;
         *    Red =    16711680;      add 65535   per 1 rgb;
         *
         *    Black = 0
         *    White = 16777215
         */

        return r * 256 * 256 + g * 256 + b;
    }
}

Related

  1. intFromBytes(byte[] bytes, int offset)
  2. intFromByteWithoutStupidJavaSignExtension(byte val)
  3. intFromHex(String hex, boolean signed)
  4. intFromJSON(String[] json, int pos)
  5. intFromLex(byte[] bytes)
  6. intFromString(String str, int dflt)
  7. intFromSyncSafeByteArray(byte[] buf, int offset, int len)
  8. intFromUnsignedByte(byte b)