Java Utililty Methods RGB Color Create

List of utility methods to do RGB Color Create

Description

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

Method

StringRGBAFromHSLA(float h, float s, float l, float a)
Converts SAC HSLA (or HSL) LexicalUnit value to RGBA
int r, g, b;
float m2;
if (l <= 0.5)
    m2 = l * (s + 1);
else
    m2 = l + s - l * s;
float m1 = l * 2 - m2;
r = (int) (HUEToRGB(m1, m2, h + 1 / 3F) * 255);
...
floatrgbClamp(float c)
rgb Clamp
return c > 1f ? 1f : c < 0f ? 0f : c;
int[]rgbComponents(int argb)
Breaks a Processing color into R, G and B values in an array.
int[] comp = new int[3];
comp[0] = (argb >> 16) & 0xFF; 
comp[1] = (argb >> 8) & 0xFF; 
comp[2] = argb & 0xFF; 
return comp;
doublergbDistance(int color1, int color2)
Get the Euclidean distance between two colors.
int[] c1, c2;
c1 = decode(color1);
c2 = decode(color2);
return Math.pow(c1[0] - c2[0], 2) + Math.pow(c1[1] - c2[1], 2) + Math.pow(c1[2] - c2[2], 2);
int[]rgbFromColorInt(int c)
rgb From Color Int
return new int[] { redFromColorInt(c), greenFromColorInt(c), blueFromColorInt(c) };
intrgbFromGrayscale(int grayscale)
Converts a grayscale value into an RGB color space rgb integer.
return getRgb(grayscale, grayscale, grayscale);
longtoRGB(byte r, byte g, byte b, byte a)
to RGB
long result = (int) r & 0xff;
result |= ((int) g & 0xff) << 8;
result |= ((int) b & 0xff) << 16;
result |= ((int) a & 0xff) << 24;
return result & 0xFFFFFFFFL;
inttoRGB(final int r, final int g, final int b, final int a)
to RGB
return ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF) << 0);
byte[]toRGB(float h, float s, float l)
to RGB
h = h % 360.0f;
h /= 360f;
s /= 100f;
l /= 100f;
float q = 0;
if (l < 0.5)
    q = l * (1 + s);
else
...
inttoRGB(int alpha, int red, int green, int blue)
to RGB
return (alpha & 0xff) << 24 | (red & 0xff) << 16 | (green & 0xff) << 8 | (blue & 0xff) << 0;