Java RGB Color Convert To RGBToInteger(int red, int green, int blue)

Here you can find the source of RGBToInteger(int red, int green, int blue)

Description

Converts representation of color in RGB model in triplet (r, g, b) to single number in hexadecimal system.

License

Open Source License

Parameter

Parameter Description
red amount of red included (between 0 and 255 inclusive)
green amount of green included (between 0 and 255 inclusive)
blue amount of blue included (between 0 and 255 inclusive)

Return

hexadecimal representation of color in RGB model

Declaration

public static int RGBToInteger(int red, int green, int blue) 

Method Source Code

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

public class Main {
    /**//from  w w  w . j  a va 2 s  . c om
     * Converts representation of color in RGB model in triplet (r, g, b) to single number in hexadecimal system.
     * @param red amount of red included (between 0 and 255 inclusive)
     * @param green amount of green included (between 0 and 255 inclusive)
     * @param blue amount of blue included (between 0 and 255 inclusive)
     * @return hexadecimal representation of color in RGB model
     */
    public static int RGBToInteger(int red, int green, int blue) {
        return 0x00000000 | (red << 16) | (green << 8) | blue;
    }
}

Related

  1. RGBtoHTML(int rgb)
  2. RGBToInt(float[] rgb)
  3. RGBtoInt(int r, int g, int b)
  4. RGBtoInt(int red, int green, int blue)
  5. RGBtoInt(String rgb)
  6. rgbToShort(int rgb)
  7. rgbToString(float r, float g, float b)
  8. rgbToText(int red, int green, int blue)
  9. rgbToUnscaledYUV(int[][] rgb)