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

doubleRGB_PNSR(int[] rgb1, int[] rgb2)
Calculate the peak signal-to-noise ratio
return PNSR(RGB_MSE(rgb1, rgb2), 255);
doublergb_xyz(double r)
rgxyz
if ((r /= 255.0) <= 0.04045) {
    return r / 12.92;
} else {
    return Math.pow((r + 0.055) / 1.055, 2.4);
doublergba(double r, double g, double b, double a)
rgba
return Double.longBitsToDouble(Math.round(a * 0xFFFF) << 48 | (colorLargeDigit(r) << 32)
        | (colorLargeDigit(g) << 16) | colorLargeDigit(b));
StringRGBA(int r, int g, int b, float a)
Gets rgba() string from SAC rgba LexicalUnit value
return String.format("rgba(%s, %s, %s, %s)", r, g, b, a);
intRGBA(int r, int g, int b, int a)
Convert to integer RGBA value
return (a << 24) | ((r & 255) << 16) | ((g & 255) << 8) | (b & 255);
intrgba(int red, int green, int blue)
Returns the RGB color as int.
int rgba = 255;
rgba = (rgba << 8) + red;
rgba = (rgba << 8) + green;
rgba = (rgba << 8) + blue;
return rgba;
intrgba_bilinear_filter(int rgb00, int rgb01, int rgb10, int rgb11, int u, int v)
rgbbilineafilter
int ag0, ag1, rb0, rb1;
rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8);
rgb00 >>= 8;
rgb01 >>= 8;
rgb10 >>= 8;
rgb11 >>= 8;
ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8);
...
intrgbaColour(int red, int green, int blue, int alpha)
Converts separate RGBA values into a hexadecimal RGBA colour
return ((blue & 0xFF) << 0) | ((green & 0xFF) << 8) | ((red & 0xFF) << 16) | ((alpha & 0xFF) << 24);
booleanRGBAequals(float[] rgba1, float[] rgba2, float eps)
Checks if two colors differ within supplied epsilon.
for (int i = 0; i < 3; ++i) {
    if (Math.abs(rgba1[i] - rgba2[2]) > eps) {
        return false;
float a1 = 1;
float a2 = 1;
if (rgba1.length > 3) {
...
StringRGBAFromHEX(String stringValue)
Returns RGBA from a HEX string (# should not be included)
int r = 0, g = 0, b = 0;
if (stringValue.length() == 3) {
    String sh = stringValue.substring(0, 1);
    r = Integer.parseInt(sh + sh, 16);
    sh = stringValue.substring(1, 2);
    g = Integer.parseInt(sh + sh, 16);
    sh = stringValue.substring(2, 3);
    b = Integer.parseInt(sh + sh, 16);
...