Java RGB Color Create rgb(float rIn, float gIn, float bIn)

Here you can find the source of rgb(float rIn, float gIn, float bIn)

Description

Makes an integer color from the given red, green, and blue float values

License

LGPL

Declaration

public static int rgb(float rIn, float gIn, float bIn) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**/*from  ww w. j  a v  a  2s. com*/
     * Makes an integer color from the given red, green, and blue float values
     */
    public static int rgb(float rIn, float gIn, float bIn) {
        return rgb(floor(rIn * 255.0F), floor(gIn * 255.0F), floor(bIn * 255.0F));
    }

    /**
     * Makes a single int color with the given red, green, and blue values.
     */
    public static int rgb(int rIn, int gIn, int bIn) {
        int lvt_3_1_ = (rIn << 8) + gIn;
        lvt_3_1_ = (lvt_3_1_ << 8) + bIn;
        return lvt_3_1_;
    }

    /**
     * Returns the greatest integer less than or equal to the float argument
     */
    public static int floor(float value) {
        int i = (int) value;
        return value < (float) i ? i - 1 : i;
    }

    /**
     * Returns the greatest integer less than or equal to the double argument
     */
    public static int floor(double value) {
        int i = (int) value;
        return value < (double) i ? i - 1 : i;
    }
}

Related

  1. makeLinear_sRGBCM(boolean premult)
  2. makeRgbImage(int[][] rbgImage)
  3. msAccesToRGBa(int code)
  4. newRGBImage(int[] rgb, int width, int height, boolean processAlpha)
  5. RGB(float R, float G, float B)
  6. rgb(int a, int r, int g, int b)
  7. rgb(int argb)
  8. rgb(int pixel)
  9. rgb(int r, int g, int b)