Java Utililty Methods RGB Color Convert To

List of utility methods to do RGB Color Convert To

Description

The list of methods to do RGB Color Convert To are organized into topic(s).

Method

float[]RGBtoHSB(int r, int g, int b, float[] hsbvals)
RG Bto HSB
float hue, saturation, brightness;
if (hsbvals == null) {
    hsbvals = new float[3];
int cmax = (r > g) ? r : g;
if (b > cmax)
    cmax = b;
int cmin = (r < g) ? r : g;
...
float[]RGBtoHSB(int red, int green, int blue, float hsb[])
Fill and return the specified array with the specified RGB values converted to HSB.
if ((red < 0 || red > 255) || (green < 0 || green > 255) || (blue < 0 || blue > 255))
    throw new IllegalArgumentException();
float r = red / 255f;
float g = green / 255f;
float b = blue / 255f;
float h = 0; 
float s; 
float v; 
...
double[]rgbToHsl(byte red, byte green, byte blue)
rgb To Hsl
final double r = (red & 0xff) / 255d;
final double g = (green & 0xff) / 255d;
final double b = (blue & 0xff) / 255d;
final double max = Math.max(Math.max(r, g), b);
final double min = Math.min(Math.min(r, g), b);
double h = 0d, s = 0d, l = (max + min) / 2d;
if (max == min) {
    h = s = 0d; 
...
float[]RgbToHsl(float r, float g, float b, float a)
Rgb To Hsl
float h = 0, s = 0, l;
float max = Math.max(r, Math.max(g, b));
float min = Math.min(r, Math.min(g, b));
if (max == min) {
    h = 0; 
} else if (max == r && g >= b) {
    h = 1.0f / 6.0f * (g - b) / (max - min);
} else if (max == r && g < b) {
...
float[]rgbToHsl(float[] rgb)
Converts an RGB color value to HSL.
float r, g, b;
r = rgb[0];
g = rgb[1];
b = rgb[2];
float max = Math.max(r, Math.max(g, b));
float min = Math.min(r, Math.min(g, b));
float avg = (max + min) / 2;
float h = avg, s = avg, l = avg;
...
double[]RGBtoHSL(int r, int g, int b)
Converts RGB to HSL.
double h = 0;
double s = 0;
double l = 0;
double varR = r / 255.0;
double varG = g / 255.0;
double varB = b / 255.0;
double varMin = Math.min(varR, Math.min(varG, varB));
double varMax = Math.max(varR, Math.max(varG, varB));
...
float[]RGBtoHSL(int r, int g, int b)
RG Bto HSL
float R = (float) r / 255;
float G = (float) g / 255;
float B = (float) b / 255;
float min = Math.min(Math.min(R, G), B); 
float max = Math.max(Math.max(R, G), B); 
float delta = max - min; 
float L = (max + min) / 2;
float H, S;
...
voidRGBtoHSL(int r, int g, int b, float[] hsl)
RG Bto HSL
final float rf = r / 255f;
final float gf = g / 255f;
final float bf = b / 255f;
final float max = Math.max(rf, Math.max(gf, bf));
final float min = Math.min(rf, Math.min(gf, bf));
final float deltaMaxMin = max - min;
float h, s;
float l = (max + min) / 2f;
...
float[]rgbToHsl(int red, int green, int blue)
RGB to HSL
float r = (float) red / 255.0f;
float g = (float) green / 255.0f;
float b = (float) blue / 255.0f;
float max = Math.max(r, Math.max(g, b));
float min = Math.min(r, Math.min(g, b));
float d = max - min;
float l = (max + min) / 2.0f;
float h;
...
voidrgbToHsv(byte[] rgb, float[] hsv)
rgb To Hsv
rgbToHsv(rgb[0] & 0xff, rgb[1] & 0xff, rgb[2] & 0xff, hsv);