28 Şubat 2018 Çarşamba

Android - HSV to RGB conversion(using Color.HSVToColor) and RGB to HSV conversion( using Color.RGBToHSV() or Color.colorToHSV() method )

/* hsv to rgb conversion  */
float [] colorsHSV = new float[]{1f,1f,1f};
int rgbColor = Color.HSVToColor(colorsHSV);
/* hsv to rgb conversion  */

/* Obtain red,green,color values, create a rgb using them */
int red = Color.red(rgbColor);
int green = Color.green(rgbColor);
int blue = Color.blue(rgbColor);
rgbColor = Color.rgb(red,green,blue);
/* Obtain red,green,color values, create a rgb using them */

/* rgb TO HSV conversion - way 1   */
float[] newHSV = new float[3];
Color.RGBToHSV(red,green,blue,newHSV);
/* rgb TO HSV conversion - way 1   */

/* rgb TO HSV conversion - way 2   */
float[] newHSV2 = new float[3];
Color.colorToHSV(rgbColor,newHSV2);
/* rgb TO HSV conversion - way 2   */

Hiç yorum yok:

Yorum Gönder