色调到rgb谷歌地图标记

Ajo*_*uve 4 rgb android google-maps-android-api-2

我用色调颜色创建我的谷歌地图标记

https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/BitmapDescriptorFactory#defaultMarker(float)

标记的色调.值必须大于或等于0且小于360.

有没有办法转换这个色调女巫是浮动到rgb颜色?

谢谢

Mac*_*ski 6

试试这段代码:

float hue = 180.0f;
int color = Color.HSVToColor(new float[] { hue, 1.0f, 1.0f });
Run Code Online (Sandbox Code Playgroud)

更多信息:

/**
 * Convert HSV components to an ARGB color. Alpha set to 0xFF.
 *     hsv[0] is Hue [0 .. 360)
 *     hsv[1] is Saturation [0...1]
 *     hsv[2] is Value [0...1]
 * If hsv values are out of range, they are pinned.
 * @param hsv  3 element array which holds the input HSV components.
 * @return the resulting argb color
*/
public static int HSVToColor(float hsv[]) {
Run Code Online (Sandbox Code Playgroud)