According to the document, android.graphics.Color has a method called RGBToHSV
which can convert RGB values to HSV, this is what the document tells me:
public static void RGBToHSV (int red, int green, int blue, float[] hsv)
Convert RGB components to HSV.
hsv[0]
is Hue [0 .. 360)hsv[1]
is Saturation [0...1]hsv[2]
is Value [0...1]Parameters
- red: red component value [0..255]
- green: green component value [0..255]
- blue: blue component value [0..255]
- hsv: 3 element array which holds the resulting HSV components.
But when I write a program to test it, it doesn't work any way.
float[] hsv = new float[3];
RGBToHSV(255, 255, 0, hsv);
Log.i("HSV_H", "" + hsv[0]); // always output 0.0
Is it a bug ?