Maven module :un.api : api-image :
Class : un.api.color.Colors
Extends/Implements : -
Subclasses : -

Conversion methods for different colorspaces.
author  Johann Sorel
author  Florent Humbert


Variables : MASK_ARGB, MASK_RGB, MASK_A, MASK_R, MASK_G, MASK_B
Functions : toRGB, toRGBA, toARGB, toARGB, toARGB, toARGB, toARGB, toARGB, toRGBA, GrayScaletoRGB, invertRGB, RGBtoYUV, YUVtoRGB, RGBtoYCbCr, YCbCrtoRGB, RGBtoGrayScalePAL, RGBtoGrayScaleHDTV, YCbCrtoRGB, YCbCrtoRGB, RGBtoYCbCr, RGBToHSL, RGBtoHSL, HSLtoRGB, XYZtoRGB, RGBtoXYZ, XYZtoRGBMatrix, RGBtoXYZMatrix, RGB555toARGB, RGB555toRGBA, RGB565toARGB, RGB565toRGBA, C4toC8, C5toC8, C6toC8, C8toC4, C8toC5, C8toC6, interpolate, interpolate, fromHexa, toHexa


public int MASK_ARGB

public int MASK_RGB

public int MASK_A

public int MASK_R

public int MASK_G

public int MASK_B


public int[] toRGB (int rgb, int[] buffer)

public int[] toRGBA (int rgb, int[] buffer)

public int[] toARGB (int rgb, int[] buffer)

public int toARGB (int r, int g, int b)

public int toARGB (int[] argb)

public int toARGB (int a, int r, int g, int b)

public int toARGB (float r, float g, float b, float a)


param  rgba in order [R,G,B,A]
return  int ARGB
public int toARGB (float[] rgba)


param  argb int ARGB
return  float[] [R,G,B,A]
public float[] toRGBA (int argb, float[] buffer)

public int GrayScaletoRGB (int gray)

public int invertRGB (int rgb)

public float[] RGBtoYUV (float[] rgb)

public float[] YUVtoRGB (float[] yuv)

public float[] RGBtoYCbCr (float[] rgb)

public float[] YCbCrtoRGB (float[] ycbcr)


RGB to grayscale using PAL luma components.
http://en.wikipedia.org/wiki/Grayscale
param  rgb
return  grayscale
public float RGBtoGrayScalePAL (float[] rgb)


RGB to grayscale using HDTV luma components.
http://en.wikipedia.org/wiki/Grayscale
param  rgb
return  grayscale
public float RGBtoGrayScaleHDTV (float[] rgb)


http://en.wikipedia.org/wiki/YCbCr
public int[] YCbCrtoRGB (int[] ycbcr)

public void YCbCrtoRGB (int[] ycbcr, int[] rgb)


http://en.wikipedia.org/wiki/YCbCr
public int[] RGBtoYCbCr (int[] rgb)

public void RGBToHSL (double r, double g, double b, double[] hsl)

public void RGBtoHSL (int rgb, double[] hsl)

public int HSLtoRGB (double[] hsl)


Convert from XYZ CIE to sRGB colorspace.
param  xyz size 3, values between 0 and 1
param  rgb size 3 or 4, values between 0 and 255
public void XYZtoRGB (double[] xyz, int[] rgb)


Convert from sRGB to XYZ CIE colorspace.
param  xyz size 3, values between 0 and 1
param  rgb size 3 or 4, values between 0 and 255
public void RGBtoXYZ (double[] xyz, int[] rgb)


Convert from XYZ CIE to sRGB colorspace using only conversion matrix.
param  xyz size 3, values between 0 and 1
param  rgb size 3 or 4, values between 0 and 255
public void XYZtoRGBMatrix (double[] xyz, int[] rgb)


Convert from sRGB to XYZ CIE colorspace using only conversion matrix.
param  xyz size 3, values between 0 and 1
param  rgb size 3 or 4, values between 0 and 255
public void RGBtoXYZMatrix (double[] xyz, int[] rgb)

public int RGB555toARGB (int rgb555)

public int[] RGB555toRGBA (int rgb555)

public int RGB565toARGB (int rgb565)

public int[] RGB565toRGBA (int rgb565)


Convert 4 bits [0-16] to 8 bits [0-255] value.
public int C4toC8 (int c)


Convert 5 bits [0-31] to 8 bits [0-255] value.
origin : http://stackoverflow.com/questions/2442576/how-does-one-convert-16-bit-rgb565-to-24-bit-rgb888
public int C5toC8 (int c)


Convert 6 bits [0-63] to 8 bits [0-255] value.
origin : http://stackoverflow.com/questions/2442576/how-does-one-convert-16-bit-rgb565-to-24-bit-rgb888
public int C6toC8 (int c)


Convert 8 bits [0-255] to 4 bits [0-16] value.
public int C8toC4 (int c)


Convert 8 bits [0-255] to 5 bits [0-31] value.
origin : http://stackoverflow.com/questions/2442576/how-does-one-convert-16-bit-rgb565-to-24-bit-rgb888
public int C8toC5 (int c)


Convert 8 bits [0-255] to 6 bits [0-63] value.
origin : http://stackoverflow.com/questions/2442576/how-does-one-convert-16-bit-rgb565-to-24-bit-rgb888
public int C8toC6 (int c)


Interpolate between 2 colors.
param  start
param  end
param  ratio 0 with return start color, 1 will return end color
return
public Color interpolate (Color start, Color end, float ratio)


Interpolate between 2 colors.
param  start
param  end
param  ratio 0 with return start color, 1 will return end color
return
public int interpolate (int start, int end, float ratio)


Parse a color in format #FFFFFF
param  text
return
public Color fromHexa (Chars text)

public Chars toHexa (Color color)